Description:
[web] better ui for announcement and prob stat
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@195 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
r103:c7b351b3b685 - - 3 files changed: 6 inserted, 2 deleted
@@ -5,13 +5,14 | |||
|
5 | 5 | |
|
6 | 6 | in_place_edit_for :announcement, :published |
|
7 | 7 | |
|
8 | 8 | # GET /announcements |
|
9 | 9 | # GET /announcements.xml |
|
10 | 10 | def index |
|
11 |
- @announcements = Announcement.find(:all |
|
|
11 | + @announcements = Announcement.find(:all, | |
|
12 | + :order => "created_at DESC") | |
|
12 | 13 | |
|
13 | 14 | respond_to do |format| |
|
14 | 15 | format.html # index.html.erb |
|
15 | 16 | format.xml { render :xml => @announcements } |
|
16 | 17 | end |
|
17 | 18 | end |
@@ -27,13 +27,14 | |||
|
27 | 27 | # need to put in SQL command, maybe there's a better way |
|
28 | 28 | Submission.find_by_sql("SELECT * FROM submissions " + |
|
29 | 29 | "WHERE id = " + |
|
30 | 30 | "(SELECT MAX(id) FROM submissions AS subs " + |
|
31 | 31 | "WHERE subs.user_id = submissions.user_id AND " + |
|
32 | 32 | "problem_id = " + problem_id.to_s + " " + |
|
33 |
- "GROUP BY user_id)" |
|
|
33 | + "GROUP BY user_id) " + | |
|
34 | + "ORDER BY user_id") | |
|
34 | 35 | end |
|
35 | 36 | |
|
36 | 37 | def self.find_last_for_all_available_problems(user_id) |
|
37 | 38 | submissions = Array.new |
|
38 | 39 | problems = Problem.find_available_problems |
|
39 | 40 | problems.each do |problem| |
@@ -2,12 +2,14 | |||
|
2 | 2 | <%= stylesheet_link_tag 'scaffold' %> |
|
3 | 3 | <%= javascript_include_tag :defaults %> |
|
4 | 4 | <% end %> |
|
5 | 5 | |
|
6 | 6 | <h1>Listing announcements</h1> |
|
7 | 7 | |
|
8 | + <%= link_to 'New announcement', new_announcement_path %> | |
|
9 | + | |
|
8 | 10 | <table> |
|
9 | 11 | <tr> |
|
10 | 12 | <th>Body</th> |
|
11 | 13 | <th>Author</th> |
|
12 | 14 | <th>Published</th> |
|
13 | 15 | </tr> |
You need to be logged in to leave comments.
Login now