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: 44 inserted, 39 deleted
@@ -1,12 +1,4 | |||
|
1 | 1 | // Place all the styles related to the sources controller here. |
|
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 | - |
@@ -85,12 +85,21 | |||
|
85 | 85 | respond_to do |format| |
|
86 | 86 | format.js { render partial: 'toggle_button', |
|
87 | 87 | locals: {button_id: "#announcement_toggle_#{@announcement.id}",button_on: @announcement.published? } } |
|
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 |
|
94 | 103 | @announcement = Announcement.find(params[:id]) |
|
95 | 104 | @announcement.destroy |
|
96 | 105 |
@@ -2,17 +2,18 | |||
|
2 | 2 | |
|
3 | 3 | = link_to '+ Add announcement', new_announcement_path, class: 'btn btn-success' |
|
4 | 4 | %br |
|
5 | 5 | %br |
|
6 | 6 | |
|
7 | 7 | %table.table.table-striped |
|
8 |
- %t |
|
|
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 |
|
16 | 17 | %tr |
|
17 | 18 | - @announcement = announcement |
|
18 | 19 | %td= time_ago_in_words announcement.updated_at |
@@ -25,12 +26,12 | |||
|
25 | 26 | %b |
|
26 | 27 | Notes: #{h announcement.notes} |
|
27 | 28 | %br/ |
|
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 |
|
35 | 36 | |
|
36 | 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 }"} | |
|
2 | - %div | |
|
3 |
- |
|
|
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'}); |
@@ -1,11 +1,14 | |||
|
1 | 1 | %tr |
|
2 | 2 | %td |
|
3 | 3 | = "#{problem.name}" |
|
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' |
@@ -19,8 +19,8 | |||
|
19 | 19 | = " | " |
|
20 | 20 | = link_to '[detailed result]', :action => 'result', :id => submission.id |
|
21 | 21 | = " | " |
|
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) |
@@ -1,36 +1,37 | |||
|
1 | 1 | - content_for :head do |
|
2 | 2 | = javascript_include_tag "announcement_refresh" |
|
3 | 3 | |
|
4 | 4 | = user_title_bar(@user) |
|
5 | 5 | |
|
6 | - .announcementbox{:style => (@announcements.length==0 ? "display:none" : "")} | |
|
7 | - %span{:class => 'title'} | |
|
8 |
- Announcement |
|
|
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) |
|
20 | 20 | %p=t 'main.start_soon' |
|
21 | 21 | |
|
22 | 22 | - if GraderConfiguration.show_tasks_to?(@user) |
|
23 | 23 | - if not GraderConfiguration.multicontests? |
|
24 | 24 | %table.table.table-striped.table-condensed |
|
25 | 25 | %thead |
|
26 |
- %tr |
|
|
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 |
|
34 | 35 | - @contest_problems.each do |cp| |
|
35 | 36 | - if cp[:problems].length > 0 |
|
36 | 37 | %h2{:class =>'contest-title'} |
@@ -38,12 +39,13 | |||
|
38 | 39 | %table.info |
|
39 | 40 | %tr.info-head |
|
40 | 41 | %th Task name |
|
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/ |
|
47 | 49 | |
|
48 | 50 | %script{:type => 'text/javascript'} |
|
49 | 51 | = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';" |
@@ -1,12 +1,16 | |||
|
1 | 1 | %h2 Live submit |
|
2 | 2 | %br |
|
3 | 3 | |
|
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 | 14 | = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do |
|
11 | 15 | |
|
12 | 16 | = hidden_field_tag 'editor_text', @source |
You need to be logged in to leave comments.
Login now