Description:
use jquery by default
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r554:50143f71e61a - - 12 files changed: 95 inserted, 50 deleted
@@ -0,0 +1,35 | |||
|
1 | + %header.navbar.navbar-default.navbar-fixed-top | |
|
2 | + %nav | |
|
3 | + .container-fluid | |
|
4 | + .navbar-header | |
|
5 | + %a.navbar-brand{href: main_list_path} หน้าหลัก | |
|
6 | + .collapse.navbar-collapse | |
|
7 | + %ul.nav.navbar-nav | |
|
8 | + - if (@current_user!=nil) and (GraderConfiguration.show_tasks_to?(@current_user)) | |
|
9 | + = add_menu("#{I18n.t 'menu.tasks'}", 'tasks', 'list') | |
|
10 | + = add_menu("#{I18n.t 'menu.submissions'}", 'main', 'submission') | |
|
11 | + = add_menu("#{I18n.t 'menu.test'}", 'test', 'index') | |
|
12 | + - if GraderConfiguration['right.user_hall_of_fame'] | |
|
13 | + = add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof') | |
|
14 | + %ul.nav.navbar-nav.navbar-right | |
|
15 | + = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-question-sign')}".html_safe, 'main', 'help') | |
|
16 | + = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-comment')}".html_safe, 'messages', 'list', {title: I18n.t('menu.messages'), data: {toggle: 'tooltip'}}) | |
|
17 | + - if GraderConfiguration['system.user_setting_enabled'] | |
|
18 | + = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-cog')}".html_safe, 'users', 'index', {title: I18n.t('menu.settings'), data: {toggle: 'tooltip'}}) | |
|
19 | + = 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'}}) | |
|
20 | + | |
|
21 | + - if (@current_user!=nil) and (session[:admin]) | |
|
22 | + %nav.navbar.navbar-default.navbar-fixed-top.navbar-inverse.secondnavbar | |
|
23 | + .container-fluid | |
|
24 | + .collapse.navbar-collapse | |
|
25 | + %ul.nav.navbar-nav | |
|
26 | + = add_menu( '[Announcements]', 'announcements', 'index') | |
|
27 | + = add_menu( '[Msg console]', 'messages', 'console') | |
|
28 | + = add_menu( '[Problems]', 'problems', 'index') | |
|
29 | + = add_menu( '[Users]', 'user_admin', 'index') | |
|
30 | + = add_menu( '[Results]', 'user_admin', 'user_stat') | |
|
31 | + = add_menu( '[Report]', 'report', 'multiple_login') | |
|
32 | + = add_menu( '[Graders]', 'graders', 'list') | |
|
33 | + = add_menu( '[Contests]', 'contest_management', 'index') | |
|
34 | + = add_menu( '[Sites]', 'sites', 'index') | |
|
35 | + = add_menu( '[System config]', 'configurations', 'index') |
@@ -0,0 +1,6 | |||
|
1 | + = form_tag({:action => 'submit'}, :multipart => true) do | |
|
2 | + %b Problem: | |
|
3 | + = select 'submission', 'problem_id', [[(t 'main.specified_in_header'),'-1']] + @problems.collect {|p| [p.full_name, p.id]}, {:selected => '-1'}, { class: 'select2' } | |
|
4 | + %b File: | |
|
5 | + = file_field_tag 'file' | |
|
6 | + = submit_tag 'Submit' |
@@ -1,52 +1,54 | |||
|
1 | 1 | source 'https://rubygems.org' |
|
2 | 2 | |
|
3 | 3 | gem 'rails', '3.2.21' |
|
4 | 4 | |
|
5 | + gem 'select2-rails' | |
|
6 | + | |
|
5 | 7 | # Bundle edge Rails instead: |
|
6 | 8 | # gem 'rails', :git => 'git://github.com/rails/rails.git' |
|
7 | 9 | |
|
8 | 10 | gem 'mysql2' |
|
9 | 11 | |
|
10 | 12 | # Gems used only for assets and not required |
|
11 | 13 | # in production environments by default. |
|
12 | 14 | group :assets do |
|
13 | 15 | gem 'sass-rails', '~> 3.2.6' |
|
14 | 16 | gem 'coffee-rails', '~> 3.2.2' |
|
15 | 17 | |
|
16 | 18 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes |
|
17 | 19 | # gem 'therubyracer', :platforms => :ruby |
|
18 | 20 | |
|
19 | 21 | gem 'uglifier' |
|
20 | 22 | end |
|
21 | 23 | |
|
22 | 24 | gem 'prototype-rails' |
|
23 | 25 | |
|
24 | 26 | # To use ActiveModel has_secure_password |
|
25 | 27 | # gem 'bcrypt-ruby', '~> 3.0.0' |
|
26 | 28 | |
|
27 | 29 | # To use Jbuilder templates for JSON |
|
28 | 30 | # gem 'jbuilder' |
|
29 | 31 | |
|
30 | 32 | # Use unicorn as the app server |
|
31 | 33 | # gem 'unicorn' |
|
32 | 34 | |
|
33 | 35 | # Deploy with Capistrano |
|
34 | 36 | # gem 'capistrano' |
|
35 | 37 | |
|
36 | 38 | # To use debugger |
|
37 | 39 | # gem 'debugger' |
|
38 | 40 | # |
|
39 | 41 | |
|
40 | 42 | #in-place editor |
|
41 | 43 | gem 'best_in_place', '~> 3.0.1' |
|
42 | 44 | |
|
43 | 45 | # jquery addition |
|
44 | 46 | gem 'jquery-rails' |
|
45 | 47 | gem 'jquery-ui-sass-rails' |
|
46 | 48 | gem 'jquery-timepicker-addon-rails' |
|
47 | 49 | gem 'jquery-tablesorter' |
|
48 | 50 | |
|
49 | 51 | #syntax highlighter |
|
50 | 52 | gem 'rouge' |
|
51 | 53 | |
|
52 | 54 | #add bootstrap |
@@ -90,93 +90,96 | |||
|
90 | 90 | rails (~> 3.2) |
|
91 | 91 | rack (1.4.5) |
|
92 | 92 | rack-cache (1.2) |
|
93 | 93 | rack (>= 0.4) |
|
94 | 94 | rack-ssl (1.3.4) |
|
95 | 95 | rack |
|
96 | 96 | rack-test (0.6.3) |
|
97 | 97 | rack (>= 1.0) |
|
98 | 98 | rails (3.2.21) |
|
99 | 99 | actionmailer (= 3.2.21) |
|
100 | 100 | actionpack (= 3.2.21) |
|
101 | 101 | activerecord (= 3.2.21) |
|
102 | 102 | activeresource (= 3.2.21) |
|
103 | 103 | activesupport (= 3.2.21) |
|
104 | 104 | bundler (~> 1.0) |
|
105 | 105 | railties (= 3.2.21) |
|
106 | 106 | railties (3.2.21) |
|
107 | 107 | actionpack (= 3.2.21) |
|
108 | 108 | activesupport (= 3.2.21) |
|
109 | 109 | rack-ssl (~> 1.3.2) |
|
110 | 110 | rake (>= 0.8.7) |
|
111 | 111 | rdoc (~> 3.4) |
|
112 | 112 | thor (>= 0.14.6, < 2.0) |
|
113 | 113 | rake (10.4.2) |
|
114 | 114 | rdiscount (2.1.8) |
|
115 | 115 | rdoc (3.12.2) |
|
116 | 116 | json (~> 1.4) |
|
117 | 117 | rouge (1.8.0) |
|
118 | 118 | rspec-collection_matchers (1.1.2) |
|
119 | 119 | rspec-expectations (>= 2.99.0.beta1) |
|
120 | 120 | rspec-core (2.99.2) |
|
121 | 121 | rspec-expectations (2.99.2) |
|
122 | 122 | diff-lcs (>= 1.1.3, < 2.0) |
|
123 | 123 | rspec-mocks (2.99.3) |
|
124 | 124 | rspec-rails (2.99.0) |
|
125 | 125 | actionpack (>= 3.0) |
|
126 | 126 | activemodel (>= 3.0) |
|
127 | 127 | activesupport (>= 3.0) |
|
128 | 128 | railties (>= 3.0) |
|
129 | 129 | rspec-collection_matchers |
|
130 | 130 | rspec-core (~> 2.99.0) |
|
131 | 131 | rspec-expectations (~> 2.99.0) |
|
132 | 132 | rspec-mocks (~> 2.99.0) |
|
133 | 133 | sass (3.4.11) |
|
134 | 134 | sass-rails (3.2.6) |
|
135 | 135 | railties (~> 3.2.0) |
|
136 | 136 | sass (>= 3.1.10) |
|
137 | 137 | tilt (~> 1.3) |
|
138 | + select2-rails (4.0.1) | |
|
139 | + thor (~> 0.14) | |
|
138 | 140 | sprockets (2.2.3) |
|
139 | 141 | hike (~> 1.2) |
|
140 | 142 | multi_json (~> 1.0) |
|
141 | 143 | rack (~> 1.0) |
|
142 | 144 | tilt (~> 1.1, != 1.3.0) |
|
143 | 145 | test-unit (3.0.9) |
|
144 | 146 | power_assert |
|
145 | 147 | thor (0.19.1) |
|
146 | 148 | tilt (1.4.1) |
|
147 | 149 | treetop (1.4.15) |
|
148 | 150 | polyglot |
|
149 | 151 | polyglot (>= 0.3.1) |
|
150 | 152 | tzinfo (0.3.43) |
|
151 | 153 | uglifier (2.7.0) |
|
152 | 154 | execjs (>= 0.3.0) |
|
153 | 155 | json (>= 1.8.0) |
|
154 | 156 | will_paginate (3.0.7) |
|
155 | 157 | |
|
156 | 158 | PLATFORMS |
|
157 | 159 | ruby |
|
158 | 160 | |
|
159 | 161 | DEPENDENCIES |
|
160 | 162 | autoprefixer-rails |
|
161 | 163 | best_in_place (~> 3.0.1) |
|
162 | 164 | bootstrap-sass (~> 3.2.0) |
|
163 | 165 | coffee-rails (~> 3.2.2) |
|
164 | 166 | dynamic_form |
|
165 | 167 | haml |
|
166 | 168 | in_place_editing |
|
167 | 169 | jquery-rails |
|
168 | 170 | jquery-tablesorter |
|
169 | 171 | jquery-timepicker-addon-rails |
|
170 | 172 | jquery-ui-sass-rails |
|
171 | 173 | |
|
172 | 174 | mysql2 |
|
173 | 175 | prototype-rails |
|
174 | 176 | rails (= 3.2.21) |
|
175 | 177 | rdiscount |
|
176 | 178 | rouge |
|
177 | 179 | rspec-rails (~> 2.99.0) |
|
178 | 180 | sass-rails (~> 3.2.6) |
|
181 | + select2-rails | |
|
179 | 182 | test-unit |
|
180 | 183 | uglifier |
|
181 | 184 | verification! |
|
182 | 185 | will_paginate (~> 3.0.7) |
@@ -1,18 +1,26 | |||
|
1 | 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files |
|
2 | 2 | // listed below. |
|
3 | 3 | // |
|
4 | 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, |
|
5 | 5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. |
|
6 | 6 | // |
|
7 | 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the |
|
8 | 8 | // the compiled file. |
|
9 | 9 | // |
|
10 | 10 | // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD |
|
11 | 11 | // GO AFTER THE REQUIRES BELOW. |
|
12 | 12 | // |
|
13 |
- //= require |
|
|
14 |
- //= require |
|
|
15 | - //= require effects | |
|
16 | - //= require dragdrop | |
|
17 | - //= require controls | |
|
13 | + //= require jquery | |
|
14 | + //= require jquery_ujs | |
|
15 | + //= require jquery.ui.all | |
|
18 | 16 | //= require bootstrap-sprockets |
|
17 | + //= require custom | |
|
18 | + //= require select2 | |
|
19 | + | |
|
20 | + | |
|
21 | + // since this is after blank line, it is not downloaded | |
|
22 | + //x= require prototype | |
|
23 | + //x= require prototype_ujs | |
|
24 | + //x= require effects | |
|
25 | + //x= require dragdrop | |
|
26 | + //x= require controls |
@@ -1,84 +1,87 | |||
|
1 | 1 | /* |
|
2 | 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files |
|
3 | 3 | * listed below. |
|
4 | 4 | * |
|
5 | 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, |
|
6 | 6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. |
|
7 | 7 | * |
|
8 | 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the |
|
9 | 9 | * compiled file so the styles you add here take precedence over styles defined in any styles |
|
10 | 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new |
|
11 | 11 | * file per style scope. |
|
12 | 12 | * |
|
13 | - *= require_tree . | |
|
14 |
- *= require_ |
|
|
13 | + // bootstrap says that we should not do this, but @import each file instead | |
|
14 | + # *= require_tree . | |
|
15 | + # *= require_self | |
|
15 | 16 | */ |
|
16 | 17 | |
|
17 | - | |
|
18 | + @import jquery.ui.all | |
|
19 | + @import jquery.ui.core | |
|
18 | 20 | @import jquery.ui.core |
|
19 | 21 | @import jquery.ui.theme |
|
20 | 22 | @import jquery.ui.datepicker |
|
21 | 23 | @import jquery.ui.slider |
|
22 | 24 | @import jquery-ui-timepicker-addon |
|
23 | 25 | @import jquery-tablesorter/theme.metro-dark |
|
24 | 26 | @import tablesorter-theme.cafe |
|
25 | 27 | |
|
26 | - | |
|
27 |
- @import |
|
|
28 | - @import "bootstrap" | |
|
28 | + @import bootstrap-sprockets | |
|
29 | + @import bootstrap | |
|
30 | + @import select2 | |
|
31 | + @import select2-bootstrap | |
|
29 | 32 | |
|
30 | 33 | .secondnavbar |
|
31 | 34 | top: 50px |
|
32 | 35 | |
|
33 | 36 | body |
|
34 | 37 | background: white image-url("topbg.jpg") repeat-x top center |
|
35 |
- |
|
|
36 |
- |
|
|
38 | + //font-size: 13px | |
|
39 | + //font-family: Tahoma, "sans-serif" | |
|
37 | 40 | margin: 10px |
|
38 | 41 | padding: 10px |
|
39 | 42 | padding-top: 100px |
|
40 | 43 | |
|
41 | 44 | |
|
42 | 45 | input |
|
43 | 46 | font-family: Tahoma, "sans-serif" |
|
44 | 47 | |
|
45 | 48 | |
|
46 | 49 | h1 |
|
47 | 50 | font-size: 24px |
|
48 | 51 | color: #334488 |
|
49 | 52 | line-height: 2em |
|
50 | 53 | |
|
51 | 54 | |
|
52 | 55 | h2 |
|
53 | 56 | font-size: 18px |
|
54 | 57 | color: #5566bb |
|
55 | 58 | line-height: 1.5em |
|
56 | 59 | |
|
57 | 60 | |
|
58 | 61 | hr |
|
59 | 62 | border-top: 1px solid #dddddd |
|
60 | 63 | border-bottom: 1px solid #eeeeee |
|
61 | 64 | |
|
62 | 65 | |
|
63 | 66 | a |
|
64 | 67 | color: #6666cc |
|
65 | 68 | text-decoration: none |
|
66 | 69 | |
|
67 | 70 | &:link, &:visited |
|
68 | 71 | color: #6666cc |
|
69 | 72 | text-decoration: none |
|
70 | 73 | |
|
71 | 74 | &:hover, &:focus |
|
72 | 75 | color: #111166 |
|
73 | 76 | text-decoration: none |
|
74 | 77 | |
|
75 | 78 | |
|
76 | 79 | div |
|
77 | 80 | &.userbar |
|
78 | 81 | line-height: 1.5em |
|
79 | 82 | text-align: right |
|
80 | 83 | font-size: 12px |
|
81 | 84 | |
|
82 | 85 | &.title |
|
83 | 86 | padding: 10px 0px |
|
84 | 87 | line-height: 1.5em |
@@ -1,54 +1,61 | |||
|
1 | 1 | class ApplicationController < ActionController::Base |
|
2 | 2 | protect_from_forgery |
|
3 | 3 | |
|
4 | + before_filter :current_user | |
|
5 | + | |
|
4 | 6 | SINGLE_USER_MODE_CONF_KEY = 'system.single_user_mode' |
|
5 | 7 | MULTIPLE_IP_LOGIN_CONF_KEY = 'right.multiple_ip_login' |
|
6 | 8 | |
|
9 | + # Returns the current logged-in user (if any). | |
|
10 | + def current_user | |
|
11 | + @current_user ||= User.find(session[:user_id]) | |
|
12 | + end | |
|
13 | + | |
|
7 | 14 | def admin_authorization |
|
8 | 15 | return false unless authenticate |
|
9 | 16 | user = User.find(session[:user_id], :include => ['roles']) |
|
10 | 17 | unless user.admin? |
|
11 | 18 | flash[:notice] = 'You are not authorized to view the page you requested' |
|
12 | 19 | redirect_to :controller => 'main', :action => 'login' unless user.admin? |
|
13 | 20 | return false |
|
14 | 21 | end |
|
15 | 22 | return true |
|
16 | 23 | end |
|
17 | 24 | |
|
18 | 25 | def authorization_by_roles(allowed_roles) |
|
19 | 26 | return false unless authenticate |
|
20 | 27 | user = User.find(session[:user_id]) |
|
21 | 28 | unless user.roles.detect { |role| allowed_roles.member?(role.name) } |
|
22 | 29 | flash[:notice] = 'You are not authorized to view the page you requested' |
|
23 | 30 | redirect_to :controller => 'main', :action => 'login' |
|
24 | 31 | return false |
|
25 | 32 | end |
|
26 | 33 | end |
|
27 | 34 | |
|
28 | 35 | protected |
|
29 | 36 | |
|
30 | 37 | def authenticate |
|
31 | 38 | unless session[:user_id] |
|
32 | 39 | flash[:notice] = 'You need to login' |
|
33 | 40 | if GraderConfiguration[SINGLE_USER_MODE_CONF_KEY] |
|
34 | 41 | flash[:notice] = 'You need to login but you cannot log in at this time' |
|
35 | 42 | end |
|
36 | 43 | redirect_to :controller => 'main', :action => 'login' |
|
37 | 44 | return false |
|
38 | 45 | end |
|
39 | 46 | |
|
40 | 47 | # check if run in single user mode |
|
41 | 48 | if GraderConfiguration[SINGLE_USER_MODE_CONF_KEY] |
|
42 | 49 | user = User.find(session[:user_id]) |
|
43 | 50 | if user==nil or (not user.admin?) |
|
44 | 51 | flash[:notice] = 'You cannot log in at this time' |
|
45 | 52 | redirect_to :controller => 'main', :action => 'login' |
|
46 | 53 | return false |
|
47 | 54 | end |
|
48 | 55 | return true |
|
49 | 56 | end |
|
50 | 57 | |
|
51 | 58 | if GraderConfiguration.multicontests? |
|
52 | 59 | user = User.find(session[:user_id]) |
|
53 | 60 | return true if user.admin? |
|
54 | 61 | begin |
@@ -1,73 +1,73 | |||
|
1 | 1 | # Methods added to this helper will be available to all templates in the application. |
|
2 | 2 | module ApplicationHelper |
|
3 | 3 | |
|
4 | 4 | def navbar_user_header |
|
5 | 5 | left_menu = '' |
|
6 | 6 | right_menu = '' |
|
7 | 7 | user = User.find(session[:user_id]) |
|
8 | 8 | |
|
9 | 9 | if (user!=nil) and (GraderConfiguration.show_tasks_to?(user)) |
|
10 | 10 | left_menu << add_menu("#{I18n.t 'menu.tasks'}", 'tasks', 'list') |
|
11 | 11 | left_menu << add_menu("#{I18n.t 'menu.submissions'}", 'main', 'submission') |
|
12 | 12 | left_menu << add_menu("#{I18n.t 'menu.test'}", 'test', 'index') |
|
13 | 13 | end |
|
14 | 14 | |
|
15 | 15 | if GraderConfiguration['right.user_hall_of_fame'] |
|
16 | 16 | left_menu << add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof') |
|
17 | 17 | end |
|
18 | - left_menu << add_menu("#{I18n.t 'menu.help'}", 'main', 'help') | |
|
19 | - | |
|
20 | 18 | |
|
21 |
- right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon- |
|
|
19 | + right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-question-sign')}".html_safe, 'main', 'help') | |
|
20 | + right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-comment')}".html_safe, 'messages', 'list', {title: I18n.t('menu.messages'), data: {toggle: 'tooltip'}}) | |
|
22 | 21 | if GraderConfiguration['system.user_setting_enabled'] |
|
23 |
- right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-cog')} |
|
|
22 | + right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-cog')}".html_safe, 'users', 'index', {title: I18n.t('menu.settings'), data: {toggle: 'tooltip'}}) | |
|
24 | 23 | end |
|
25 |
- right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-log-out')} #{ |
|
|
24 | + right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-log-out')} #{user.full_name}".html_safe, 'main', 'login', {title: I18n.t('menu.log_out'), data: {toggle: 'tooltip'}}) | |
|
25 | + | |
|
26 | 26 | |
|
27 | 27 | result = content_tag(:ul,left_menu.html_safe,class: 'nav navbar-nav') + content_tag(:ul,right_menu.html_safe,class: 'nav navbar-nav navbar-right') |
|
28 | 28 | end |
|
29 | 29 | |
|
30 | 30 | def add_menu(title, controller, action,html_option = {}) |
|
31 | 31 | link_option = {controller: controller, action: action} |
|
32 | 32 | html_option[:class] = (html_option[:class] || '') + " active" if current_page?(link_option) |
|
33 | 33 | content_tag(:li, link_to(title,link_option),html_option) |
|
34 | 34 | end |
|
35 | 35 | |
|
36 | 36 | def user_header |
|
37 | 37 | menu_items = '' |
|
38 | 38 | user = User.find(session[:user_id]) |
|
39 | 39 | |
|
40 | 40 | if (user!=nil) and (session[:admin]) |
|
41 | 41 | # admin menu |
|
42 | 42 | menu_items << "<b>Administrative task:</b> " |
|
43 | 43 | append_to menu_items, '[Announcements]', 'announcements', 'index' |
|
44 | 44 | append_to menu_items, '[Msg console]', 'messages', 'console' |
|
45 | 45 | append_to menu_items, '[Problems]', 'problems', 'index' |
|
46 | 46 | append_to menu_items, '[Users]', 'user_admin', 'index' |
|
47 | 47 | append_to menu_items, '[Results]', 'user_admin', 'user_stat' |
|
48 | 48 | append_to menu_items, '[Report]', 'report', 'multiple_login' |
|
49 | 49 | append_to menu_items, '[Graders]', 'graders', 'list' |
|
50 | 50 | append_to menu_items, '[Contests]', 'contest_management', 'index' |
|
51 | 51 | append_to menu_items, '[Sites]', 'sites', 'index' |
|
52 | 52 | append_to menu_items, '[System config]', 'configurations', 'index' |
|
53 | 53 | menu_items << "<br/>" |
|
54 | 54 | end |
|
55 | 55 | |
|
56 | 56 | # main page |
|
57 | 57 | append_to menu_items, "[#{I18n.t 'menu.main'}]", 'main', 'list' |
|
58 | 58 | append_to menu_items, "[#{I18n.t 'menu.messages'}]", 'messages', 'list' |
|
59 | 59 | |
|
60 | 60 | if (user!=nil) and (GraderConfiguration.show_tasks_to?(user)) |
|
61 | 61 | append_to menu_items, "[#{I18n.t 'menu.tasks'}]", 'tasks', 'list' |
|
62 | 62 | append_to menu_items, "[#{I18n.t 'menu.submissions'}]", 'main', 'submission' |
|
63 | 63 | append_to menu_items, "[#{I18n.t 'menu.test'}]", 'test', 'index' |
|
64 | 64 | end |
|
65 | 65 | |
|
66 | 66 | if GraderConfiguration['right.user_hall_of_fame'] |
|
67 | 67 | append_to menu_items, "[#{I18n.t 'menu.hall_of_fame'}]", 'report', 'problem_hof' |
|
68 | 68 | end |
|
69 | 69 | append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help' |
|
70 | 70 | |
|
71 | 71 | if GraderConfiguration['system.user_setting_enabled'] |
|
72 | 72 | append_to menu_items, "[#{I18n.t 'menu.settings'}]", 'users', 'index' |
|
73 | 73 | end |
@@ -1,30 +1,15 | |||
|
1 | 1 | <!DOCTYPE html> |
|
2 | 2 | %html |
|
3 | 3 | %head |
|
4 | 4 | %title= GraderConfiguration['contest.name'] |
|
5 | 5 | = stylesheet_link_tag "application", :media => "all" |
|
6 | 6 | = javascript_include_tag "application" |
|
7 | 7 | = csrf_meta_tags |
|
8 | 8 | = content_for :header |
|
9 | 9 | = yield :head |
|
10 | 10 | |
|
11 | 11 | %body |
|
12 | - %nav.navbar.navbar-default.navbar-fixed-top | |
|
13 | - .container-fluid | |
|
14 | - .navbar-header | |
|
15 | - %a.navbar-brand{href: main_list_path} หน้าหลัก | |
|
16 | - .collapse.navbar-collapse | |
|
17 | - = navbar_user_header #call helper function | |
|
18 | - %nav.navbar.navbar-default.navbar-fixed-top.navbar-inverse.secondnavbar | |
|
19 | - .container-fluid | |
|
20 | - .collapse.navbar-collapse | |
|
21 | - %ul.nav.navbar-nav | |
|
22 | - %li | |
|
23 | - %a{href:'#'}hahaha | |
|
24 | - | |
|
25 | - %div.userbar | |
|
26 | - = user_header | |
|
12 | + = render 'layouts/header' | |
|
27 | 13 | |
|
28 | 14 | = content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil |
|
29 | 15 | = yield |
|
30 | - |
@@ -1,53 +1,55 | |||
|
1 | 1 | - content_for :head do |
|
2 | 2 | = javascript_include_tag "announcement_refresh" |
|
3 | 3 | |
|
4 | 4 | = user_title_bar(@user) |
|
5 | 5 | |
|
6 | 6 | .announcementbox{:style => (@announcements.length==0 ? "display:none" : "")} |
|
7 | 7 | %span{:class => 'title'} |
|
8 | 8 | Announcements |
|
9 | 9 | #announcementbox-body |
|
10 | 10 | = render :partial => 'announcement', :collection => @announcements |
|
11 | 11 | |
|
12 | 12 | - if GraderConfiguration.show_submitbox_to?(@user) |
|
13 | 13 | .submitbox |
|
14 | 14 | = error_messages_for 'submission' |
|
15 | 15 | = render :partial => 'submission_box' |
|
16 | 16 | |
|
17 | 17 | |
|
18 | 18 | %hr/ |
|
19 | 19 | |
|
20 | 20 | - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true) |
|
21 | 21 | %p=t 'main.start_soon' |
|
22 | 22 | |
|
23 | 23 | - if GraderConfiguration.show_tasks_to?(@user) |
|
24 | 24 | - if not GraderConfiguration.multicontests? |
|
25 | - %table.info | |
|
26 |
- %t |
|
|
27 | - %th | |
|
28 |
- %th |
|
|
29 |
- %th |
|
|
30 | - %th # of sub(s) | |
|
31 |
- %th |
|
|
32 | - = render :partial => 'problem', :collection => @problems | |
|
25 | + %table.table.table-striped | |
|
26 | + %thead | |
|
27 | + %tr.info-head | |
|
28 | + %th # | |
|
29 | + %th Tasks name | |
|
30 | + %th Full name | |
|
31 | + %th # of sub(s) | |
|
32 | + %th Results | |
|
33 | + %tbody | |
|
34 | + = render :partial => 'problem', :collection => @problems | |
|
33 | 35 | - else |
|
34 | 36 | - @contest_problems.each do |cp| |
|
35 | 37 | - if cp[:problems].length > 0 |
|
36 | 38 | %h2{:class =>'contest-title'} |
|
37 | 39 | = "#{cp[:contest] ? cp[:contest].title : 'Public problems'}" |
|
38 | 40 | %table.info |
|
39 | 41 | %tr.info-head |
|
40 | 42 | %th |
|
41 | 43 | %th Tasks name |
|
42 | 44 | %th Full name |
|
43 | 45 | %th # of sub(s) |
|
44 | 46 | %th Results |
|
45 | 47 | = render :partial => 'problem', :collection => cp[:problems] |
|
46 | 48 | |
|
47 | 49 | |
|
48 | 50 | %hr/ |
|
49 | 51 | |
|
50 | 52 | %script{:type => 'text/javascript'} |
|
51 | 53 | = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';" |
|
52 | 54 | Announcement.registerRefreshEventTimer(); |
|
53 | 55 |
deleted file |
You need to be logged in to leave comments.
Login now