Description:
enable user settings, remove APIO header
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@277 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r138:0f4011aaed34 - - 4 files changed: 7 inserted, 6 deleted
@@ -71,25 +71,25 | |||
|
71 | 71 | |
|
72 | 72 | def user_stat |
|
73 | 73 | @problems = Problem.find_available_problems |
|
74 | 74 | @users = User.find(:all) |
|
75 | 75 | @scorearray = Array.new |
|
76 | 76 | @users.each do |u| |
|
77 | 77 | ustat = Array.new |
|
78 | 78 | ustat[0] = u.login |
|
79 | 79 | ustat[1] = u.full_name |
|
80 | 80 | @problems.each do |p| |
|
81 | 81 | sub = Submission.find_last_by_user_and_problem(u.id,p.id) |
|
82 | 82 | if (sub!=nil) and (sub.points!=nil) |
|
83 | - ustat << [sub.points, (sub.points>=p.full_score)] | |
|
83 | + ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] | |
|
84 | 84 | else |
|
85 | 85 | ustat << [0,false] |
|
86 | 86 | end |
|
87 | 87 | end |
|
88 | 88 | @scorearray << ustat |
|
89 | 89 | end |
|
90 | 90 | end |
|
91 | 91 | |
|
92 | 92 | def import |
|
93 | 93 | if params[:file]=='' |
|
94 | 94 | flash[:notice] = 'Error importing no file' |
|
95 | 95 | redirect_to :action => 'list' and return |
@@ -1,26 +1,27 | |||
|
1 | 1 | class UsersController < ApplicationController |
|
2 | 2 | |
|
3 | 3 | before_filter :authenticate |
|
4 | 4 | |
|
5 | 5 | verify :method => :post, :only => [:chg_passwd], |
|
6 | 6 | :redirect_to => { :action => :index } |
|
7 | 7 | |
|
8 | 8 | in_place_edit_for :user, :alias_for_editing |
|
9 | 9 | in_place_edit_for :user, :email_for_editing |
|
10 | 10 | |
|
11 | 11 | def index |
|
12 | - # ... disable in this contest ... | |
|
13 | - # @user = User.find(session[:user_id]) | |
|
14 | - redirect_to :controller => 'main', :action => 'list' | |
|
12 | + # uncomment below to disable settings | |
|
13 | + #redirect_to :controller => 'main', :action => 'list' | |
|
14 | + | |
|
15 | + @user = User.find(session[:user_id]) | |
|
15 | 16 | end |
|
16 | 17 | |
|
17 | 18 | def chg_passwd |
|
18 | 19 | user = User.find(session[:user_id]) |
|
19 | 20 | user.password = params[:passwd] |
|
20 | 21 | user.password_confirmation = params[:passwd_verify] |
|
21 | 22 | if user.save |
|
22 | 23 | flash[:notice] = 'password changed' |
|
23 | 24 | else |
|
24 | 25 | flash[:notice] = 'Error: password changing failed' |
|
25 | 26 | end |
|
26 | 27 | redirect_to :action => 'index' |
@@ -21,25 +21,25 | |||
|
21 | 21 | end |
|
22 | 22 | |
|
23 | 23 | # main page |
|
24 | 24 | append_to menu_items, '[Main]', 'main', 'list' |
|
25 | 25 | append_to menu_items, '[Messages]', 'messages', 'list' |
|
26 | 26 | |
|
27 | 27 | if (user!=nil) and (Configuration.show_tasks_to?(user)) |
|
28 | 28 | append_to menu_items, '[Tasks]', 'tasks', 'list' |
|
29 | 29 | append_to menu_items, '[Submissions]', 'main', 'submission' |
|
30 | 30 | append_to menu_items, '[Test]', 'test', 'index' |
|
31 | 31 | end |
|
32 | 32 | append_to menu_items, '[Help]', 'main', 'help' |
|
33 |
- |
|
|
33 | + append_to menu_items, '[Settings]', 'users', 'index' | |
|
34 | 34 | append_to menu_items, '[Log out]', 'main', 'login' |
|
35 | 35 | |
|
36 | 36 | menu_items |
|
37 | 37 | end |
|
38 | 38 | |
|
39 | 39 | def append_to(option,label, controller, action) |
|
40 | 40 | option << ' ' if option!='' |
|
41 | 41 | option << link_to_unless_current(label, |
|
42 | 42 | :controller => controller, |
|
43 | 43 | :action => action) |
|
44 | 44 | end |
|
45 | 45 |
@@ -1,19 +1,19 | |||
|
1 | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|
2 | 2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 | 3 | |
|
4 | 4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
5 | 5 | <head> |
|
6 | 6 | <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> |
|
7 |
- <title> |
|
|
7 | + <title>Grader</title> | |
|
8 | 8 | <%= stylesheet_link_tag 'application' %> |
|
9 | 9 | <%= yield :head %> |
|
10 | 10 | </head> |
|
11 | 11 | <body> |
|
12 | 12 | |
|
13 | 13 | <div class="userbar"> |
|
14 | 14 | <%= user_header %> |
|
15 | 15 | </div> |
|
16 | 16 | |
|
17 | 17 | <%= content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil %> |
|
18 | 18 | |
|
19 | 19 | <%= yield %> |
You need to be logged in to leave comments.
Login now