Description:
better announcement effects git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@413 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

r193:e9aaeb17b5bc - - 7 files changed: 58 inserted, 17 deleted

@@ -0,0 +1,9
1 + class AddTitleToAnnouncements < ActiveRecord::Migration
2 + def self.up
3 + add_column :announcements, :title, :string
4 + end
5 +
6 + def self.down
7 + remove_column :announcements, :title
8 + end
9 + end
@@ -1,37 +1,42
1 1 <h1>Editing announcement</h1>
2 2
3 3 <%= error_messages_for :announcement %>
4 4
5 5 <% form_for(@announcement) do |f| %>
6 6 <p>
7 + <b>Title</b><br />
8 + <%= f.text_field :title %>
9 + </p>
10 +
11 + <p>
7 12 <b>Body</b><br />
8 13 <%= f.text_area :body %>
9 14 </p>
10 15
11 16 <p>
12 17 <b>Author</b><br />
13 18 <%= f.text_field :author %>
14 19 </p>
15 20
16 21 <p>
17 22 <b>Published</b><br />
18 23 <%= f.check_box :published %>
19 24 </p>
20 25
21 26 <p>
22 27 <b>Show on front page?</b><br />
23 28 <%= f.check_box :frontpage %>
24 29 </p>
25 30
26 31 <p>
27 32 <b>Show only in contest?</b><br />
28 33 <%= f.check_box :contest_only %>
29 34 </p>
30 35
31 36 <p>
32 37 <%= f.submit "Update" %>
33 38 </p>
34 39 <% end %>
35 40
36 41 <%= link_to 'Show', @announcement %> |
37 42 <%= link_to 'Back', announcements_path %>
@@ -1,31 +1,33
1 1 <% content_for :head do %>
2 2 <%= javascript_include_tag :defaults %>
3 3 <% end %>
4 4
5 5 <h1>Listing announcements</h1>
6 6
7 7 <%= link_to 'New announcement', new_announcement_path %>
8 8
9 9 <table>
10 10 <tr>
11 + <th>Title</th>
11 12 <th>Body</th>
12 13 <th>Author</th>
13 14 <th>Published</th>
14 15 </tr>
15 16
16 17 <% for announcement in @announcements %>
17 18 <tr>
18 19 <% @announcement = announcement %>
20 + <td><%=h announcement.title %></td>
19 21 <td><%=h announcement.body %></td>
20 22 <td><%=h announcement.author %></td>
21 23 <td><%= in_place_editor_field :announcement, :published, {}, :rows => 1 %></td>
22 24 <td><%= link_to 'Show', announcement %></td>
23 25 <td><%= link_to 'Edit', edit_announcement_path(announcement) %></td>
24 26 <td><%= link_to 'Destroy', announcement, :confirm => 'Are you sure?', :method => :delete %></td>
25 27 </tr>
26 28 <% end %>
27 29 </table>
28 30
29 31 <br />
30 32
31 33 <%= link_to 'New announcement', new_announcement_path %>
@@ -1,36 +1,41
1 1 <h1>New announcement</h1>
2 2
3 3 <%= error_messages_for :announcement %>
4 4
5 5 <% form_for(@announcement) do |f| %>
6 6 <p>
7 + <b>Title</b><br />
8 + <%= f.text_field :title %>
9 + </p>
10 +
11 + <p>
7 12 <b>Body</b><br />
8 13 <%= f.text_area :body %>
9 14 </p>
10 15
11 16 <p>
12 17 <b>Author</b><br />
13 18 <%= f.text_field :author %>
14 19 </p>
15 20
16 21 <p>
17 22 <b>Published</b><br />
18 23 <%= f.check_box :published %>
19 24 </p>
20 25
21 26 <p>
22 27 <b>Show on front page?</b><br />
23 28 <%= f.check_box :frontpage %>
24 29 </p>
25 30
26 31 <p>
27 32 <b>Show only in contest?</b><br />
28 33 <%= f.check_box :contest_only %>
29 34 </p>
30 35
31 36 <p>
32 37 <%= f.submit "Create" %>
33 38 </p>
34 39 <% end %>
35 40
36 41 <%= link_to 'Back', announcements_path %>
@@ -1,27 +1,32
1 1 <p>
2 2 <b>Author:</b>
3 3 <%=h @announcement.author %>
4 4 </p>
5 5
6 6 <p>
7 + <b>Title:</b>
8 + <%=h @announcement.title %>
9 + </p>
10 +
11 + <p>
7 12 <b>Body:</b>
8 13 <%=h @announcement.body %>
9 14 </p>
10 15
11 16 <p>
12 17 <b>Published:</b>
13 18 <%=h @announcement.published %>
14 19 </p>
15 20
16 21 <p>
17 22 <b>Show on front page:</b>
18 23 <%=h @announcement.frontpage %>
19 24 </p>
20 25
21 26 <p>
22 27 <b>Show only in contest:</b>
23 28 <%=h @announcement.contest_only %>
24 29 </p>
25 30
26 31 <%= link_to 'Edit', edit_announcement_path(@announcement) %> |
27 32 <%= link_to 'Back', announcements_path %>
@@ -1,17 +1,19
1 - .announcement{:id => "announcement-#{announcement.id}", :style => "#{'opacity: 0;' if (defined? announcement_effect) and announcement_effect }"}
2 - -# .announcement-title
3 - -# .toggles
4 - -# %a{:href => '#', :onclick => "$(\"announcement-body-#{announcement.id}\").hide(); return false;"}
5 - -# [hide]
6 - -# %a{:href => '#', :onclick => "$(\"announcement-body-#{announcement.id}\").show(); return false;"}
7 - -# [show]
8 - -# Announcement Title
9 - .announcement-body{:id => "announcement-body-#{announcement.id}"}
10 - = markdown(announcement.body)
11 - -#.pub-info
12 - -# %p= "#{announcement.author}, #{announcement.created_at}"
13 - :javascript
14 - Announcement.updateRecentId(#{announcement.id});
15 - - if (defined? announcement_effect) and announcement_effect
1 + .announcement{:id => "announcement-#{announcement.id}", :style => "#{'display: none; opacity: 0' if (defined? announcement_effect) and announcement_effect }"}
2 + %div
3 + .announcement-title
4 + -# .toggles
5 + -# %a{:href => '#', :onclick => "$(\"announcement-body-#{announcement.id}\").blindUp({duration: 0.2}); return false;"}
6 + -# [hide]
7 + -# %a{:href => '#', :onclick => "$(\"announcement-body-#{announcement.id}\").blindDown({duration: 0.2}); return false;"}
8 + -# [show]
9 + = announcement.title
10 + .announcement-body{:id => "announcement-body-#{announcement.id}"}
11 + = markdown(announcement.body)
12 + -#.pub-info
13 + -# %p= "#{announcement.author}, #{announcement.created_at}"
16 14 :javascript
17 - $("announcement-#{announcement.id}").appear();
15 + Announcement.updateRecentId(#{announcement.id});
16 + - if (defined? announcement_effect) and announcement_effect
17 + :javascript
18 + $("announcement-#{announcement.id}").blindDown({duration: 0.2});
19 + $("announcement-#{announcement.id}").appear({duration: 0.5, queue: 'end'});
@@ -1,195 +1,208
1 1 # This file is auto-generated from the current state of the database. Instead of editing this file,
2 2 # please use the migrations feature of Active Record to incrementally modify your database, and
3 3 # then regenerate this schema definition.
4 4 #
5 5 # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6 6 # to create the application database on another system, you should be using db:schema:load, not running
7 7 # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8 8 # you'll amass, the slower it'll run and the greater likelihood for issues).
9 9 #
10 10 # It's strongly recommended to check this file into your version control system.
11 11
12 - ActiveRecord::Schema.define(:version => 20090426131044) do
12 + ActiveRecord::Schema.define(:version => 20090815171610) do
13 13
14 14 create_table "announcements", :force => true do |t|
15 15 t.string "author"
16 16 t.text "body"
17 17 t.boolean "published"
18 18 t.datetime "created_at"
19 19 t.datetime "updated_at"
20 20 t.boolean "frontpage", :default => false
21 21 t.boolean "contest_only", :default => false
22 + t.string "title"
22 23 end
23 24
24 25 create_table "configurations", :force => true do |t|
25 26 t.string "key"
26 27 t.string "value_type"
27 28 t.string "value"
28 29 t.datetime "created_at"
29 30 t.datetime "updated_at"
30 31 end
31 32
32 33 create_table "countries", :force => true do |t|
33 34 t.string "name"
34 35 t.datetime "created_at"
35 36 t.datetime "updated_at"
36 37 end
37 38
38 39 create_table "descriptions", :force => true do |t|
39 40 t.text "body"
40 41 t.boolean "markdowned"
41 42 t.datetime "created_at"
42 43 t.datetime "updated_at"
43 44 end
44 45
46 + create_table "grader_messages", :force => true do |t|
47 + t.integer "grader_process_id"
48 + t.integer "command"
49 + t.string "options"
50 + t.integer "target_id"
51 + t.boolean "accepted"
52 + t.boolean "completed"
53 + t.integer "accepting_grader_process_id"
54 + t.datetime "created_at"
55 + t.datetime "updated_at"
56 + end
57 +
45 58 create_table "grader_processes", :force => true do |t|
46 59 t.string "host", :limit => 20
47 60 t.integer "pid"
48 61 t.string "mode"
49 62 t.boolean "active"
50 63 t.datetime "created_at"
51 64 t.datetime "updated_at"
52 65 t.integer "task_id"
53 66 t.string "task_type"
54 67 t.boolean "terminated"
55 68 end
56 69
57 70 add_index "grader_processes", ["host", "pid"], :name => "index_grader_processes_on_ip_and_pid"
58 71
59 72 create_table "languages", :force => true do |t|
60 73 t.string "name", :limit => 10
61 74 t.string "pretty_name"
62 75 t.string "ext", :limit => 10
63 76 t.string "common_ext"
64 77 end
65 78
66 79 create_table "messages", :force => true do |t|
67 80 t.integer "sender_id"
68 81 t.integer "receiver_id"
69 82 t.integer "replying_message_id"
70 83 t.text "body"
71 84 t.boolean "replied"
72 85 t.datetime "created_at"
73 86 t.datetime "updated_at"
74 87 end
75 88
76 89 create_table "problems", :force => true do |t|
77 90 t.string "name", :limit => 30
78 91 t.string "full_name"
79 92 t.integer "full_score"
80 93 t.date "date_added"
81 94 t.boolean "available"
82 95 t.string "url"
83 96 t.integer "description_id"
84 97 t.boolean "test_allowed"
85 98 t.boolean "output_only"
86 99 end
87 100
88 101 create_table "rights", :force => true do |t|
89 102 t.string "name"
90 103 t.string "controller"
91 104 t.string "action"
92 105 end
93 106
94 107 create_table "rights_roles", :id => false, :force => true do |t|
95 108 t.integer "right_id"
96 109 t.integer "role_id"
97 110 end
98 111
99 112 add_index "rights_roles", ["role_id"], :name => "index_rights_roles_on_role_id"
100 113
101 114 create_table "roles", :force => true do |t|
102 115 t.string "name"
103 116 end
104 117
105 118 create_table "roles_users", :id => false, :force => true do |t|
106 119 t.integer "role_id"
107 120 t.integer "user_id"
108 121 end
109 122
110 123 add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id"
111 124
112 125 create_table "sessions", :force => true do |t|
113 126 t.string "session_id"
114 127 t.text "data"
115 128 t.datetime "updated_at"
116 129 end
117 130
118 131 add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
119 132 add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
120 133
121 134 create_table "sites", :force => true do |t|
122 135 t.string "name"
123 136 t.boolean "started"
124 137 t.datetime "start_time"
125 138 t.datetime "created_at"
126 139 t.datetime "updated_at"
127 140 t.integer "country_id"
128 141 t.string "password"
129 142 end
130 143
131 144 create_table "submissions", :force => true do |t|
132 145 t.integer "user_id"
133 146 t.integer "problem_id"
134 147 t.integer "language_id"
135 148 t.text "source"
136 149 t.binary "binary"
137 150 t.datetime "submitted_at"
138 151 t.datetime "compiled_at"
139 152 t.text "compiler_message"
140 153 t.datetime "graded_at"
141 154 t.integer "points"
142 155 t.text "grader_comment"
143 156 t.integer "number"
144 157 t.string "source_filename"
145 158 end
146 159
147 160 add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true
148 161 add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id"
149 162
150 163 create_table "tasks", :force => true do |t|
151 164 t.integer "submission_id"
152 165 t.datetime "created_at"
153 166 t.integer "status"
154 167 t.datetime "updated_at"
155 168 end
156 169
157 170 create_table "test_requests", :force => true do |t|
158 171 t.integer "user_id"
159 172 t.integer "problem_id"
160 173 t.integer "submission_id"
161 174 t.string "input_file_name"
162 175 t.string "output_file_name"
163 176 t.string "running_stat"
164 177 t.integer "status"
165 178 t.datetime "updated_at"
166 179 t.datetime "submitted_at"
167 180 t.datetime "compiled_at"
168 181 t.text "compiler_message"
169 182 t.datetime "graded_at"
170 183 t.string "grader_comment"
171 184 t.datetime "created_at"
172 185 t.float "running_time"
173 186 t.string "exit_status"
174 187 t.integer "memory_usage"
175 188 end
176 189
177 190 add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id"
178 191
179 192 create_table "users", :force => true do |t|
180 193 t.string "login", :limit => 50
181 194 t.string "full_name"
182 195 t.string "hashed_password"
183 196 t.string "salt", :limit => 5
184 197 t.string "alias"
185 198 t.string "email"
186 199 t.integer "site_id"
187 200 t.integer "country_id"
188 201 t.boolean "activated", :default => false
189 202 t.datetime "created_at"
190 203 t.datetime "updated_at"
191 204 end
192 205
193 206 add_index "users", ["login"], :name => "index_users_on_login", :unique => true
194 207
195 208 end
You need to be logged in to leave comments. Login now