Description:
assigns users to a unique contest, small styling on contest title
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r281:ddf493b045db - - 4 files changed: 37 inserted, 27 deleted
@@ -175,45 +175,47 | |||
|
175 | 175 | def contest_management |
|
176 | 176 | end |
|
177 | 177 | |
|
178 | 178 | def manage_contest |
|
179 | 179 | contest = Contest.find(params[:contest][:id]) |
|
180 | 180 | if !contest |
|
181 | 181 | flash[:notice] = 'You did not choose the contest.' |
|
182 | 182 | redirect_to :action => 'contest_management' and return |
|
183 | 183 | end |
|
184 | 184 | |
|
185 | 185 | operation = params[:operation] |
|
186 | 186 | |
|
187 | - if operation!='add' and operation!='remove' | |
|
187 | + if not ['add','remove','assign'].include? operation | |
|
188 | 188 | flash[:notice] = 'You did not choose the operation to perform.' |
|
189 | 189 | redirect_to :action => 'contest_management' and return |
|
190 | 190 | end |
|
191 | 191 | |
|
192 | 192 | lines = params[:login_list] |
|
193 | 193 | if !lines or lines.blank? |
|
194 | 194 | flash[:notice] = 'You entered an empty list.' |
|
195 | 195 | redirect_to :action => 'contest_management' and return |
|
196 | 196 | end |
|
197 | 197 | |
|
198 | 198 | note = [] |
|
199 | 199 | lines.split("\n").each do |line| |
|
200 | 200 | puts line |
|
201 | 201 | user = User.find_by_login(line.chomp) |
|
202 | 202 | puts user |
|
203 | 203 | if user |
|
204 | 204 | if operation=='add' |
|
205 | 205 | user.contests << contest |
|
206 | + elsif operation=='remove' | |
|
207 | + user.contests.delete(contest) | |
|
206 | 208 | else |
|
207 |
- user.contests |
|
|
209 | + user.contests = [contest] | |
|
208 | 210 | end |
|
209 | 211 | note << user.login |
|
210 | 212 | end |
|
211 | 213 | end |
|
212 | 214 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
213 | 215 | ' were successfully modified. ' |
|
214 | 216 | redirect_to :action => 'contest_management' |
|
215 | 217 | end |
|
216 | 218 | |
|
217 | 219 | # admin management |
|
218 | 220 | |
|
219 | 221 | def admin |
@@ -1,16 +1,16 | |||
|
1 | 1 | %h1 Bulk edit users in contests |
|
2 | 2 | |
|
3 | 3 | - form_tag :action => 'manage_contest' do |
|
4 | 4 | List users' login below; one per line. |
|
5 | 5 | %br/ |
|
6 | 6 | = text_area_tag 'login_list', nil, :rows => 25, :cols => 80 |
|
7 | 7 | %br/ |
|
8 | 8 | You want to |
|
9 | - = select(nil,"operation",[['add users to','add'],['remove users from','remove']]) | |
|
9 | + = select(nil,"operation",[['assign users to','assign'],['add users to','add'],['remove users from','remove']]) | |
|
10 | 10 | contest |
|
11 | 11 | = select("contest","id",Contest.all.collect {|c| [c.title, c.id]}) |
|
12 | 12 | |
|
13 | 13 | = submit_tag "Perform action", :confirm => 'Are you sure?' |
|
14 | 14 | |
|
15 | 15 | %hr/ |
|
16 | 16 | = link_to '[go back to index]', :action => 'index' |
@@ -151,51 +151,52 | |||
|
151 | 151 | font-size: 14px; |
|
152 | 152 | line-height: 1.5em; |
|
153 | 153 | text-align: center; } |
|
154 | 154 | table.taskdesc td.desc-odd { |
|
155 | 155 | padding: 5px; |
|
156 | 156 | padding-left: 20px; |
|
157 | 157 | background: #fefeee; } |
|
158 | 158 | table.taskdesc td.desc-even { |
|
159 | 159 | padding: 5px; |
|
160 | 160 | padding-left: 20px; |
|
161 | 161 | background: #feeefe; } |
|
162 | 162 | |
|
163 |
- |
|
|
163 | + .announcementbox { | |
|
164 | 164 | margin: 10px 0px; |
|
165 | 165 | background: #bbddee; |
|
166 | 166 | padding: 1px; } |
|
167 |
- |
|
|
167 | + .announcementbox span.title { | |
|
168 | 168 | font-weight: bold; |
|
169 | 169 | color: #224455; |
|
170 | 170 | padding-left: 10px; |
|
171 | 171 | line-height: 1.6em; } |
|
172 | - div.announcement { | |
|
172 | + | |
|
173 | + .announcement { | |
|
173 | 174 | margin: 2px; |
|
174 | 175 | background: white; |
|
175 | 176 | padding: 1px; |
|
176 | 177 | padding-left: 10px; |
|
177 | 178 | padding-right: 10px; |
|
178 | 179 | padding-top: 5px; |
|
179 | 180 | padding-bottom: 5px; } |
|
180 | 181 | |
|
181 | 182 | .announcement p { |
|
182 | 183 | font-size: 12px; |
|
183 | 184 | margin: 2px; } |
|
184 | 185 | |
|
185 |
- |
|
|
186 | + .pub-info { | |
|
186 | 187 | text-align: right; |
|
187 | 188 | font-style: italic; |
|
188 | 189 | font-size: 9px; } |
|
189 |
- |
|
|
190 | + .pub-info p { | |
|
190 | 191 | text-align: right; |
|
191 | 192 | font-style: italic; |
|
192 | 193 | font-size: 9px; } |
|
193 | 194 | |
|
194 | 195 | .announcement .toggles { |
|
195 | 196 | font-weight: normal; |
|
196 | 197 | float: right; |
|
197 | 198 | font-size: 80%; } |
|
198 | 199 | .announcement .announcement-title { |
|
199 | 200 | font-weight: bold; } |
|
200 | 201 | |
|
201 | 202 | div.message { |
@@ -226,12 +227,16 | |||
|
226 | 227 | font-weight: bold; } |
|
227 | 228 | div.contest-title { |
|
228 | 229 | color: white; |
|
229 | 230 | text-align: center; |
|
230 | 231 | line-height: 2em; } |
|
231 | 232 | div.registration-desc, div.test-desc { |
|
232 | 233 | border: 1px dotted gray; |
|
233 | 234 | background: #f5f5f5; |
|
234 | 235 | padding: 5px; |
|
235 | 236 | margin: 10px 0; |
|
236 | 237 | font-size: 12px; |
|
237 | 238 | line-height: 1.5em; } |
|
239 | + | |
|
240 | + h2.contest-title { | |
|
241 | + margin-top: 5px; | |
|
242 | + margin-bottom: 5px; } |
@@ -185,52 +185,51 | |||
|
185 | 185 | td |
|
186 | 186 | &.desc-odd |
|
187 | 187 | padding: 5px |
|
188 | 188 | padding-left: 20px |
|
189 | 189 | background: #fefeee |
|
190 | 190 | |
|
191 | 191 | &.desc-even |
|
192 | 192 | padding: 5px |
|
193 | 193 | padding-left: 20px |
|
194 | 194 | background: #feeefe |
|
195 | 195 | |
|
196 | 196 | |
|
197 | - div | |
|
198 | - &.announcementbox | |
|
199 | - margin: 10px 0px | |
|
200 | - background: #bbddee | |
|
201 | - padding: 1px | |
|
197 | + .announcementbox | |
|
198 | + margin: 10px 0px | |
|
199 | + background: #bbddee | |
|
200 | + padding: 1px | |
|
202 | 201 | |
|
203 |
- |
|
|
204 |
- |
|
|
205 |
- |
|
|
206 |
- |
|
|
207 |
- |
|
|
202 | + span.title | |
|
203 | + font-weight: bold | |
|
204 | + color: #224455 | |
|
205 | + padding-left: 10px | |
|
206 | + line-height: 1.6em | |
|
208 | 207 | |
|
209 |
- |
|
|
210 |
- |
|
|
211 |
- |
|
|
212 |
- |
|
|
213 |
- |
|
|
214 |
- |
|
|
215 |
- |
|
|
216 |
- |
|
|
208 | + .announcement | |
|
209 | + margin: 2px | |
|
210 | + background: white | |
|
211 | + padding: 1px | |
|
212 | + padding-left: 10px | |
|
213 | + padding-right: 10px | |
|
214 | + padding-top: 5px | |
|
215 | + padding-bottom: 5px | |
|
217 | 216 | |
|
218 | 217 | |
|
219 | 218 | .announcement p |
|
220 | 219 | font-size: 12px |
|
221 | 220 | margin: 2px |
|
222 | 221 | |
|
223 | 222 | |
|
224 |
- |
|
|
223 | + .pub-info | |
|
225 | 224 | text-align: right |
|
226 | 225 | font-style: italic |
|
227 | 226 | font-size: 9px |
|
228 | 227 | |
|
229 | 228 | p |
|
230 | 229 | text-align: right |
|
231 | 230 | font-style: italic |
|
232 | 231 | font-size: 9px |
|
233 | 232 | |
|
234 | 233 | |
|
235 | 234 | .announcement |
|
236 | 235 | .toggles |
@@ -279,12 +278,16 | |||
|
279 | 278 | &.contest-title |
|
280 | 279 | color: white |
|
281 | 280 | text-align: center |
|
282 | 281 | line-height: 2em |
|
283 | 282 | |
|
284 | 283 | &.registration-desc, &.test-desc |
|
285 | 284 | border: 1px dotted gray |
|
286 | 285 | background: #f5f5f5 |
|
287 | 286 | padding: 5px |
|
288 | 287 | margin: 10px 0 |
|
289 | 288 | font-size: 12px |
|
290 | 289 | line-height: 1.5em |
|
290 | + | |
|
291 | + h2.contest-title | |
|
292 | + margin-top: 5px | |
|
293 | + margin-bottom: 5px No newline at end of file |
You need to be logged in to leave comments.
Login now