Description:
- add front page toggle to announcement - cosmetic change in some pages / main
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r567:cc292daee78f - - 9 files changed: 44 inserted, 39 deleted

@@ -2,11 +2,3
2 2 // They will automatically be included in application.css.
3 3 // You can use Sass (SCSS) here: http://sass-lang.com/
4 4
5 - #editor {
6 - position: absolute;
7 - top: 0;
8 - right: 0;
9 - bottom: 0;
10 - left: 0;
11 - }
12 -
@@ -88,6 +88,15
88 88 end
89 89 end
90 90
91 + def toggle_front
92 + @announcement = Announcement.find(params[:id])
93 + @announcement.update_attributes( frontpage: !@announcement.frontpage? )
94 + respond_to do |format|
95 + format.js { render partial: 'toggle_button',
96 + locals: {button_id: "#announcement_toggle_front_#{@announcement.id}",button_on: @announcement.frontpage? } }
97 + end
98 + end
99 +
91 100 # DELETE /announcements/1
92 101 # DELETE /announcements/1.xml
93 102 def destroy
@@ -5,11 +5,12
5 5 %br
6 6
7 7 %table.table.table-striped
8 - %tr
8 + %thead
9 9 %th Updated
10 10 %th Announcement
11 11 %th Author
12 - %th Published
12 + %th{style: 'width: 100px'} Published?
13 + %th{style: 'width: 100px'}Front?
13 14 %th
14 15 %th
15 16 - for announcement in @announcements
@@ -28,7 +29,7
28 29 = h announcement.body
29 30 %td= h announcement.author
30 31 %td= toggle_button(announcement.published?, toggle_announcement_url(@announcement), "announcement_toggle_#{@announcement.id}", {size: 'btn-sm'})
31 - //%td= link_to (announcement.published? ? "Yes" : "No"), url_for(controller: :announcements, action: :toggle, id: announcement), { class: "btn btn-block btn-sm btn-#{(announcement.published? ? 'success' : 'default')} ajax-toggle", id: "published-#{announcement.id}", data: {remote: true, method: 'post' } }
32 + %td= toggle_button(announcement.frontpage?, toggle_front_announcement_url(@announcement), "announcement_toggle_front_#{@announcement.id}", {size: 'btn-sm'})
32 33 %td= link_to 'Edit', edit_announcement_path(announcement), class: 'btn btn-block btn-sm btn-info'
33 34 %td= link_to 'Destroy', announcement, :confirm => 'Are you sure?', :method => :delete, class: "btn btn-block btn-sm btn-danger"
34 35 %br
@@ -1,19 +1,13
1 - .announcement{:id => "announcement-#{announcement.id}", :style => "#{'display: none; opacity: 0' if (defined? announcement_effect) and announcement_effect }"}
2 - %div
3 - .announcement-title
4 - -# .toggles
5 - -# %a{:href => '#', :onclick => "$(\"announcement-body-#{announcement.id}\").blindUp({duration: 0.2}); return false;"}
6 - -# [hide]
7 - -# %a{:href => '#', :onclick => "$(\"announcement-body-#{announcement.id}\").blindDown({duration: 0.2}); return false;"}
8 - -# [show]
9 - = announcement.title
10 - .announcement-body{:id => "announcement-body-#{announcement.id}"}
11 - = markdown(announcement.body)
12 - -#.pub-info
13 - -# %p= "#{announcement.author}, #{announcement.created_at}"
1 + %li.list-group-item
2 + %strong
3 + = announcement.title
4 + %small= "(updated #{time_ago_in_words(announcement.updated_at)} ago on #{announcement.updated_at})"
5 +
6 + %br
7 + = markdown(announcement.body)
8 + :javascript
9 + Announcement.updateRecentId(#{announcement.id});
10 + - if (defined? announcement_effect) and announcement_effect
14 11 :javascript
15 - Announcement.updateRecentId(#{announcement.id});
16 - - if (defined? announcement_effect) and announcement_effect
17 - :javascript
18 - $("announcement-#{announcement.id}").blindDown({duration: 0.2});
19 - $("announcement-#{announcement.id}").appear({duration: 0.5, queue: 'end'});
12 + $("announcement-#{announcement.id}").blindDown({duration: 0.2});
13 + $("announcement-#{announcement.id}").appear({duration: 0.5, queue: 'end'});
@@ -4,8 +4,11
4 4 %td
5 5 = "#{problem.full_name}"
6 6 = link_to_description_if_any "[#{t 'main.problem_desc'}] <span class='glyphicon glyphicon-file'></span>".html_safe, problem
7 - %td{:align => "center"}
7 + %td
8 8 = @prob_submissions[problem.id][:count]
9 + = link_to "[#{t 'main.submissions_link'}]", main_submission_path(problem.id)
9 10 %td
10 11 = render :partial => 'submission_short',
11 12 :locals => {:submission => @prob_submissions[problem.id][:submission], :problem_name => problem.name }
13 + %td
14 + = link_to 'Edit', direct_edit_path(problem.id), class: 'btn btn-success'
@@ -22,5 +22,5
22 22 = link_to("[#{t 'main.cmp_msg'}]", {:action => 'compiler_msg', :id => submission.id}, {:popup => true})
23 23 = " | "
24 24 = link_to("[#{t 'main.src_link'}]",{:action => 'source', :id => submission.id})
25 - = " | "
26 - = link_to "[#{t 'main.submissions_link'}]", main_submission_path(submission.problem.id)
25 + //= " | "
26 + //= link_to "[#{t 'main.submissions_link'}]", main_submission_path(submission.problem.id)
@@ -3,17 +3,17
3 3
4 4 = user_title_bar(@user)
5 5
6 - .announcementbox{:style => (@announcements.length==0 ? "display:none" : "")}
7 - %span{:class => 'title'}
8 - Announcements
9 - #announcementbox-body
6 + .panel.panel-info
7 + .panel-heading
8 + Announcement
9 + %ul.list-group
10 10 = render :partial => 'announcement', :collection => @announcements
11 11
12 +
12 13 - if GraderConfiguration.show_submitbox_to?(@user)
13 14 .submitbox
14 15 = render :partial => 'submission_box'
15 16
16 -
17 17 %hr/
18 18
19 19 - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true)
@@ -23,11 +23,12
23 23 - if not GraderConfiguration.multicontests?
24 24 %table.table.table-striped.table-condensed
25 25 %thead
26 - %tr.info-head
26 + %tr
27 27 %th Task name
28 28 %th Full name
29 29 %th # of sub(s)
30 30 %th Results
31 + %th
31 32 %tbody
32 33 = render :partial => 'problem', :collection => @problems
33 34 - else
@@ -41,6 +42,7
41 42 %th Full name
42 43 %th # of sub(s)
43 44 %th Results
45 + %th
44 46 = render :partial => 'problem', :collection => cp[:problems]
45 47
46 48 %hr/
@@ -4,6 +4,10
4 4 %textarea#text_haha{style: "display:none"}~ @source
5 5 .container
6 6 .row
7 + .col-md-12
8 + .alert.alert-info
9 + Write your code in the following box, choose language, and click submit button when finished
10 + .row
7 11 .col-md-7
8 12 %div#editor{style: 'height: 500px; border-radius: 7px; font-size: 14px;'}
9 13 .col-md-5
@@ -10,7 +10,7
10 10
11 11 resources :announcements do
12 12 member do
13 - get 'toggle'
13 + get 'toggle','toggle_front'
14 14 end
15 15 end
16 16
You need to be logged in to leave comments. Login now