Description:
bootstrap navbar
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r553:d50bf0fc7252 - - 4 files changed: 69 inserted, 54 deleted
@@ -1,306 +1,326 | |||||
|
|
1 | + /* | ||
|
|
2 | + * This is a manifest file that'll be compiled into application.css, which will include all the files | ||
|
|
3 | + * listed below. | ||
|
|
4 | + * | ||
|
|
5 | + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, | ||
|
|
6 | + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. | ||
|
|
7 | + * | ||
|
|
8 | + * You're free to add application-wide styles to this file and they'll appear at the bottom of the | ||
|
|
9 | + * compiled file so the styles you add here take precedence over styles defined in any styles | ||
|
|
10 | + * defined in the other CSS/SCSS files in this directory. It is generally better to create a new | ||
|
|
11 | + * file per style scope. | ||
|
|
12 | + * | ||
|
|
13 | + *= require_tree . | ||
|
|
14 | + *= require_self | ||
|
|
15 | + */ | ||
|
|
16 | + | ||
|
1 |
|
17 | ||
|
2 | @import jquery.ui.core |
|
18 | @import jquery.ui.core |
|
3 | @import jquery.ui.theme |
|
19 | @import jquery.ui.theme |
|
4 | @import jquery.ui.datepicker |
|
20 | @import jquery.ui.datepicker |
|
5 | @import jquery.ui.slider |
|
21 | @import jquery.ui.slider |
|
6 | @import jquery-ui-timepicker-addon |
|
22 | @import jquery-ui-timepicker-addon |
|
7 | @import jquery-tablesorter/theme.metro-dark |
|
23 | @import jquery-tablesorter/theme.metro-dark |
|
8 | @import tablesorter-theme.cafe |
|
24 | @import tablesorter-theme.cafe |
|
9 |
|
25 | ||
|
10 |
|
26 | ||
|
11 | @import "bootstrap-sprockets" |
|
27 | @import "bootstrap-sprockets" |
|
12 | @import "bootstrap" |
|
28 | @import "bootstrap" |
|
13 |
|
29 | ||
|
|
30 | + .secondnavbar | ||
|
|
31 | + top: 50px | ||
|
|
32 | + | ||
|
14 | body |
|
33 | body |
|
15 | background: white image-url("topbg.jpg") repeat-x top center |
|
34 | background: white image-url("topbg.jpg") repeat-x top center |
|
16 | font-size: 13px |
|
35 | font-size: 13px |
|
17 | font-family: Tahoma, "sans-serif" |
|
36 | font-family: Tahoma, "sans-serif" |
|
18 | margin: 10px |
|
37 | margin: 10px |
|
19 | padding: 10px |
|
38 | padding: 10px |
|
|
39 | + padding-top: 100px | ||
|
20 |
|
40 | ||
|
21 |
|
41 | ||
|
22 | input |
|
42 | input |
|
23 | font-family: Tahoma, "sans-serif" |
|
43 | font-family: Tahoma, "sans-serif" |
|
24 |
|
44 | ||
|
25 |
|
45 | ||
|
26 | h1 |
|
46 | h1 |
|
27 | font-size: 24px |
|
47 | font-size: 24px |
|
28 | color: #334488 |
|
48 | color: #334488 |
|
29 | line-height: 2em |
|
49 | line-height: 2em |
|
30 |
|
50 | ||
|
31 |
|
51 | ||
|
32 | h2 |
|
52 | h2 |
|
33 | font-size: 18px |
|
53 | font-size: 18px |
|
34 | color: #5566bb |
|
54 | color: #5566bb |
|
35 | line-height: 1.5em |
|
55 | line-height: 1.5em |
|
36 |
|
56 | ||
|
37 |
|
57 | ||
|
38 | hr |
|
58 | hr |
|
39 | border-top: 1px solid #dddddd |
|
59 | border-top: 1px solid #dddddd |
|
40 | border-bottom: 1px solid #eeeeee |
|
60 | border-bottom: 1px solid #eeeeee |
|
41 |
|
61 | ||
|
42 |
|
62 | ||
|
43 | a |
|
63 | a |
|
44 | color: #6666cc |
|
64 | color: #6666cc |
|
45 | text-decoration: none |
|
65 | text-decoration: none |
|
46 |
|
66 | ||
|
47 | &:link, &:visited |
|
67 | &:link, &:visited |
|
48 | color: #6666cc |
|
68 | color: #6666cc |
|
49 | text-decoration: none |
|
69 | text-decoration: none |
|
50 |
|
70 | ||
|
51 | &:hover, &:focus |
|
71 | &:hover, &:focus |
|
52 | color: #111166 |
|
72 | color: #111166 |
|
53 | text-decoration: none |
|
73 | text-decoration: none |
|
54 |
|
74 | ||
|
55 |
|
75 | ||
|
56 | div |
|
76 | div |
|
57 | &.userbar |
|
77 | &.userbar |
|
58 | line-height: 1.5em |
|
78 | line-height: 1.5em |
|
59 | text-align: right |
|
79 | text-align: right |
|
60 | font-size: 12px |
|
80 | font-size: 12px |
|
61 |
|
81 | ||
|
62 | &.title |
|
82 | &.title |
|
63 | padding: 10px 0px |
|
83 | padding: 10px 0px |
|
64 | line-height: 1.5em |
|
84 | line-height: 1.5em |
|
65 | font-size: 13px |
|
85 | font-size: 13px |
|
66 |
|
86 | ||
|
67 | span.contest-over-msg |
|
87 | span.contest-over-msg |
|
68 | font-size: 15px |
|
88 | font-size: 15px |
|
69 | color: red |
|
89 | color: red |
|
70 |
|
90 | ||
|
71 | table |
|
91 | table |
|
72 | width: 100% |
|
92 | width: 100% |
|
73 | font-weight: bold |
|
93 | font-weight: bold |
|
74 |
|
94 | ||
|
75 | td |
|
95 | td |
|
76 | &.left-col |
|
96 | &.left-col |
|
77 | text-align: left |
|
97 | text-align: left |
|
78 | vertical-align: top |
|
98 | vertical-align: top |
|
79 | color: #444444 |
|
99 | color: #444444 |
|
80 |
|
100 | ||
|
81 | &.right-col |
|
101 | &.right-col |
|
82 | text-align: right |
|
102 | text-align: right |
|
83 | vertical-align: top |
|
103 | vertical-align: top |
|
84 | font-size: 18px |
|
104 | font-size: 18px |
|
85 | color: #116699 |
|
105 | color: #116699 |
|
86 |
|
106 | ||
|
87 |
|
107 | ||
|
88 | table.info |
|
108 | table.info |
|
89 | margin: 10px 0 |
|
109 | margin: 10px 0 |
|
90 | border: 1px solid #666666 |
|
110 | border: 1px solid #666666 |
|
91 | border-collapse: collapse |
|
111 | border-collapse: collapse |
|
92 | font-size: 12px |
|
112 | font-size: 12px |
|
93 |
|
113 | ||
|
94 | th |
|
114 | th |
|
95 | border: 1px solid #666666 |
|
115 | border: 1px solid #666666 |
|
96 | line-height: 1.5em |
|
116 | line-height: 1.5em |
|
97 | padding: 0 0.5em |
|
117 | padding: 0 0.5em |
|
98 |
|
118 | ||
|
99 | td |
|
119 | td |
|
100 | border-left: 1px solid #666666 |
|
120 | border-left: 1px solid #666666 |
|
101 | border-right: 1px solid #666666 |
|
121 | border-right: 1px solid #666666 |
|
102 | line-height: 1.5em |
|
122 | line-height: 1.5em |
|
103 | padding: 0 0.5em |
|
123 | padding: 0 0.5em |
|
104 |
|
124 | ||
|
105 |
|
125 | ||
|
106 | tr |
|
126 | tr |
|
107 | &.info-head |
|
127 | &.info-head |
|
108 | background: #777777 |
|
128 | background: #777777 |
|
109 | color: white |
|
129 | color: white |
|
110 |
|
130 | ||
|
111 | &.info-odd |
|
131 | &.info-odd |
|
112 | background: #eeeeee |
|
132 | background: #eeeeee |
|
113 |
|
133 | ||
|
114 | &.info-even |
|
134 | &.info-even |
|
115 | background: #fcfcfc |
|
135 | background: #fcfcfc |
|
116 |
|
136 | ||
|
117 | =basicbox |
|
137 | =basicbox |
|
118 | background: #eeeeff |
|
138 | background: #eeeeff |
|
119 | border: 1px dotted #99aaee |
|
139 | border: 1px dotted #99aaee |
|
120 | padding: 5px |
|
140 | padding: 5px |
|
121 | margin: 10px 0px |
|
141 | margin: 10px 0px |
|
122 | color: black |
|
142 | color: black |
|
123 | font-size: 13px |
|
143 | font-size: 13px |
|
124 |
|
144 | ||
|
125 | .infobox |
|
145 | .infobox |
|
126 | +basicbox |
|
146 | +basicbox |
|
127 |
|
147 | ||
|
128 | .submitbox |
|
148 | .submitbox |
|
129 | +basicbox |
|
149 | +basicbox |
|
130 |
|
150 | ||
|
131 | .errorExplanation |
|
151 | .errorExplanation |
|
132 | border: 1px dotted gray |
|
152 | border: 1px dotted gray |
|
133 | color: #bb2222 |
|
153 | color: #bb2222 |
|
134 | padding: 5px 15px 5px 15px |
|
154 | padding: 5px 15px 5px 15px |
|
135 | margin-bottom: 5px |
|
155 | margin-bottom: 5px |
|
136 | background-color: white |
|
156 | background-color: white |
|
137 | font-weight: normal |
|
157 | font-weight: normal |
|
138 |
|
158 | ||
|
139 | h2 |
|
159 | h2 |
|
140 | color: #cc1111 |
|
160 | color: #cc1111 |
|
141 | font-weight: bold |
|
161 | font-weight: bold |
|
142 |
|
162 | ||
|
143 |
|
163 | ||
|
144 | table.uinfo |
|
164 | table.uinfo |
|
145 | border-collapse: collapse |
|
165 | border-collapse: collapse |
|
146 | border: 1px solid black |
|
166 | border: 1px solid black |
|
147 | font-size: 13px |
|
167 | font-size: 13px |
|
148 |
|
168 | ||
|
149 |
|
169 | ||
|
150 | td.uinfo |
|
170 | td.uinfo |
|
151 | vertical-align: top |
|
171 | vertical-align: top |
|
152 | border: 1px solid black |
|
172 | border: 1px solid black |
|
153 | padding: 5px |
|
173 | padding: 5px |
|
154 |
|
174 | ||
|
155 |
|
175 | ||
|
156 | th.uinfo |
|
176 | th.uinfo |
|
157 | background: lightgreen |
|
177 | background: lightgreen |
|
158 | vertical-align: top |
|
178 | vertical-align: top |
|
159 | text-align: right |
|
179 | text-align: right |
|
160 | border: 1px solid black |
|
180 | border: 1px solid black |
|
161 | padding: 5px |
|
181 | padding: 5px |
|
162 |
|
182 | ||
|
163 |
|
183 | ||
|
164 | div |
|
184 | div |
|
165 | &.compilermsgbody |
|
185 | &.compilermsgbody |
|
166 | font-family: monospace |
|
186 | font-family: monospace |
|
167 |
|
187 | ||
|
168 | &.task-menu |
|
188 | &.task-menu |
|
169 | text-align: center |
|
189 | text-align: center |
|
170 | font-size: 13px |
|
190 | font-size: 13px |
|
171 | line-height: 1.75em |
|
191 | line-height: 1.75em |
|
172 | font-weight: bold |
|
192 | font-weight: bold |
|
173 | border-top: 1px dashed gray |
|
193 | border-top: 1px dashed gray |
|
174 | border-bottom: 1px dashed gray |
|
194 | border-bottom: 1px dashed gray |
|
175 | margin-top: 2px |
|
195 | margin-top: 2px |
|
176 | margin-bottom: 4px |
|
196 | margin-bottom: 4px |
|
177 |
|
197 | ||
|
178 |
|
198 | ||
|
179 | table.taskdesc |
|
199 | table.taskdesc |
|
180 | border: 2px solid #dddddd |
|
200 | border: 2px solid #dddddd |
|
181 | border-collapse: collapse |
|
201 | border-collapse: collapse |
|
182 | margin: 10px auto |
|
202 | margin: 10px auto |
|
183 | width: 90% |
|
203 | width: 90% |
|
184 | font-size: 13px |
|
204 | font-size: 13px |
|
185 |
|
205 | ||
|
186 | p |
|
206 | p |
|
187 | font-size: 13px |
|
207 | font-size: 13px |
|
188 |
|
208 | ||
|
189 | tr.name |
|
209 | tr.name |
|
190 | border: 2px solid #dddddd |
|
210 | border: 2px solid #dddddd |
|
191 | background: #dddddd |
|
211 | background: #dddddd |
|
192 | color: #333333 |
|
212 | color: #333333 |
|
193 | font-weight: bold |
|
213 | font-weight: bold |
|
194 | font-size: 14px |
|
214 | font-size: 14px |
|
195 | line-height: 1.5em |
|
215 | line-height: 1.5em |
|
196 | text-align: center |
|
216 | text-align: center |
|
197 |
|
217 | ||
|
198 | td |
|
218 | td |
|
199 | &.desc-odd |
|
219 | &.desc-odd |
|
200 | padding: 5px |
|
220 | padding: 5px |
|
201 | padding-left: 20px |
|
221 | padding-left: 20px |
|
202 | background: #fefeee |
|
222 | background: #fefeee |
|
203 |
|
223 | ||
|
204 | &.desc-even |
|
224 | &.desc-even |
|
205 | padding: 5px |
|
225 | padding: 5px |
|
206 | padding-left: 20px |
|
226 | padding-left: 20px |
|
207 | background: #feeefe |
|
227 | background: #feeefe |
|
208 |
|
228 | ||
|
209 |
|
229 | ||
|
210 | .announcementbox |
|
230 | .announcementbox |
|
211 | margin: 10px 0px |
|
231 | margin: 10px 0px |
|
212 | background: #bbddee |
|
232 | background: #bbddee |
|
213 | padding: 1px |
|
233 | padding: 1px |
|
214 |
|
234 | ||
|
215 | span.title |
|
235 | span.title |
|
216 | font-weight: bold |
|
236 | font-weight: bold |
|
217 | color: #224455 |
|
237 | color: #224455 |
|
218 | padding-left: 10px |
|
238 | padding-left: 10px |
|
219 | line-height: 1.6em |
|
239 | line-height: 1.6em |
|
220 |
|
240 | ||
|
221 | .announcement |
|
241 | .announcement |
|
222 | margin: 2px |
|
242 | margin: 2px |
|
223 | background: white |
|
243 | background: white |
|
224 | padding: 1px |
|
244 | padding: 1px |
|
225 | padding-left: 10px |
|
245 | padding-left: 10px |
|
226 | padding-right: 10px |
|
246 | padding-right: 10px |
|
227 | padding-top: 5px |
|
247 | padding-top: 5px |
|
228 | padding-bottom: 5px |
|
248 | padding-bottom: 5px |
|
229 |
|
249 | ||
|
230 |
|
250 | ||
|
231 | .announcement p |
|
251 | .announcement p |
|
232 | font-size: 12px |
|
252 | font-size: 12px |
|
233 | margin: 2px |
|
253 | margin: 2px |
|
234 |
|
254 | ||
|
235 |
|
255 | ||
|
236 | .pub-info |
|
256 | .pub-info |
|
237 | text-align: right |
|
257 | text-align: right |
|
238 | font-style: italic |
|
258 | font-style: italic |
|
239 | font-size: 9px |
|
259 | font-size: 9px |
|
240 |
|
260 | ||
|
241 | p |
|
261 | p |
|
242 | text-align: right |
|
262 | text-align: right |
|
243 | font-style: italic |
|
263 | font-style: italic |
|
244 | font-size: 9px |
|
264 | font-size: 9px |
|
245 |
|
265 | ||
|
246 |
|
266 | ||
|
247 | .announcement |
|
267 | .announcement |
|
248 | .toggles |
|
268 | .toggles |
|
249 | font-weight: normal |
|
269 | font-weight: normal |
|
250 | float: right |
|
270 | float: right |
|
251 | font-size: 80% |
|
271 | font-size: 80% |
|
252 |
|
272 | ||
|
253 | .announcement-title |
|
273 | .announcement-title |
|
254 | font-weight: bold |
|
274 | font-weight: bold |
|
255 |
|
275 | ||
|
256 |
|
276 | ||
|
257 | div |
|
277 | div |
|
258 | &.message |
|
278 | &.message |
|
259 | margin: 10px 0 0 |
|
279 | margin: 10px 0 0 |
|
260 |
|
280 | ||
|
261 | div |
|
281 | div |
|
262 | &.message |
|
282 | &.message |
|
263 | margin: 0 0 0 30px |
|
283 | margin: 0 0 0 30px |
|
264 |
|
284 | ||
|
265 | &.body |
|
285 | &.body |
|
266 | border: 2px solid #dddddd |
|
286 | border: 2px solid #dddddd |
|
267 | background: #fff8f8 |
|
287 | background: #fff8f8 |
|
268 | padding-left: 5px |
|
288 | padding-left: 5px |
|
269 |
|
289 | ||
|
270 | &.reply-body |
|
290 | &.reply-body |
|
271 | border: 2px solid #bbbbbb |
|
291 | border: 2px solid #bbbbbb |
|
272 | background: #fffff8 |
|
292 | background: #fffff8 |
|
273 | padding-left: 5px |
|
293 | padding-left: 5px |
|
274 |
|
294 | ||
|
275 | &.stat |
|
295 | &.stat |
|
276 | font-size: 10px |
|
296 | font-size: 10px |
|
277 | line-height: 1.75em |
|
297 | line-height: 1.75em |
|
278 | padding: 0 5px |
|
298 | padding: 0 5px |
|
279 | color: #333333 |
|
299 | color: #333333 |
|
280 | background: #dddddd |
|
300 | background: #dddddd |
|
281 | font-weight: bold |
|
301 | font-weight: bold |
|
282 |
|
302 | ||
|
283 | &.message div.stat |
|
303 | &.message div.stat |
|
284 | font-size: 10px |
|
304 | font-size: 10px |
|
285 | line-height: 1.75em |
|
305 | line-height: 1.75em |
|
286 | padding: 0 5px |
|
306 | padding: 0 5px |
|
287 | color: #444444 |
|
307 | color: #444444 |
|
288 | background: #bbbbbb |
|
308 | background: #bbbbbb |
|
289 | font-weight: bold |
|
309 | font-weight: bold |
|
290 |
|
310 | ||
|
291 | &.contest-title |
|
311 | &.contest-title |
|
292 | color: white |
|
312 | color: white |
|
293 | text-align: center |
|
313 | text-align: center |
|
294 | line-height: 2em |
|
314 | line-height: 2em |
|
295 |
|
315 | ||
|
296 | &.registration-desc, &.test-desc |
|
316 | &.registration-desc, &.test-desc |
|
297 | border: 1px dotted gray |
|
317 | border: 1px dotted gray |
|
298 | background: #f5f5f5 |
|
318 | background: #f5f5f5 |
|
299 | padding: 5px |
|
319 | padding: 5px |
|
300 | margin: 10px 0 |
|
320 | margin: 10px 0 |
|
301 | font-size: 12px |
|
321 | font-size: 12px |
|
302 | line-height: 1.5em |
|
322 | line-height: 1.5em |
|
303 |
|
323 | ||
|
304 | h2.contest-title |
|
324 | h2.contest-title |
|
305 | margin-top: 5px |
|
325 | margin-top: 5px |
|
306 | margin-bottom: 5px |
|
326 | margin-bottom: 5px |
@@ -1,138 +1,170 | |||||
|
1 | # Methods added to this helper will be available to all templates in the application. |
|
1 | # Methods added to this helper will be available to all templates in the application. |
|
2 | module ApplicationHelper |
|
2 | module ApplicationHelper |
|
3 |
|
3 | ||
|
|
4 | + def navbar_user_header | ||
|
|
5 | + left_menu = '' | ||
|
|
6 | + right_menu = '' | ||
|
|
7 | + user = User.find(session[:user_id]) | ||
|
|
8 | + | ||
|
|
9 | + if (user!=nil) and (GraderConfiguration.show_tasks_to?(user)) | ||
|
|
10 | + left_menu << add_menu("#{I18n.t 'menu.tasks'}", 'tasks', 'list') | ||
|
|
11 | + left_menu << add_menu("#{I18n.t 'menu.submissions'}", 'main', 'submission') | ||
|
|
12 | + left_menu << add_menu("#{I18n.t 'menu.test'}", 'test', 'index') | ||
|
|
13 | + end | ||
|
|
14 | + | ||
|
|
15 | + if GraderConfiguration['right.user_hall_of_fame'] | ||
|
|
16 | + left_menu << add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof') | ||
|
|
17 | + end | ||
|
|
18 | + left_menu << add_menu("#{I18n.t 'menu.help'}", 'main', 'help') | ||
|
|
19 | + | ||
|
|
20 | + | ||
|
|
21 | + right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-comment')} #{I18n.t 'menu.messages'}".html_safe, 'messages', 'list') | ||
|
|
22 | + if GraderConfiguration['system.user_setting_enabled'] | ||
|
|
23 | + right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-cog')} #{I18n.t 'menu.settings'}".html_safe, 'users', 'index') | ||
|
|
24 | + end | ||
|
|
25 | + right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-log-out')} #{I18n.t 'menu.log_out'}".html_safe, 'main', 'login',) | ||
|
|
26 | + | ||
|
|
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 | + end | ||
|
|
29 | + | ||
|
|
30 | + def add_menu(title, controller, action,html_option = {}) | ||
|
|
31 | + link_option = {controller: controller, action: action} | ||
|
|
32 | + html_option[:class] = (html_option[:class] || '') + " active" if current_page?(link_option) | ||
|
|
33 | + content_tag(:li, link_to(title,link_option),html_option) | ||
|
|
34 | + end | ||
|
|
35 | + | ||
|
4 | def user_header |
|
36 | def user_header |
|
5 | menu_items = '' |
|
37 | menu_items = '' |
|
6 | user = User.find(session[:user_id]) |
|
38 | user = User.find(session[:user_id]) |
|
7 |
|
39 | ||
|
8 | if (user!=nil) and (session[:admin]) |
|
40 | if (user!=nil) and (session[:admin]) |
|
9 | # admin menu |
|
41 | # admin menu |
|
10 | menu_items << "<b>Administrative task:</b> " |
|
42 | menu_items << "<b>Administrative task:</b> " |
|
11 | append_to menu_items, '[Announcements]', 'announcements', 'index' |
|
43 | append_to menu_items, '[Announcements]', 'announcements', 'index' |
|
12 | append_to menu_items, '[Msg console]', 'messages', 'console' |
|
44 | append_to menu_items, '[Msg console]', 'messages', 'console' |
|
13 | append_to menu_items, '[Problems]', 'problems', 'index' |
|
45 | append_to menu_items, '[Problems]', 'problems', 'index' |
|
14 | append_to menu_items, '[Users]', 'user_admin', 'index' |
|
46 | append_to menu_items, '[Users]', 'user_admin', 'index' |
|
15 | append_to menu_items, '[Results]', 'user_admin', 'user_stat' |
|
47 | append_to menu_items, '[Results]', 'user_admin', 'user_stat' |
|
16 | append_to menu_items, '[Report]', 'report', 'multiple_login' |
|
48 | append_to menu_items, '[Report]', 'report', 'multiple_login' |
|
17 | append_to menu_items, '[Graders]', 'graders', 'list' |
|
49 | append_to menu_items, '[Graders]', 'graders', 'list' |
|
18 | append_to menu_items, '[Contests]', 'contest_management', 'index' |
|
50 | append_to menu_items, '[Contests]', 'contest_management', 'index' |
|
19 | append_to menu_items, '[Sites]', 'sites', 'index' |
|
51 | append_to menu_items, '[Sites]', 'sites', 'index' |
|
20 | append_to menu_items, '[System config]', 'configurations', 'index' |
|
52 | append_to menu_items, '[System config]', 'configurations', 'index' |
|
21 | menu_items << "<br/>" |
|
53 | menu_items << "<br/>" |
|
22 | end |
|
54 | end |
|
23 |
|
55 | ||
|
24 | # main page |
|
56 | # main page |
|
25 | append_to menu_items, "[#{I18n.t 'menu.main'}]", 'main', 'list' |
|
57 | append_to menu_items, "[#{I18n.t 'menu.main'}]", 'main', 'list' |
|
26 | append_to menu_items, "[#{I18n.t 'menu.messages'}]", 'messages', 'list' |
|
58 | append_to menu_items, "[#{I18n.t 'menu.messages'}]", 'messages', 'list' |
|
27 |
|
59 | ||
|
28 | if (user!=nil) and (GraderConfiguration.show_tasks_to?(user)) |
|
60 | if (user!=nil) and (GraderConfiguration.show_tasks_to?(user)) |
|
29 | append_to menu_items, "[#{I18n.t 'menu.tasks'}]", 'tasks', 'list' |
|
61 | append_to menu_items, "[#{I18n.t 'menu.tasks'}]", 'tasks', 'list' |
|
30 | append_to menu_items, "[#{I18n.t 'menu.submissions'}]", 'main', 'submission' |
|
62 | append_to menu_items, "[#{I18n.t 'menu.submissions'}]", 'main', 'submission' |
|
31 | append_to menu_items, "[#{I18n.t 'menu.test'}]", 'test', 'index' |
|
63 | append_to menu_items, "[#{I18n.t 'menu.test'}]", 'test', 'index' |
|
32 | end |
|
64 | end |
|
33 |
|
65 | ||
|
34 | if GraderConfiguration['right.user_hall_of_fame'] |
|
66 | if GraderConfiguration['right.user_hall_of_fame'] |
|
35 | append_to menu_items, "[#{I18n.t 'menu.hall_of_fame'}]", 'report', 'problem_hof' |
|
67 | append_to menu_items, "[#{I18n.t 'menu.hall_of_fame'}]", 'report', 'problem_hof' |
|
36 | end |
|
68 | end |
|
37 | append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help' |
|
69 | append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help' |
|
38 |
|
70 | ||
|
39 | if GraderConfiguration['system.user_setting_enabled'] |
|
71 | if GraderConfiguration['system.user_setting_enabled'] |
|
40 | append_to menu_items, "[#{I18n.t 'menu.settings'}]", 'users', 'index' |
|
72 | append_to menu_items, "[#{I18n.t 'menu.settings'}]", 'users', 'index' |
|
41 | end |
|
73 | end |
|
42 | append_to menu_items, "[#{I18n.t 'menu.log_out'}]", 'main', 'login' |
|
74 | append_to menu_items, "[#{I18n.t 'menu.log_out'}]", 'main', 'login' |
|
43 |
|
75 | ||
|
44 | menu_items.html_safe |
|
76 | menu_items.html_safe |
|
45 | end |
|
77 | end |
|
46 |
|
78 | ||
|
47 | def append_to(option,label, controller, action) |
|
79 | def append_to(option,label, controller, action) |
|
48 | option << ' ' if option!='' |
|
80 | option << ' ' if option!='' |
|
49 | option << link_to_unless_current(label, |
|
81 | option << link_to_unless_current(label, |
|
50 | :controller => controller, |
|
82 | :controller => controller, |
|
51 | :action => action) |
|
83 | :action => action) |
|
52 | end |
|
84 | end |
|
53 |
|
85 | ||
|
54 | def format_short_time(time) |
|
86 | def format_short_time(time) |
|
55 | now = Time.now.gmtime |
|
87 | now = Time.now.gmtime |
|
56 | st = '' |
|
88 | st = '' |
|
57 | if (time.yday != now.yday) or |
|
89 | if (time.yday != now.yday) or |
|
58 | (time.year != now.year) |
|
90 | (time.year != now.year) |
|
59 | st = time.strftime("%x ") |
|
91 | st = time.strftime("%x ") |
|
60 | end |
|
92 | end |
|
61 | st + time.strftime("%X") |
|
93 | st + time.strftime("%X") |
|
62 | end |
|
94 | end |
|
63 |
|
95 | ||
|
64 | def format_short_duration(duration) |
|
96 | def format_short_duration(duration) |
|
65 | return '' if duration==nil |
|
97 | return '' if duration==nil |
|
66 | d = duration.to_f |
|
98 | d = duration.to_f |
|
67 | return Time.at(d).gmtime.strftime("%X") |
|
99 | return Time.at(d).gmtime.strftime("%X") |
|
68 | end |
|
100 | end |
|
69 |
|
101 | ||
|
70 | def read_textfile(fname,max_size=2048) |
|
102 | def read_textfile(fname,max_size=2048) |
|
71 | begin |
|
103 | begin |
|
72 | File.open(fname).read(max_size) |
|
104 | File.open(fname).read(max_size) |
|
73 | rescue |
|
105 | rescue |
|
74 | nil |
|
106 | nil |
|
75 | end |
|
107 | end |
|
76 | end |
|
108 | end |
|
77 |
|
109 | ||
|
78 | def user_title_bar(user) |
|
110 | def user_title_bar(user) |
|
79 | header = '' |
|
111 | header = '' |
|
80 | time_left = '' |
|
112 | time_left = '' |
|
81 |
|
113 | ||
|
82 | # |
|
114 | # |
|
83 | # if the contest is over |
|
115 | # if the contest is over |
|
84 | if GraderConfiguration.time_limit_mode? |
|
116 | if GraderConfiguration.time_limit_mode? |
|
85 | if user.contest_finished? |
|
117 | if user.contest_finished? |
|
86 | header = <<CONTEST_OVER |
|
118 | header = <<CONTEST_OVER |
|
87 | <tr><td colspan="2" align="center"> |
|
119 | <tr><td colspan="2" align="center"> |
|
88 | <span class="contest-over-msg">THE CONTEST IS OVER</span> |
|
120 | <span class="contest-over-msg">THE CONTEST IS OVER</span> |
|
89 | </td></tr> |
|
121 | </td></tr> |
|
90 | CONTEST_OVER |
|
122 | CONTEST_OVER |
|
91 | end |
|
123 | end |
|
92 | if !user.contest_started? |
|
124 | if !user.contest_started? |
|
93 | time_left = " " + (t 'title_bar.contest_not_started') |
|
125 | time_left = " " + (t 'title_bar.contest_not_started') |
|
94 | else |
|
126 | else |
|
95 | time_left = " " + (t 'title_bar.remaining_time') + |
|
127 | time_left = " " + (t 'title_bar.remaining_time') + |
|
96 | " #{format_short_duration(user.contest_time_left)}" |
|
128 | " #{format_short_duration(user.contest_time_left)}" |
|
97 | end |
|
129 | end |
|
98 | end |
|
130 | end |
|
99 |
|
131 | ||
|
100 | # |
|
132 | # |
|
101 | # if the contest is in the anaysis mode |
|
133 | # if the contest is in the anaysis mode |
|
102 | if GraderConfiguration.analysis_mode? |
|
134 | if GraderConfiguration.analysis_mode? |
|
103 | header = <<ANALYSISMODE |
|
135 | header = <<ANALYSISMODE |
|
104 | <tr><td colspan="2" align="center"> |
|
136 | <tr><td colspan="2" align="center"> |
|
105 | <span class="contest-over-msg">ANALYSIS MODE</span> |
|
137 | <span class="contest-over-msg">ANALYSIS MODE</span> |
|
106 | </td></tr> |
|
138 | </td></tr> |
|
107 | ANALYSISMODE |
|
139 | ANALYSISMODE |
|
108 | end |
|
140 | end |
|
109 |
|
141 | ||
|
110 | contest_name = GraderConfiguration['contest.name'] |
|
142 | contest_name = GraderConfiguration['contest.name'] |
|
111 |
|
143 | ||
|
112 | # |
|
144 | # |
|
113 | # build real title bar |
|
145 | # build real title bar |
|
114 | result = <<TITLEBAR |
|
146 | result = <<TITLEBAR |
|
115 | <div class="title"> |
|
147 | <div class="title"> |
|
116 | <table> |
|
148 | <table> |
|
117 | #{header} |
|
149 | #{header} |
|
118 | <tr> |
|
150 | <tr> |
|
119 | <td class="left-col"> |
|
151 | <td class="left-col"> |
|
120 | #{user.full_name}<br/> |
|
152 | #{user.full_name}<br/> |
|
121 | #{t 'title_bar.current_time'} #{format_short_time(Time.zone.now)} |
|
153 | #{t 'title_bar.current_time'} #{format_short_time(Time.zone.now)} |
|
122 | #{time_left} |
|
154 | #{time_left} |
|
123 | <br/> |
|
155 | <br/> |
|
124 | </td> |
|
156 | </td> |
|
125 | <td class="right-col">#{contest_name}</td> |
|
157 | <td class="right-col">#{contest_name}</td> |
|
126 | </tr> |
|
158 | </tr> |
|
127 | </table> |
|
159 | </table> |
|
128 | </div> |
|
160 | </div> |
|
129 | TITLEBAR |
|
161 | TITLEBAR |
|
130 | result.html_safe |
|
162 | result.html_safe |
|
131 | end |
|
163 | end |
|
132 |
|
164 | ||
|
133 | def markdown(text) |
|
165 | def markdown(text) |
|
134 | markdown = RDiscount.new(text) |
|
166 | markdown = RDiscount.new(text) |
|
135 | markdown.to_html.html_safe |
|
167 | markdown.to_html.html_safe |
|
136 | end |
|
168 | end |
|
137 |
|
169 | ||
|
138 | end |
|
170 | end |
@@ -1,18 +1,30 | |||||
|
1 | <!DOCTYPE html> |
|
1 | <!DOCTYPE html> |
|
2 | %html |
|
2 | %html |
|
3 | %head |
|
3 | %head |
|
4 | %title= GraderConfiguration['contest.name'] |
|
4 | %title= GraderConfiguration['contest.name'] |
|
5 | = stylesheet_link_tag "application", :media => "all" |
|
5 | = stylesheet_link_tag "application", :media => "all" |
|
6 | = javascript_include_tag "application" |
|
6 | = javascript_include_tag "application" |
|
7 | = csrf_meta_tags |
|
7 | = csrf_meta_tags |
|
8 | = content_for :header |
|
8 | = content_for :header |
|
9 | = yield :head |
|
9 | = yield :head |
|
10 |
|
10 | ||
|
11 | %body |
|
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 | ||
|
12 |
|
24 | ||
|
13 | %div.userbar |
|
25 | %div.userbar |
|
14 | = user_header |
|
26 | = user_header |
|
15 |
|
27 | ||
|
16 | = content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil |
|
28 | = content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil |
|
17 | = yield |
|
29 | = yield |
|
18 |
|
30 |
@@ -1,74 +1,25 | |||||
|
1 | CafeGrader::Application.routes.draw do |
|
1 | CafeGrader::Application.routes.draw do |
|
|
2 | + root :to => 'main#login' | ||
|
|
3 | + | ||
|
2 | get "report/login" |
|
4 | get "report/login" |
|
3 |
|
5 | ||
|
4 | resources :contests |
|
6 | resources :contests |
|
5 |
|
7 | ||
|
6 | resources :announcements |
|
8 | resources :announcements |
|
7 | resources :sites |
|
9 | resources :sites |
|
8 |
|
10 | ||
|
9 | resources :grader_configuration, controller: 'configurations' |
|
11 | resources :grader_configuration, controller: 'configurations' |
|
10 |
|
12 | ||
|
11 | - # The priority is based upon order of creation: |
|
||
|
12 | - # first created -> highest priority. |
|
||
|
13 | - |
|
||
|
14 | - # Sample of regular route: |
|
||
|
15 | - # match 'products/:id' => 'catalog#view' |
|
||
|
16 | - # Keep in mind you can assign values other than :controller and :action |
|
||
|
17 | - |
|
||
|
18 | - # Sample of named route: |
|
||
|
19 | - # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase |
|
||
|
20 | - # This route can be invoked with purchase_url(:id => product.id) |
|
||
|
21 | - |
|
||
|
22 | - # Sample resource route (maps HTTP verbs to controller actions automatically): |
|
||
|
23 | - # resources :products |
|
||
|
24 | - |
|
||
|
25 | - # Sample resource route with options: |
|
||
|
26 | - # resources :products do |
|
||
|
27 | - # member do |
|
||
|
28 | - # get 'short' |
|
||
|
29 | - # post 'toggle' |
|
||
|
30 | - # end |
|
||
|
31 | - # |
|
||
|
32 | - # collection do |
|
||
|
33 | - # get 'sold' |
|
||
|
34 | - # end |
|
||
|
35 | - # end |
|
||
|
36 | - |
|
||
|
37 | - # Sample resource route with sub-resources: |
|
||
|
38 | - # resources :products do |
|
||
|
39 | - # resources :comments, :sales |
|
||
|
40 | - # resource :seller |
|
||
|
41 | - # end |
|
||
|
42 | - |
|
||
|
43 | - # Sample resource route with more complex sub-resources |
|
||
|
44 | - # resources :products do |
|
||
|
45 | - # resources :comments |
|
||
|
46 | - # resources :sales do |
|
||
|
47 | - # get 'recent', :on => :collection |
|
||
|
48 | - # end |
|
||
|
49 | - # end |
|
||
|
50 | - |
|
||
|
51 | - # Sample resource route within a namespace: |
|
||
|
52 | - # namespace :admin do |
|
||
|
53 | - # # Directs /admin/products/* to Admin::ProductsController |
|
||
|
54 | - # # (app/controllers/admin/products_controller.rb) |
|
||
|
55 | - # resources :products |
|
||
|
56 | - # end |
|
||
|
57 | - |
|
||
|
58 | - # You can have the root of your site routed with "root" |
|
||
|
59 | - # just remember to delete public/index.html. |
|
||
|
60 | - # root :to => 'welcome#index' |
|
||
|
61 | - |
|
||
|
62 | - root :to => 'main#login' |
|
||
|
63 | - |
|
||
|
64 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
13 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
65 | match 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
14 | match 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
|
15 | + match 'heartbeat/:id/edit' => 'heartbeat#edit' | ||
|
66 |
|
16 | ||
|
67 | - match 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
17 | + #main |
|
|
18 | + get "main/list" | ||
|
68 |
|
19 | ||
|
69 | # See how all your routes lay out with "rake routes" |
|
20 | # See how all your routes lay out with "rake routes" |
|
70 |
|
21 | ||
|
71 | # This is a legacy wild controller route that's not recommended for RESTful applications. |
|
22 | # This is a legacy wild controller route that's not recommended for RESTful applications. |
|
72 | # Note: This route will make all actions in every controller accessible via GET requests. |
|
23 | # Note: This route will make all actions in every controller accessible via GET requests. |
|
73 | match ':controller(/:action(/:id))(.:format)' |
|
24 | match ':controller(/:action(/:id))(.:format)' |
|
74 | end |
|
25 | end |
You need to be logged in to leave comments.
Login now