Description:
clean up layouts
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@49 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
r25:e58005f0efd2 - - 11 files changed: 51 inserted, 67 deleted
@@ -0,0 +1,15 | |||||
|
|
1 | + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
|
|
2 | + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
|
|
3 | + | ||
|
|
4 | + <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
|
|
5 | + <head> | ||
|
|
6 | + <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> | ||
|
|
7 | + <title>Grader!</title> | ||
|
|
8 | + <%= stylesheet_link_tag 'application' %> | ||
|
|
9 | + </head> | ||
|
|
10 | + <body> | ||
|
|
11 | + | ||
|
|
12 | + <%= yield %> | ||
|
|
13 | + | ||
|
|
14 | + </body> | ||
|
|
15 | + </html> |
@@ -1,43 +1,42 | |||||
|
1 | class MainController < ApplicationController |
|
1 | class MainController < ApplicationController |
|
2 |
|
2 | ||
|
3 | before_filter :authenticate, :except => [:index, :login] |
|
3 | before_filter :authenticate, :except => [:index, :login] |
|
4 |
|
4 | ||
|
5 | verify :method => :post, :only => [:submit], |
|
5 | verify :method => :post, :only => [:submit], |
|
6 | :redirect_to => { :action => :index } |
|
6 | :redirect_to => { :action => :index } |
|
7 |
|
7 | ||
|
8 |
|
8 | ||
|
9 | def index |
|
9 | def index |
|
10 | redirect_to :action => 'login' |
|
10 | redirect_to :action => 'login' |
|
11 | end |
|
11 | end |
|
12 |
|
12 | ||
|
13 | def login |
|
13 | def login |
|
14 |
- MainController.layout ' |
|
14 | + MainController.layout 'empty' |
|
15 | reset_session |
|
15 | reset_session |
|
16 | end |
|
16 | end |
|
17 |
|
17 | ||
|
18 | def list |
|
18 | def list |
|
19 | - MainController.layout 'application' |
|
||
|
20 | @problems = Problem.find_available_problems |
|
19 | @problems = Problem.find_available_problems |
|
21 | @prob_submissions = Array.new |
|
20 | @prob_submissions = Array.new |
|
22 | @user = User.find(session[:user_id]) |
|
21 | @user = User.find(session[:user_id]) |
|
23 | @problems.each do |p| |
|
22 | @problems.each do |p| |
|
24 | c, sub = Submission.find_by_user_and_problem(@user.id,p.id) |
|
23 | c, sub = Submission.find_by_user_and_problem(@user.id,p.id) |
|
25 | @prob_submissions << [c,sub] |
|
24 | @prob_submissions << [c,sub] |
|
26 | end |
|
25 | end |
|
27 | end |
|
26 | end |
|
28 |
|
27 | ||
|
29 | def submit |
|
28 | def submit |
|
30 | submission = Submission.new(params[:submission]) |
|
29 | submission = Submission.new(params[:submission]) |
|
31 | submission.user_id = session[:user_id] |
|
30 | submission.user_id = session[:user_id] |
|
32 | submission.language_id = 0 |
|
31 | submission.language_id = 0 |
|
33 | source = params['file'].read |
|
32 | source = params['file'].read |
|
34 | if source.length > 100_000 |
|
33 | if source.length > 100_000 |
|
35 | flash[:notice] = 'Error: file too long' |
|
34 | flash[:notice] = 'Error: file too long' |
|
36 | elsif (lang = Submission.find_language_in_source(source))==nil |
|
35 | elsif (lang = Submission.find_language_in_source(source))==nil |
|
37 | flash[:notice] = 'Error: cannot determine language used' |
|
36 | flash[:notice] = 'Error: cannot determine language used' |
|
38 | elsif ((submission.problem_id==-1) and |
|
37 | elsif ((submission.problem_id==-1) and |
|
39 | !(problem=Submission.find_problem_in_source(source))) |
|
38 | !(problem=Submission.find_problem_in_source(source))) |
|
40 | flash[:notice] = 'Error: cannot determine problem submitted' |
|
39 | flash[:notice] = 'Error: cannot determine problem submitted' |
|
41 | elsif ((submission.problem_id==-1) and |
|
40 | elsif ((submission.problem_id==-1) and |
|
42 | (problem.available == false)) |
|
41 | (problem.available == false)) |
|
43 | flash[:notice] = 'Error: problem is not available' |
|
42 | flash[:notice] = 'Error: problem is not available' |
@@ -1,24 +1,35 | |||||
|
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 | options = '' |
|
5 | options = '' |
|
6 | user = User.find(session[:user_id]) |
|
6 | user = User.find(session[:user_id]) |
|
7 | - if user.admin? |
|
7 | + |
|
8 | - options = options + ' ' + |
|
8 | + # main page |
|
9 | - (link_to_unless_current '[Problem admin]', |
|
||
|
10 | - :controller => 'problems', :action => 'index') |
|
||
|
11 | - options = options + ' ' + |
|
||
|
12 | - (link_to_unless_current '[User admin]', |
|
||
|
13 | - :controller => 'user_admin', :action => 'index') |
|
||
|
14 | - end |
|
||
|
15 | options += link_to_unless_current '[Main]', |
|
9 | options += link_to_unless_current '[Main]', |
|
16 | :controller => 'main', :action => 'list' |
|
10 | :controller => 'main', :action => 'list' |
|
|
11 | + options += ' ' | ||
|
|
12 | + | ||
|
|
13 | + # admin menu | ||
|
|
14 | + if user.admin? | ||
|
|
15 | + options += | ||
|
|
16 | + (link_to_unless_current '[Problem admin]', | ||
|
|
17 | + :controller => 'problems', :action => 'index') + ' ' | ||
|
|
18 | + options += | ||
|
|
19 | + (link_to_unless_current '[User admin]', | ||
|
|
20 | + :controller => 'user_admin', :action => 'index') + ' ' | ||
|
|
21 | + options += | ||
|
|
22 | + (link_to_unless_current '[User stat]', | ||
|
|
23 | + :controller => 'user_admin', :action => 'user_stat') + ' ' | ||
|
|
24 | + end | ||
|
|
25 | + | ||
|
|
26 | + # general options | ||
|
17 | options += link_to_unless_current '[Settings]', |
|
27 | options += link_to_unless_current '[Settings]', |
|
18 | :controller => 'users', :action => 'index' |
|
28 | :controller => 'users', :action => 'index' |
|
19 |
- options = |
|
29 | + options += ' ' |
|
|
30 | + options += | ||
|
20 | link_to('[Log out]', {:controller => 'main', :action => 'login'}) |
|
31 | link_to('[Log out]', {:controller => 'main', :action => 'login'}) |
|
21 | options |
|
32 | options |
|
22 | end |
|
33 | end |
|
23 |
|
34 | ||
|
24 | end |
|
35 | end |
@@ -1,22 +1,22 | |||||
|
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|
2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
|
3 | ||
|
4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
5 | <head> |
|
5 | <head> |
|
6 | <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> |
|
6 | <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> |
|
7 | <title>Grader!</title> |
|
7 | <title>Grader!</title> |
|
8 | <%= stylesheet_link_tag 'application' %> |
|
8 | <%= stylesheet_link_tag 'application' %> |
|
9 | - <%= javascript_include_tag :defaults %> |
|
9 | + <%= yield :head %> |
|
10 | </head> |
|
10 | </head> |
|
11 | <body> |
|
11 | <body> |
|
12 |
|
12 | ||
|
13 | <div class="userbar"> |
|
13 | <div class="userbar"> |
|
14 | <%= user_header %> |
|
14 | <%= user_header %> |
|
15 | </div> |
|
15 | </div> |
|
16 |
|
16 | ||
|
17 | <p style="color: green"><%= flash[:notice] %></p> |
|
17 | <p style="color: green"><%= flash[:notice] %></p> |
|
18 |
|
18 | ||
|
19 | <%= yield %> |
|
19 | <%= yield %> |
|
20 |
|
20 | ||
|
21 | </body> |
|
21 | </body> |
|
22 | </html> |
|
22 | </html> |
@@ -1,24 +1,29 | |||||
|
|
1 | + <% content_for :head do %> | ||
|
|
2 | + <%= stylesheet_link_tag 'scaffold' %> | ||
|
|
3 | + <%= javascript_include_tag :defaults %> | ||
|
|
4 | + <% end %> | ||
|
|
5 | + | ||
|
1 | <h1>Listing problems</h1> |
|
6 | <h1>Listing problems</h1> |
|
2 |
|
7 | ||
|
3 | <div class="usermenu"> |
|
8 | <div class="usermenu"> |
|
4 | <%= link_to 'Main', :controller => 'main', :action => 'list' %> |
|
9 | <%= link_to 'Main', :controller => 'main', :action => 'list' %> |
|
5 | </div> |
|
10 | </div> |
|
6 |
|
11 | ||
|
7 | <table> |
|
12 | <table> |
|
8 | <tr> |
|
13 | <tr> |
|
9 | <th>Name</th> |
|
14 | <th>Name</th> |
|
10 | <th>Full name</th> |
|
15 | <th>Full name</th> |
|
11 | <th>Full score</th> |
|
16 | <th>Full score</th> |
|
12 | <th>Date added</th> |
|
17 | <th>Date added</th> |
|
13 | <th>Available</th> |
|
18 | <th>Available</th> |
|
14 | </tr> |
|
19 | </tr> |
|
15 |
|
20 | ||
|
16 | <% for problem in @problems %> |
|
21 | <% for problem in @problems %> |
|
17 | <tr> |
|
22 | <tr> |
|
18 | <% @problem=problem %> |
|
23 | <% @problem=problem %> |
|
19 | <td><%= in_place_editor_field :problem, :name, {}, :rows=>1 %> |
|
24 | <td><%= in_place_editor_field :problem, :name, {}, :rows=>1 %> |
|
20 | <td><%= in_place_editor_field :problem, :full_name, {}, :rows=>1 %> |
|
25 | <td><%= in_place_editor_field :problem, :full_name, {}, :rows=>1 %> |
|
21 | <td><%= in_place_editor_field :problem, :full_score, {}, :rows=>1 %> |
|
26 | <td><%= in_place_editor_field :problem, :full_score, {}, :rows=>1 %> |
|
22 | <td><%= problem.date_added %> |
|
27 | <td><%= problem.date_added %> |
|
23 | <td><%= problem.available %> |
|
28 | <td><%= problem.available %> |
|
24 |
|
29 |
@@ -1,30 +1,29 | |||||
|
1 | - <h1>Listing users</h1> |
|
1 | + <% content_for :head do %> |
|
|
2 | + <%= stylesheet_link_tag 'scaffold' %> | ||
|
|
3 | + <% end %> | ||
|
2 |
|
4 | ||
|
3 | - <div class="usermenu"> |
|
5 | + <h1>Listing users</h1> |
|
4 | - <%= link_to 'Stat', :action => 'user_stat' %> |
|
||
|
5 | - <%= link_to 'Main', :controller => 'main', :action => 'list' %> |
|
||
|
6 | - </div> |
|
||
|
7 |
|
6 | ||
|
8 | <div style="border: solid 1px; margin: 2px"> |
|
7 | <div style="border: solid 1px; margin: 2px"> |
|
9 | <b>Quick add</b> |
|
8 | <b>Quick add</b> |
|
10 | <% form_tag :action => 'create' do %> |
|
9 | <% form_tag :action => 'create' do %> |
|
11 | <table border="0"> |
|
10 | <table border="0"> |
|
12 | <tr> |
|
11 | <tr> |
|
13 | <td><label for="user_name">Login</label></td> |
|
12 | <td><label for="user_name">Login</label></td> |
|
14 | <td><label for="user_name">Full name</label></td> |
|
13 | <td><label for="user_name">Full name</label></td> |
|
15 | <td><label for="user_alias">Alias</label></td> |
|
14 | <td><label for="user_alias">Alias</label></td> |
|
16 | <td><label for="password">Password</label></td> |
|
15 | <td><label for="password">Password</label></td> |
|
17 | <td><label for="password_confirmation">confirm</label></td> |
|
16 | <td><label for="password_confirmation">confirm</label></td> |
|
18 | </tr> |
|
17 | </tr> |
|
19 | <tr> |
|
18 | <tr> |
|
20 | <td><%= text_field 'user', 'login', :size => 10 %></td> |
|
19 | <td><%= text_field 'user', 'login', :size => 10 %></td> |
|
21 | <td><%= text_field 'user', 'full_name', :size => 30 %></td> |
|
20 | <td><%= text_field 'user', 'full_name', :size => 30 %></td> |
|
22 | <td><%= text_field 'user', 'alias', :size => 10 %></td> |
|
21 | <td><%= text_field 'user', 'alias', :size => 10 %></td> |
|
23 | <td><%= password_field 'user', 'password', :size => 10 %></td> |
|
22 | <td><%= password_field 'user', 'password', :size => 10 %></td> |
|
24 | <td><%= password_field 'user', 'password_confirmation', :size => 10 %></td> |
|
23 | <td><%= password_field 'user', 'password_confirmation', :size => 10 %></td> |
|
25 | <td><%= submit_tag "Create" %></td> |
|
24 | <td><%= submit_tag "Create" %></td> |
|
26 | </tr></table> |
|
25 | </tr></table> |
|
27 | <% end %> |
|
26 | <% end %> |
|
28 |
|
27 | ||
|
29 | </div> |
|
28 | </div> |
|
30 |
|
29 |
@@ -1,8 +1,10 | |||||
|
|
1 | + <h1>User information</h1> | ||
|
|
2 | + | ||
|
1 | <% for column in User.content_columns %> |
|
3 | <% for column in User.content_columns %> |
|
2 | <p> |
|
4 | <p> |
|
3 | <b><%= column.human_name %>:</b> <%=h @user.send(column.name) %> |
|
5 | <b><%= column.human_name %>:</b> <%=h @user.send(column.name) %> |
|
4 | </p> |
|
6 | </p> |
|
5 | <% end %> |
|
7 | <% end %> |
|
6 |
|
8 | ||
|
7 | <%= link_to 'Edit', :action => 'edit', :id => @user %> | |
|
9 | <%= link_to 'Edit', :action => 'edit', :id => @user %> | |
|
8 | <%= link_to 'Back', :action => 'list' %> |
|
10 | <%= link_to 'Back', :action => 'list' %> |
@@ -1,24 +1,27 | |||||
|
|
1 | + | ||
|
|
2 | + - content_for :head do | ||
|
|
3 | + = javascript_include_tag :defaults | ||
|
1 |
|
4 | ||
|
2 | %h1 Your account settings |
|
5 | %h1 Your account settings |
|
3 |
|
6 | ||
|
4 | %p |
|
7 | %p |
|
5 | You can edit your alias and e-mails. Just click on the text and edit it. |
|
8 | You can edit your alias and e-mails. Just click on the text and edit it. |
|
6 |
|
9 | ||
|
7 |
|
10 | ||
|
8 | %table.uinfo |
|
11 | %table.uinfo |
|
9 | %tr |
|
12 | %tr |
|
10 | %th.uinfo Login |
|
13 | %th.uinfo Login |
|
11 | %td.uinfo= @user.login |
|
14 | %td.uinfo= @user.login |
|
12 | %tr |
|
15 | %tr |
|
13 | %th.uinfo Full name |
|
16 | %th.uinfo Full name |
|
14 | %td.uinfo= @user.full_name |
|
17 | %td.uinfo= @user.full_name |
|
15 | %tr |
|
18 | %tr |
|
16 | %th.uinfo Alias |
|
19 | %th.uinfo Alias |
|
17 | %td.uinfo= in_place_editor_field :user, 'alias_for_editing', {}, :rows => 1 |
|
20 | %td.uinfo= in_place_editor_field :user, 'alias_for_editing', {}, :rows => 1 |
|
18 | %tr |
|
21 | %tr |
|
19 | %th.uinfo E-mail |
|
22 | %th.uinfo E-mail |
|
20 | %td.uinfo= in_place_editor_field :user, 'email_for_editing', {}, :rows => 1 |
|
23 | %td.uinfo= in_place_editor_field :user, 'email_for_editing', {}, :rows => 1 |
|
21 | %tr |
|
24 | %tr |
|
22 | %th.uinfo Password |
|
25 | %th.uinfo Password |
|
23 | %td.uinfo |
|
26 | %td.uinfo |
|
24 | - form_tag :action => 'chg_passwd', :method => 'post' do |
|
27 | - form_tag :action => 'chg_passwd', :method => 'post' do |
deleted file |
deleted file |
deleted file |
You need to be logged in to leave comments.
Login now