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