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