Description:
announcement
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r868:826ade30ee35 - - 5 files changed: 45 inserted, 28 deleted
@@ -1,90 +1,91 | |||
|
1 | 1 | /* This is a manifest file that'll be compiled into application.css, which will include all the files |
|
2 | 2 | * listed below. |
|
3 | 3 | * |
|
4 | 4 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, |
|
5 | 5 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. |
|
6 | 6 | * |
|
7 | 7 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the |
|
8 | 8 | * compiled file so the styles you add here take precedence over styles defined in any styles |
|
9 | 9 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new |
|
10 | 10 | * file per style scope. |
|
11 | 11 | * |
|
12 | 12 | * // bootstrap says that we should not do this, but @import each file instead |
|
13 | 13 | * # *= require_tree . |
|
14 | 14 | * # *= require_self |
|
15 | 15 | */ |
|
16 | 16 | |
|
17 | 17 | //@import "jquery-ui"; |
|
18 | 18 | //@import "jquery.ui.core"; |
|
19 | 19 | //@import "jquery.ui.theme"; |
|
20 | 20 | //@import "jquery.ui.datepicker"; |
|
21 | 21 | //@import "jquery.ui.slider"; |
|
22 | 22 | //@import "jquery-ui-timepicker-addon"; |
|
23 | 23 | //@import "jquery-tablesorter/theme.metro-dark"; |
|
24 | 24 | //@import "jquery.countdown"; |
|
25 | 25 | //@import "tablesorter-theme.cafe"; |
|
26 | 26 | |
|
27 | 27 | //bootstrap |
|
28 | 28 | //@import "bootstrap-sprockets"; |
|
29 | 29 | @import "bootstrap"; |
|
30 | 30 | @import "select2/select2.min"; |
|
31 | 31 | @import "select2/select2-bootstrap-5-theme.min"; |
|
32 | 32 | |
|
33 | 33 | //@import bootstrap3-switch |
|
34 | 34 | //@import "bootstrap-toggle"; |
|
35 | 35 | //@import "bootstrap-sortable"; |
|
36 | 36 | //@import "bootstrap-datepicker3"; |
|
37 | 37 | //@import "bootstrap-datetimepicker"; |
|
38 | 38 | //@import "datatables.net-bs/css/dataTables.bootstrap.min"; |
|
39 | 39 | //@import "datatables.net-buttons-bs/css/buttons.bootstrap.min"; |
|
40 | 40 | |
|
41 | 41 | //new import |
|
42 | 42 | @import 'datatables/datatables.min'; |
|
43 | + @import 'material_icons'; | |
|
43 | 44 | |
|
44 | 45 | //bootstrap navbar color (from) |
|
45 | 46 | $bgDefault: #19197b; |
|
46 | 47 | $bgHighlight: #06064b; |
|
47 | 48 | $colDefault: #8e8eb4; |
|
48 | 49 | $colHighlight: #ffffff; |
|
49 | 50 | $dropDown: false; |
|
50 | 51 | |
|
51 | 52 | @font-face { |
|
52 | 53 | font-family: 'Glyphicons Halflings'; |
|
53 | 54 | src: font-path('bootstrap/glyphicons-halflings-regular.eot'); |
|
54 | 55 | src: font-path('bootstrap/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), |
|
55 | 56 | font-path('bootstrap/glyphicons-halflings-regular.woff') format('woff'), |
|
56 | 57 | font-path('bootstrap/glyphicons-halflings-regular.ttf') format('truetype'), |
|
57 | 58 | font-path('bootstrap/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg'); |
|
58 | 59 | } |
|
59 | 60 | |
|
60 | 61 | /* |
|
61 | 62 | .navbar-default { |
|
62 | 63 | background-color: $bgDefault; |
|
63 | 64 | border-color: $bgHighlight; |
|
64 | 65 | |
|
65 | 66 | .navbar-brand { |
|
66 | 67 | color: $colDefault; |
|
67 | 68 | |
|
68 | 69 | &:hover, &:focus { |
|
69 | 70 | color: $colHighlight; |
|
70 | 71 | } |
|
71 | 72 | } |
|
72 | 73 | |
|
73 | 74 | .navbar-text { |
|
74 | 75 | color: $colDefault; |
|
75 | 76 | } |
|
76 | 77 | |
|
77 | 78 | .navbar-nav { |
|
78 | 79 | > li { |
|
79 | 80 | > a { |
|
80 | 81 | color: $colDefault; |
|
81 | 82 | |
|
82 | 83 | &:hover, &:focus { |
|
83 | 84 | color: $colHighlight; |
|
84 | 85 | } |
|
85 | 86 | } |
|
86 | 87 | |
|
87 | 88 | @if $dropDown { |
|
88 | 89 | > .dropdown-menu { |
|
89 | 90 | background-color: $bgDefault; |
|
90 | 91 |
@@ -20,97 +20,97 | |||
|
20 | 20 | def show |
|
21 | 21 | @announcement = Announcement.find(params[:id]) |
|
22 | 22 | |
|
23 | 23 | respond_to do |format| |
|
24 | 24 | format.html # show.html.erb |
|
25 | 25 | format.xml { render :xml => @announcement } |
|
26 | 26 | end |
|
27 | 27 | end |
|
28 | 28 | |
|
29 | 29 | # GET /announcements/new |
|
30 | 30 | # GET /announcements/new.xml |
|
31 | 31 | def new |
|
32 | 32 | @announcement = Announcement.new |
|
33 | 33 | |
|
34 | 34 | respond_to do |format| |
|
35 | 35 | format.html # new.html.erb |
|
36 | 36 | format.xml { render :xml => @announcement } |
|
37 | 37 | end |
|
38 | 38 | end |
|
39 | 39 | |
|
40 | 40 | # GET /announcements/1/edit |
|
41 | 41 | def edit |
|
42 | 42 | @announcement = Announcement.find(params[:id]) |
|
43 | 43 | end |
|
44 | 44 | |
|
45 | 45 | # POST /announcements |
|
46 | 46 | # POST /announcements.xml |
|
47 | 47 | def create |
|
48 | 48 | @announcement = Announcement.new(announcement_params) |
|
49 | 49 | |
|
50 | 50 | respond_to do |format| |
|
51 | 51 | if @announcement.save |
|
52 | 52 | flash[:notice] = 'Announcement was successfully created.' |
|
53 | 53 | format.html { redirect_to(@announcement) } |
|
54 | 54 | format.xml { render :xml => @announcement, :status => :created, :location => @announcement } |
|
55 | 55 | else |
|
56 | 56 | format.html { render :action => "new" } |
|
57 | 57 | format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity } |
|
58 | 58 | end |
|
59 | 59 | end |
|
60 | 60 | end |
|
61 | 61 | |
|
62 | 62 | # PUT /announcements/1 |
|
63 | 63 | # PUT /announcements/1.xml |
|
64 | 64 | def update |
|
65 | 65 | @announcement = Announcement.find(params[:id]) |
|
66 | 66 | |
|
67 | 67 | respond_to do |format| |
|
68 |
- if @announcement.update |
|
|
68 | + if @announcement.update(announcement_params) | |
|
69 | 69 | flash[:notice] = 'Announcement was successfully updated.' |
|
70 | 70 | format.html { redirect_to(@announcement) } |
|
71 | 71 | format.js {} |
|
72 | 72 | format.xml { head :ok } |
|
73 | 73 | else |
|
74 | 74 | format.html { render :action => "edit" } |
|
75 | 75 | format.js {} |
|
76 | 76 | format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity } |
|
77 | 77 | end |
|
78 | 78 | end |
|
79 | 79 | end |
|
80 | 80 | |
|
81 | 81 | def toggle |
|
82 | 82 | @announcement = Announcement.find(params[:id]) |
|
83 |
- @announcement.update |
|
|
83 | + @announcement.update( published: !@announcement.published? ) | |
|
84 | 84 | respond_to do |format| |
|
85 | 85 | format.js { render partial: 'toggle_button', |
|
86 | 86 | locals: {button_id: "#announcement_toggle_#{@announcement.id}",button_on: @announcement.published? } } |
|
87 | 87 | end |
|
88 | 88 | end |
|
89 | 89 | |
|
90 | 90 | def toggle_front |
|
91 | 91 | @announcement = Announcement.find(params[:id]) |
|
92 | 92 | @announcement.update_attributes( frontpage: !@announcement.frontpage? ) |
|
93 | 93 | respond_to do |format| |
|
94 | 94 | format.js { render partial: 'toggle_button', |
|
95 | 95 | locals: {button_id: "#announcement_toggle_front_#{@announcement.id}",button_on: @announcement.frontpage? } } |
|
96 | 96 | end |
|
97 | 97 | end |
|
98 | 98 | |
|
99 | 99 | # DELETE /announcements/1 |
|
100 | 100 | # DELETE /announcements/1.xml |
|
101 | 101 | def destroy |
|
102 | 102 | @announcement = Announcement.find(params[:id]) |
|
103 | 103 | @announcement.destroy |
|
104 | 104 | |
|
105 | 105 | respond_to do |format| |
|
106 | 106 | format.html { redirect_to(announcements_url) } |
|
107 | 107 | format.xml { head :ok } |
|
108 | 108 | end |
|
109 | 109 | end |
|
110 | 110 | |
|
111 | 111 | private |
|
112 | 112 | |
|
113 | 113 | def announcement_params |
|
114 | 114 | params.require(:announcement).permit(:author, :body, :published, :frontpage, :contest_only, :title, :on_nav_bar) |
|
115 | 115 | end |
|
116 | 116 | end |
@@ -25,58 +25,63 | |||
|
25 | 25 | - elsif GraderConfiguration.time_limit_mode? |
|
26 | 26 | - if @current_user.contest_finished? |
|
27 | 27 | %div.navbar-btn.btn.btn-danger#countdown= "Contest is over" |
|
28 | 28 | - elsif !@current_user.contest_started? |
|
29 | 29 | %div.navbar-btn.btn.btn-primary#countdown= (t 'title_bar.contest_not_started') |
|
30 | 30 | - else |
|
31 | 31 | %div.navbar-btn.btn.btn-primary#countdown asdf |
|
32 | 32 | :javascript |
|
33 | 33 | $("#countdown").countdown({until: "+#{@current_user.contest_time_left.to_i}s", layout: 'Time left: {hnn}:{mnn}:{snn}'}); |
|
34 | 34 | / admin section |
|
35 | 35 | - if (@current_user!=nil) and (session[:admin]) |
|
36 | 36 | / management |
|
37 | 37 | %li.nav-item.dropdown |
|
38 | 38 | %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"} |
|
39 | 39 | Manage |
|
40 | 40 | %ul.dropdown-menu |
|
41 | 41 | %li= link_to 'Announcements', announcements_path, class: 'dropdown-item' |
|
42 | 42 | %li= link_to 'Problems', problems_path, class: 'dropdown-item' |
|
43 | 43 | %li= link_to 'Tags', tags_path, class: 'dropdown-item' |
|
44 | 44 | %li= link_to 'Users', user_admin_index_path, class: 'dropdown-item' |
|
45 | 45 | %li= link_to 'User Groups', groups_path, class: 'dropdown-item' |
|
46 | 46 | %li= link_to 'Graders', graders_list_path, class: 'dropdown-item' |
|
47 | 47 | %li= link_to 'Message ', console_messages_path, class: 'dropdown-item' |
|
48 | 48 | %li |
|
49 | 49 | %hr.dropdown-divider |
|
50 | 50 | %li= link_to 'System config', grader_configuration_index_path, class: 'dropdown-item' |
|
51 | 51 | %li |
|
52 | 52 | %hr.dropdown-divider |
|
53 | 53 | %li= link_to 'Sites', sites_path, class: 'dropdown-item' |
|
54 | 54 | %li= link_to 'Contests', contest_management_index_path, class: 'dropdown-item' |
|
55 | 55 | -# |
|
56 | 56 | / report |
|
57 | 57 | %li.nav-item.dropdown |
|
58 | 58 | %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"} |
|
59 | 59 | Report |
|
60 | 60 | %ul.dropdown-menu |
|
61 | 61 | %li= link_to 'Current Score', current_score_report_path, class: 'dropdown-item' |
|
62 | 62 | %li= link_to 'Score Report', max_score_report_path, class: 'dropdown-item' |
|
63 | 63 | %li= link_to 'Submission Report', submission_report_path, class: 'dropdown-item' |
|
64 | 64 | %li= link_to 'Login Report', login_report_path, class: 'dropdown-item' |
|
65 | 65 | - if (ungraded = Submission.where('graded_at is null').where('submitted_at < ?', 1.minutes.ago).count) > 0 |
|
66 | 66 | =link_to "#{ungraded} backlogs!", |
|
67 | 67 | graders_list_path, |
|
68 | 68 | class: 'navbar-btn btn btn-default btn-warning', data: {toggle: 'tooltip'},title: 'Number of ungraded submission' |
|
69 | 69 | / announcement |
|
70 | 70 | - @nav_announcement.each do |ann| |
|
71 | 71 | %p.navbar-text |
|
72 | 72 | = ann.body.html_safe |
|
73 | - | |
|
74 | - | |
|
75 | - | |
|
76 | - %ul.nav.navbar-nav.navbar-right | |
|
77 | - = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-question-sign')}".html_safe, 'main', 'help') | |
|
78 | - = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-comment')}".html_safe, 'messages', 'index', {title: I18n.t('menu.messages'), data: {toggle: 'tooltip'}}) | |
|
79 | - - if GraderConfiguration['system.user_setting_enabled'] | |
|
80 | - = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-cog', id: 'user_profile')}".html_safe, 'users', 'profile', {title: I18n.t('menu.settings'), data: {toggle: 'tooltip'}}) | |
|
81 | - = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-log-out')} #{@current_user.full_name}".html_safe, 'main', 'login', {title: I18n.t('menu.log_out'), data: {toggle: 'tooltip'}}) | |
|
82 | - | |
|
73 | + %ul.navbar-nav | |
|
74 | + %li.nav-item | |
|
75 | + %a.nav-link{href: help_main_path} | |
|
76 | + %span.mi.md-18 help | |
|
77 | + %li.nav-item | |
|
78 | + %a.nav-link{href: messages_path} | |
|
79 | + %span.mi.md-18 chat | |
|
80 | + - if GraderConfiguration['system.user_setting_enabled'] | |
|
81 | + %li.nav-item | |
|
82 | + %a.nav-link{href: profile_users_path} | |
|
83 | + %span.mi.md-18 settings | |
|
84 | + %li.nav-item | |
|
85 | + %a.nav-link{href: login_main_path} | |
|
86 | + %span.mi.md-18 exit_to_app | |
|
87 | + = @current_user.full_name |
@@ -1,15 +1,26 | |||
|
1 | - %li.list-group-item | |
|
2 | - %strong | |
|
1 | + .card-body | |
|
2 | + .card-title | |
|
3 | 3 | = announcement.title |
|
4 | - - if @current_user and @current_user.admin? | |
|
5 | - = link_to 'Edit', edit_announcement_path(announcement), class: 'btn btn-xs btn-default' | |
|
6 | - %small= "(updated #{time_ago_in_words(announcement.updated_at)} ago on #{announcement.updated_at})" | |
|
4 | + - if @current_user and @current_user.admin? | |
|
5 | + = link_to 'Edit', edit_announcement_path(announcement), class: 'btn btn-xs btn-default' | |
|
6 | + .card-subtitle | |
|
7 | + = "(updated #{time_ago_in_words(announcement.updated_at)} ago on #{announcement.updated_at})" | |
|
8 | + .card-text | |
|
9 | + = markdown(announcement.body) | |
|
10 | + | |
|
7 | 11 | |
|
8 | - %br | |
|
9 | - = markdown(announcement.body) | |
|
10 | - :javascript | |
|
11 | - Announcement.updateRecentId(#{announcement.id}); | |
|
12 | - - if (defined? announcement_effect) and announcement_effect | |
|
12 | + -# | |
|
13 | + %li.list-group-item | |
|
14 | + %strong | |
|
15 | + - if @current_user and @current_user.admin? | |
|
16 | + = link_to 'Edit', edit_announcement_path(announcement), class: 'btn btn-xs btn-default' | |
|
17 | + %small= "(updated #{time_ago_in_words(announcement.updated_at)} ago on #{announcement.updated_at})" | |
|
18 | + | |
|
19 | + %br | |
|
20 | + = markdown(announcement.body) | |
|
13 | 21 | :javascript |
|
14 | - $("announcement-#{announcement.id}").blindDown({duration: 0.2}); | |
|
15 | - $("announcement-#{announcement.id}").appear({duration: 0.5, queue: 'end'}); | |
|
22 | + Announcement.updateRecentId(#{announcement.id}); | |
|
23 | + - if (defined? announcement_effect) and announcement_effect | |
|
24 | + :javascript | |
|
25 | + $("announcement-#{announcement.id}").blindDown({duration: 0.2}); | |
|
26 | + $("announcement-#{announcement.id}").appear({duration: 0.5, queue: 'end'}); |
@@ -1,68 +1,68 | |||
|
1 | 1 | - content_for :head do |
|
2 | 2 | = javascript_include_tag "announcement_refresh" |
|
3 | 3 | |
|
4 | 4 | = user_title_bar(@user) |
|
5 | 5 | - if @user.section |
|
6 | 6 | passcode for CP Unofficial Logo voting is |
|
7 | 7 | %strong= @user.section |
|
8 | 8 | %br |
|
9 | 9 | |
|
10 | 10 | - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true) |
|
11 | 11 | %p=t 'main.start_soon' |
|
12 | 12 | |
|
13 | 13 | .row |
|
14 | 14 | .col-md-7 |
|
15 | 15 | - if GraderConfiguration.show_submitbox_to?(@user) |
|
16 | 16 | .panel.panel-primary |
|
17 | 17 | .panel-heading |
|
18 | 18 | Submission |
|
19 | 19 | .panel-body |
|
20 | 20 | = render :partial => 'submission_box' |
|
21 | 21 | - if GraderConfiguration.show_tasks_to?(@user) |
|
22 | 22 | - if not GraderConfiguration.multicontests? |
|
23 | 23 | %table.table.table-striped.table-condensed |
|
24 | 24 | %thead |
|
25 | 25 | %tr |
|
26 | 26 | %th Task name |
|
27 | 27 | %th Full name |
|
28 | 28 | %th # of sub(s) |
|
29 | 29 | %th Results |
|
30 | 30 | %th |
|
31 | 31 | %tbody |
|
32 | 32 | = render :partial => 'problem', :collection => @problems |
|
33 | 33 | - else |
|
34 | 34 | - @contest_problems.each do |cp| |
|
35 | 35 | - if cp[:problems].length > 0 |
|
36 | 36 | %h2{:class =>'contest-title'} |
|
37 | 37 | = "#{cp[:contest] ? cp[:contest].title : 'Public problems'}" |
|
38 | 38 | %table.info |
|
39 | 39 | %tr.info-head |
|
40 | 40 | %th Task name |
|
41 | 41 | %th Full name |
|
42 | 42 | %th # of sub(s) |
|
43 | 43 | %th Results |
|
44 | 44 | %th |
|
45 | 45 | = render :partial => 'problem', :collection => cp[:problems] |
|
46 | 46 | .col-md-5 |
|
47 | - .panel.panel-info | |
|
48 |
- . |
|
|
47 | + .card | |
|
48 | + .card-header | |
|
49 | 49 | Announcement |
|
50 |
- = link_to 'Manage', announcements_path, class: 'btn btn- |
|
|
51 | - %ul.list-group | |
|
50 | + = link_to 'Manage', announcements_path, class: 'btn btn-small' | |
|
51 | + .card-body | |
|
52 | 52 | = render :partial => 'announcement', :collection => @announcements |
|
53 | 53 | |
|
54 | 54 | %script{:type => 'text/javascript'} |
|
55 | 55 | = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';" |
|
56 | 56 | Announcement.registerRefreshEventTimer(); |
|
57 | 57 | |
|
58 | 58 | .modal.fade#compiler{tabindex: -1,role: 'dialog'} |
|
59 | 59 | .modal-dialog.modal-lg{role:'document'} |
|
60 | 60 | .modal-content |
|
61 | 61 | .modal-header |
|
62 | 62 | %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}} |
|
63 | 63 | %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} × |
|
64 | 64 | %h4 Compiler message |
|
65 | 65 | .modal-body |
|
66 | 66 | %pre#compiler_msg |
|
67 | 67 | .modal-footer |
|
68 | 68 | %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close |
You need to be logged in to leave comments.
Login now