Description:
- add front page toggle to announcement
- cosmetic change in some pages / main
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r567:cc292daee78f - - 9 files changed: 37 inserted, 32 deleted
@@ -1,12 +1,4 | |||||
|
1 | // Place all the styles related to the sources controller here. |
|
1 | // Place all the styles related to the sources controller here. |
|
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 | - |
|
@@ -79,24 +79,33 | |||||
|
79 | end |
|
79 | end |
|
80 | end |
|
80 | end |
|
81 |
|
81 | ||
|
82 | def toggle |
|
82 | def toggle |
|
83 | @announcement = Announcement.find(params[:id]) |
|
83 | @announcement = Announcement.find(params[:id]) |
|
84 | @announcement.update_attributes( published: !@announcement.published? ) |
|
84 | @announcement.update_attributes( published: !@announcement.published? ) |
|
85 | respond_to do |format| |
|
85 | respond_to do |format| |
|
86 | format.js { render partial: 'toggle_button', |
|
86 | format.js { render partial: 'toggle_button', |
|
87 | locals: {button_id: "#announcement_toggle_#{@announcement.id}",button_on: @announcement.published? } } |
|
87 | locals: {button_id: "#announcement_toggle_#{@announcement.id}",button_on: @announcement.published? } } |
|
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 |
|
94 | @announcement = Announcement.find(params[:id]) |
|
103 | @announcement = Announcement.find(params[:id]) |
|
95 | @announcement.destroy |
|
104 | @announcement.destroy |
|
96 |
|
105 | ||
|
97 | respond_to do |format| |
|
106 | respond_to do |format| |
|
98 | format.html { redirect_to(announcements_url) } |
|
107 | format.html { redirect_to(announcements_url) } |
|
99 | format.xml { head :ok } |
|
108 | format.xml { head :ok } |
|
100 | end |
|
109 | end |
|
101 | end |
|
110 | end |
|
102 | end |
|
111 | end |
@@ -1,36 +1,37 | |||||
|
1 | %h1 Listing announcements |
|
1 | %h1 Listing announcements |
|
2 |
|
2 | ||
|
3 | = link_to '+ Add announcement', new_announcement_path, class: 'btn btn-success' |
|
3 | = link_to '+ Add announcement', new_announcement_path, class: 'btn btn-success' |
|
4 | %br |
|
4 | %br |
|
5 | %br |
|
5 | %br |
|
6 |
|
6 | ||
|
7 | %table.table.table-striped |
|
7 | %table.table.table-striped |
|
8 |
- %t |
|
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 |
|
16 | %tr |
|
17 | %tr |
|
17 | - @announcement = announcement |
|
18 | - @announcement = announcement |
|
18 | %td= time_ago_in_words announcement.updated_at |
|
19 | %td= time_ago_in_words announcement.updated_at |
|
19 | %td |
|
20 | %td |
|
20 | - if !announcement.title.blank? |
|
21 | - if !announcement.title.blank? |
|
21 | %b Title: |
|
22 | %b Title: |
|
22 | = h announcement.title |
|
23 | = h announcement.title |
|
23 | %br/ |
|
24 | %br/ |
|
24 | - if !announcement.notes.blank? |
|
25 | - if !announcement.notes.blank? |
|
25 | %b |
|
26 | %b |
|
26 | Notes: #{h announcement.notes} |
|
27 | Notes: #{h announcement.notes} |
|
27 | %br/ |
|
28 | %br/ |
|
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 |
|
35 |
|
36 | ||
|
36 | = link_to '+ Add announcement', new_announcement_path, class: 'btn btn-success' |
|
37 | = link_to '+ Add announcement', new_announcement_path, class: 'btn btn-success' |
@@ -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 |
|
||
|
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 |
|
|
3 | = announcement.title |
|
10 | - .announcement-body{:id => "announcement-body-#{announcement.id}"} |
|
4 | + %small= "(updated #{time_ago_in_words(announcement.updated_at)} ago on #{announcement.updated_at})" |
|
|
5 | + | ||
|
|
6 | + %br | ||
|
11 |
|
|
7 | = markdown(announcement.body) |
|
12 | - -#.pub-info |
|
||
|
13 | - -# %p= "#{announcement.author}, #{announcement.created_at}" |
|
||
|
14 |
|
|
8 | :javascript |
|
15 |
|
|
9 | Announcement.updateRecentId(#{announcement.id}); |
|
16 |
|
|
10 | - if (defined? announcement_effect) and announcement_effect |
|
17 |
|
|
11 | :javascript |
|
18 |
|
|
12 | $("announcement-#{announcement.id}").blindDown({duration: 0.2}); |
|
19 |
|
|
13 | $("announcement-#{announcement.id}").appear({duration: 0.5, queue: 'end'}); |
@@ -1,11 +1,14 | |||||
|
1 | %tr |
|
1 | %tr |
|
2 | %td |
|
2 | %td |
|
3 | = "#{problem.name}" |
|
3 | = "#{problem.name}" |
|
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' |
@@ -13,14 +13,14 | |||||
|
13 | = "#{(submission.points*100/submission.problem.full_score).to_i} " |
|
13 | = "#{(submission.points*100/submission.problem.full_score).to_i} " |
|
14 | = " [" |
|
14 | = " [" |
|
15 | %tt |
|
15 | %tt |
|
16 | = submission.grader_comment |
|
16 | = submission.grader_comment |
|
17 | = "]" |
|
17 | = "]" |
|
18 | - if GraderConfiguration.show_grading_result |
|
18 | - if GraderConfiguration.show_grading_result |
|
19 | = " | " |
|
19 | = " | " |
|
20 | = link_to '[detailed result]', :action => 'result', :id => submission.id |
|
20 | = link_to '[detailed result]', :action => 'result', :id => submission.id |
|
21 | = " | " |
|
21 | = " | " |
|
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) |
@@ -1,51 +1,53 | |||||
|
1 | - content_for :head do |
|
1 | - content_for :head do |
|
2 | = javascript_include_tag "announcement_refresh" |
|
2 | = javascript_include_tag "announcement_refresh" |
|
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 |
- Announcement |
|
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) |
|
20 | %p=t 'main.start_soon' |
|
20 | %p=t 'main.start_soon' |
|
21 |
|
21 | ||
|
22 | - if GraderConfiguration.show_tasks_to?(@user) |
|
22 | - if GraderConfiguration.show_tasks_to?(@user) |
|
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 |
|
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 |
|
34 | - @contest_problems.each do |cp| |
|
35 | - @contest_problems.each do |cp| |
|
35 | - if cp[:problems].length > 0 |
|
36 | - if cp[:problems].length > 0 |
|
36 | %h2{:class =>'contest-title'} |
|
37 | %h2{:class =>'contest-title'} |
|
37 | = "#{cp[:contest] ? cp[:contest].title : 'Public problems'}" |
|
38 | = "#{cp[:contest] ? cp[:contest].title : 'Public problems'}" |
|
38 | %table.info |
|
39 | %table.info |
|
39 | %tr.info-head |
|
40 | %tr.info-head |
|
40 | %th Task name |
|
41 | %th Task name |
|
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/ |
|
47 |
|
49 | ||
|
48 | %script{:type => 'text/javascript'} |
|
50 | %script{:type => 'text/javascript'} |
|
49 | = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';" |
|
51 | = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';" |
|
50 | Announcement.registerRefreshEventTimer(); |
|
52 | Announcement.registerRefreshEventTimer(); |
|
51 |
|
53 |
@@ -1,18 +1,22 | |||||
|
1 | %h2 Live submit |
|
1 | %h2 Live submit |
|
2 | %br |
|
2 | %br |
|
3 |
|
3 | ||
|
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 | = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do |
|
14 | = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do |
|
11 |
|
15 | ||
|
12 | = hidden_field_tag 'editor_text', @source |
|
16 | = hidden_field_tag 'editor_text', @source |
|
13 | = hidden_field_tag 'submission[problem_id]', @problem.id |
|
17 | = hidden_field_tag 'submission[problem_id]', @problem.id |
|
14 | .form-group |
|
18 | .form-group |
|
15 | = label_tag "Task:" |
|
19 | = label_tag "Task:" |
|
16 | = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true |
|
20 | = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true |
|
17 |
|
21 | ||
|
18 | .form-group |
|
22 | .form-group |
@@ -1,25 +1,25 | |||||
|
1 | CafeGrader::Application.routes.draw do |
|
1 | CafeGrader::Application.routes.draw do |
|
2 | get "sources/direct_edit" |
|
2 | get "sources/direct_edit" |
|
3 |
|
3 | ||
|
4 | root :to => 'main#login' |
|
4 | root :to => 'main#login' |
|
5 |
|
5 | ||
|
6 |
|
6 | ||
|
7 | resources :contests |
|
7 | resources :contests |
|
8 |
|
8 | ||
|
9 | resources :sites |
|
9 | resources :sites |
|
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 | ||
|
17 |
|
17 | ||
|
18 | resources :problems do |
|
18 | resources :problems do |
|
19 | member do |
|
19 | member do |
|
20 | get 'toggle' |
|
20 | get 'toggle' |
|
21 | end |
|
21 | end |
|
22 | collection do |
|
22 | collection do |
|
23 | get 'turn_all_off' |
|
23 | get 'turn_all_off' |
|
24 | get 'turn_all_on' |
|
24 | get 'turn_all_on' |
|
25 | get 'import' |
|
25 | get 'import' |
You need to be logged in to leave comments.
Login now