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,3 +1,19 | |||||
|
|
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 |
@@ -11,12 +27,16 | |||||
|
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 |
@@ -1,6 +1,38 | |||||
|
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]) |
@@ -9,10 +9,22 | |||||
|
9 | = yield :head |
|
9 | = yield :head |
|
10 |
|
10 | ||
|
11 | %body |
|
11 | %body |
|
12 | - |
|
12 | + %nav.navbar.navbar-default.navbar-fixed-top |
|
13 | - %div.userbar |
|
13 | + .container-fluid |
|
14 | - = user_header |
|
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 |
|
25 | + %div.userbar |
|
17 | - = yield |
|
26 | + = user_header |
|
18 |
|
27 | ||
|
|
28 | + = content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil | ||
|
|
29 | + = yield | ||
|
|
30 | + |
@@ -1,4 +1,6 | |||||
|
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 |
@@ -8,63 +10,12 | |||||
|
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 |
You need to be logged in to leave comments.
Login now