Description:
[web] small styling, split out admin's menu, put config into table.info git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@157 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r77:0d98996d26c3 - - 3 files changed: 15 inserted, 16 deleted

@@ -1,49 +1,46
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 user_header
4 def user_header
5 menu_items = ''
5 menu_items = ''
6 user = User.find(session[:user_id])
6 user = User.find(session[:user_id])
7
7
8 + if (user!=nil) and (user.admin?)
9 + # admin menu
10 + menu_items << "<b>Administrative task:</b> "
11 + append_to menu_items, '[Problem admin]', 'problems', 'index'
12 + append_to menu_items, '[User admin]', 'user_admin', 'index'
13 + append_to menu_items, '[User stat]', 'user_admin', 'user_stat'
14 + #append_to menu_items, '[Graders]', 'graders', 'list'
15 + append_to menu_items, '[Site config]', 'configurations', 'index'
16 + menu_items << "<br/>"
17 + end
18 +
8 # main page
19 # main page
9 append_to menu_items, '[Main]', 'main', 'list'
20 append_to menu_items, '[Main]', 'main', 'list'
10 append_to menu_items, '[Submissions]', 'main', 'submission'
21 append_to menu_items, '[Submissions]', 'main', 'submission'
11 append_to menu_items, '[Test]', 'test', 'index'
22 append_to menu_items, '[Test]', 'test', 'index'
12 -
13 - # admin menu
14 - if (user!=nil) and (user.admin?)
15 - append_to menu_items, '[Problem admin]', 'problems', 'index'
16 - append_to menu_items, '[User admin]', 'user_admin', 'index'
17 - append_to menu_items, '[User stat]', 'user_admin', 'user_stat'
18 - end
19 -
20 - # general options
21 append_to menu_items, '[Settings]', 'users', 'index'
23 append_to menu_items, '[Settings]', 'users', 'index'
22 -
23 - if (user!=nil) and (user.admin?)
24 - append_to menu_items, '[Site config]', 'configurations', 'index'
25 - end
26 -
27 append_to menu_items, '[Log out]', 'main', 'login'
24 append_to menu_items, '[Log out]', 'main', 'login'
28
25
29 menu_items
26 menu_items
30 end
27 end
31
28
32 def append_to(option,label, controller, action)
29 def append_to(option,label, controller, action)
33 option << ' ' if option!=''
30 option << ' ' if option!=''
34 option << link_to_unless_current(label,
31 option << link_to_unless_current(label,
35 :controller => controller,
32 :controller => controller,
36 :action => action)
33 :action => action)
37 end
34 end
38
35
39 def format_short_time(time)
36 def format_short_time(time)
40 now = Time.now
37 now = Time.now
41 st = ''
38 st = ''
42 if (time.yday != now.yday) or
39 if (time.yday != now.yday) or
43 (time.year != now.year)
40 (time.year != now.year)
44 st = time.strftime("%x ")
41 st = time.strftime("%x ")
45 end
42 end
46 st + time.strftime("%X")
43 st + time.strftime("%X")
47 end
44 end
48
45
49 end
46 end
@@ -1,26 +1,26
1 - content_for :head do
1 - content_for :head do
2 = javascript_include_tag :defaults
2 = javascript_include_tag :defaults
3
3
4 %h1 Grader configuration
4 %h1 Grader configuration
5
5
6 - %table
6 + %table.info
7 - %tr
7 + %tr.info-head
8 %th Key
8 %th Key
9 %th Type
9 %th Type
10 %th Value
10 %th Value
11
11
12 - @configurations.each do |conf|
12 - @configurations.each do |conf|
13 - @configuration = conf
13 - @configuration = conf
14 %tr
14 %tr
15 %td
15 %td
16 = in_place_editor_field :configuration, :key, {}, :rows=>1
16 = in_place_editor_field :configuration, :key, {}, :rows=>1
17 %td
17 %td
18 = in_place_editor_field :configuration, :value_type, {}, :rows=>1
18 = in_place_editor_field :configuration, :value_type, {}, :rows=>1
19 %td
19 %td
20 = in_place_editor_field :configuration, :value, {}, :rows=>1
20 = in_place_editor_field :configuration, :value, {}, :rows=>1
21
21
22 %br/
22 %br/
23 = link_to '[Reload configuration]', :action => 'reload'
23 = link_to '[Reload configuration]', :action => 'reload'
24 %br/
24 %br/
25 Your config is saved, but it does not automatically take effect.
25 Your config is saved, but it does not automatically take effect.
26 You must reload.
26 You must reload.
@@ -1,10 +1,12
1 - content_for :head do
1 - content_for :head do
2 = stylesheet_link_tag 'graders'
2 = stylesheet_link_tag 'graders'
3
3
4 + %h2 (Under Experiments)
5 +
4 %h3 Current graders
6 %h3 Current graders
5
7
6 = render :partial => 'grader_list', :locals => {:grader_list => @grader_processes}
8 = render :partial => 'grader_list', :locals => {:grader_list => @grader_processes}
7
9
8 %h3 Stalled graders
10 %h3 Stalled graders
9
11
10 = render :partial => 'grader_list', :locals => {:grader_list => @stalled_processes}
12 = render :partial => 'grader_list', :locals => {:grader_list => @stalled_processes}
You need to be logged in to leave comments. Login now