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: 74 inserted, 59 deleted
@@ -1,115 +1,135 | |||
|
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 | 18 | @import jquery.ui.core |
|
3 | 19 | @import jquery.ui.theme |
|
4 | 20 | @import jquery.ui.datepicker |
|
5 | 21 | @import jquery.ui.slider |
|
6 | 22 | @import jquery-ui-timepicker-addon |
|
7 | 23 | @import jquery-tablesorter/theme.metro-dark |
|
8 | 24 | @import tablesorter-theme.cafe |
|
9 | 25 | |
|
10 | 26 | |
|
11 | 27 | @import "bootstrap-sprockets" |
|
12 | 28 | @import "bootstrap" |
|
13 | 29 | |
|
30 | + .secondnavbar | |
|
31 | + top: 50px | |
|
32 | + | |
|
14 | 33 | body |
|
15 | 34 | background: white image-url("topbg.jpg") repeat-x top center |
|
16 | 35 | font-size: 13px |
|
17 | 36 | font-family: Tahoma, "sans-serif" |
|
18 | 37 | margin: 10px |
|
19 | 38 | padding: 10px |
|
39 | + padding-top: 100px | |
|
20 | 40 | |
|
21 | 41 | |
|
22 | 42 | input |
|
23 | 43 | font-family: Tahoma, "sans-serif" |
|
24 | 44 | |
|
25 | 45 | |
|
26 | 46 | h1 |
|
27 | 47 | font-size: 24px |
|
28 | 48 | color: #334488 |
|
29 | 49 | line-height: 2em |
|
30 | 50 | |
|
31 | 51 | |
|
32 | 52 | h2 |
|
33 | 53 | font-size: 18px |
|
34 | 54 | color: #5566bb |
|
35 | 55 | line-height: 1.5em |
|
36 | 56 | |
|
37 | 57 | |
|
38 | 58 | hr |
|
39 | 59 | border-top: 1px solid #dddddd |
|
40 | 60 | border-bottom: 1px solid #eeeeee |
|
41 | 61 | |
|
42 | 62 | |
|
43 | 63 | a |
|
44 | 64 | color: #6666cc |
|
45 | 65 | text-decoration: none |
|
46 | 66 | |
|
47 | 67 | &:link, &:visited |
|
48 | 68 | color: #6666cc |
|
49 | 69 | text-decoration: none |
|
50 | 70 | |
|
51 | 71 | &:hover, &:focus |
|
52 | 72 | color: #111166 |
|
53 | 73 | text-decoration: none |
|
54 | 74 | |
|
55 | 75 | |
|
56 | 76 | div |
|
57 | 77 | &.userbar |
|
58 | 78 | line-height: 1.5em |
|
59 | 79 | text-align: right |
|
60 | 80 | font-size: 12px |
|
61 | 81 | |
|
62 | 82 | &.title |
|
63 | 83 | padding: 10px 0px |
|
64 | 84 | line-height: 1.5em |
|
65 | 85 | font-size: 13px |
|
66 | 86 | |
|
67 | 87 | span.contest-over-msg |
|
68 | 88 | font-size: 15px |
|
69 | 89 | color: red |
|
70 | 90 | |
|
71 | 91 | table |
|
72 | 92 | width: 100% |
|
73 | 93 | font-weight: bold |
|
74 | 94 | |
|
75 | 95 | td |
|
76 | 96 | &.left-col |
|
77 | 97 | text-align: left |
|
78 | 98 | vertical-align: top |
|
79 | 99 | color: #444444 |
|
80 | 100 | |
|
81 | 101 | &.right-col |
|
82 | 102 | text-align: right |
|
83 | 103 | vertical-align: top |
|
84 | 104 | font-size: 18px |
|
85 | 105 | color: #116699 |
|
86 | 106 | |
|
87 | 107 | |
|
88 | 108 | table.info |
|
89 | 109 | margin: 10px 0 |
|
90 | 110 | border: 1px solid #666666 |
|
91 | 111 | border-collapse: collapse |
|
92 | 112 | font-size: 12px |
|
93 | 113 | |
|
94 | 114 | th |
|
95 | 115 | border: 1px solid #666666 |
|
96 | 116 | line-height: 1.5em |
|
97 | 117 | padding: 0 0.5em |
|
98 | 118 | |
|
99 | 119 | td |
|
100 | 120 | border-left: 1px solid #666666 |
|
101 | 121 | border-right: 1px solid #666666 |
|
102 | 122 | line-height: 1.5em |
|
103 | 123 | padding: 0 0.5em |
|
104 | 124 | |
|
105 | 125 | |
|
106 | 126 | tr |
|
107 | 127 | &.info-head |
|
108 | 128 | background: #777777 |
|
109 | 129 | color: white |
|
110 | 130 | |
|
111 | 131 | &.info-odd |
|
112 | 132 | background: #eeeeee |
|
113 | 133 | |
|
114 | 134 | &.info-even |
|
115 | 135 | background: #fcfcfc |
@@ -1,99 +1,131 | |||
|
1 | 1 | # Methods added to this helper will be available to all templates in the application. |
|
2 | 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 | 36 | def user_header |
|
5 | 37 | menu_items = '' |
|
6 | 38 | user = User.find(session[:user_id]) |
|
7 | 39 | |
|
8 | 40 | if (user!=nil) and (session[:admin]) |
|
9 | 41 | # admin menu |
|
10 | 42 | menu_items << "<b>Administrative task:</b> " |
|
11 | 43 | append_to menu_items, '[Announcements]', 'announcements', 'index' |
|
12 | 44 | append_to menu_items, '[Msg console]', 'messages', 'console' |
|
13 | 45 | append_to menu_items, '[Problems]', 'problems', 'index' |
|
14 | 46 | append_to menu_items, '[Users]', 'user_admin', 'index' |
|
15 | 47 | append_to menu_items, '[Results]', 'user_admin', 'user_stat' |
|
16 | 48 | append_to menu_items, '[Report]', 'report', 'multiple_login' |
|
17 | 49 | append_to menu_items, '[Graders]', 'graders', 'list' |
|
18 | 50 | append_to menu_items, '[Contests]', 'contest_management', 'index' |
|
19 | 51 | append_to menu_items, '[Sites]', 'sites', 'index' |
|
20 | 52 | append_to menu_items, '[System config]', 'configurations', 'index' |
|
21 | 53 | menu_items << "<br/>" |
|
22 | 54 | end |
|
23 | 55 | |
|
24 | 56 | # main page |
|
25 | 57 | append_to menu_items, "[#{I18n.t 'menu.main'}]", 'main', 'list' |
|
26 | 58 | append_to menu_items, "[#{I18n.t 'menu.messages'}]", 'messages', 'list' |
|
27 | 59 | |
|
28 | 60 | if (user!=nil) and (GraderConfiguration.show_tasks_to?(user)) |
|
29 | 61 | append_to menu_items, "[#{I18n.t 'menu.tasks'}]", 'tasks', 'list' |
|
30 | 62 | append_to menu_items, "[#{I18n.t 'menu.submissions'}]", 'main', 'submission' |
|
31 | 63 | append_to menu_items, "[#{I18n.t 'menu.test'}]", 'test', 'index' |
|
32 | 64 | end |
|
33 | 65 | |
|
34 | 66 | if GraderConfiguration['right.user_hall_of_fame'] |
|
35 | 67 | append_to menu_items, "[#{I18n.t 'menu.hall_of_fame'}]", 'report', 'problem_hof' |
|
36 | 68 | end |
|
37 | 69 | append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help' |
|
38 | 70 | |
|
39 | 71 | if GraderConfiguration['system.user_setting_enabled'] |
|
40 | 72 | append_to menu_items, "[#{I18n.t 'menu.settings'}]", 'users', 'index' |
|
41 | 73 | end |
|
42 | 74 | append_to menu_items, "[#{I18n.t 'menu.log_out'}]", 'main', 'login' |
|
43 | 75 | |
|
44 | 76 | menu_items.html_safe |
|
45 | 77 | end |
|
46 | 78 | |
|
47 | 79 | def append_to(option,label, controller, action) |
|
48 | 80 | option << ' ' if option!='' |
|
49 | 81 | option << link_to_unless_current(label, |
|
50 | 82 | :controller => controller, |
|
51 | 83 | :action => action) |
|
52 | 84 | end |
|
53 | 85 | |
|
54 | 86 | def format_short_time(time) |
|
55 | 87 | now = Time.now.gmtime |
|
56 | 88 | st = '' |
|
57 | 89 | if (time.yday != now.yday) or |
|
58 | 90 | (time.year != now.year) |
|
59 | 91 | st = time.strftime("%x ") |
|
60 | 92 | end |
|
61 | 93 | st + time.strftime("%X") |
|
62 | 94 | end |
|
63 | 95 | |
|
64 | 96 | def format_short_duration(duration) |
|
65 | 97 | return '' if duration==nil |
|
66 | 98 | d = duration.to_f |
|
67 | 99 | return Time.at(d).gmtime.strftime("%X") |
|
68 | 100 | end |
|
69 | 101 | |
|
70 | 102 | def read_textfile(fname,max_size=2048) |
|
71 | 103 | begin |
|
72 | 104 | File.open(fname).read(max_size) |
|
73 | 105 | rescue |
|
74 | 106 | nil |
|
75 | 107 | end |
|
76 | 108 | end |
|
77 | 109 | |
|
78 | 110 | def user_title_bar(user) |
|
79 | 111 | header = '' |
|
80 | 112 | time_left = '' |
|
81 | 113 | |
|
82 | 114 | # |
|
83 | 115 | # if the contest is over |
|
84 | 116 | if GraderConfiguration.time_limit_mode? |
|
85 | 117 | if user.contest_finished? |
|
86 | 118 | header = <<CONTEST_OVER |
|
87 | 119 | <tr><td colspan="2" align="center"> |
|
88 | 120 | <span class="contest-over-msg">THE CONTEST IS OVER</span> |
|
89 | 121 | </td></tr> |
|
90 | 122 | CONTEST_OVER |
|
91 | 123 | end |
|
92 | 124 | if !user.contest_started? |
|
93 | 125 | time_left = " " + (t 'title_bar.contest_not_started') |
|
94 | 126 | else |
|
95 | 127 | time_left = " " + (t 'title_bar.remaining_time') + |
|
96 | 128 | " #{format_short_duration(user.contest_time_left)}" |
|
97 | 129 | end |
|
98 | 130 | end |
|
99 | 131 |
@@ -1,18 +1,30 | |||
|
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 | - | |
|
13 | - %div.userbar | |
|
14 | - = user_header | |
|
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 | |
|
15 | 24 | |
|
16 | - = content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil | |
|
17 | - = yield | |
|
25 | + %div.userbar | |
|
26 | + = user_header | |
|
18 | 27 | |
|
28 | + = content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil | |
|
29 | + = yield | |
|
30 | + |
@@ -1,74 +1,25 | |||
|
1 | 1 | CafeGrader::Application.routes.draw do |
|
2 | + root :to => 'main#login' | |
|
3 | + | |
|
2 | 4 | get "report/login" |
|
3 | 5 | |
|
4 | 6 | resources :contests |
|
5 | 7 | |
|
6 | 8 | resources :announcements |
|
7 | 9 | resources :sites |
|
8 | 10 | |
|
9 | 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 | 13 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
65 | 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 | 20 | # See how all your routes lay out with "rake routes" |
|
70 | 21 | |
|
71 | 22 | # This is a legacy wild controller route that's not recommended for RESTful applications. |
|
72 | 23 | # Note: This route will make all actions in every controller accessible via GET requests. |
|
73 | 24 | match ':controller(/:action(/:id))(.:format)' |
|
74 | 25 | end |
You need to be logged in to leave comments.
Login now