Description:
add options for bulk manage add user to group (not finished)
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r671:52ce712479a1 - - 2 files changed: 17 inserted, 0 deleted
@@ -225,12 +225,13 | |||
|
225 | 225 | user.save |
|
226 | 226 | end |
|
227 | 227 | @changed = true |
|
228 | 228 | end |
|
229 | 229 | end |
|
230 | 230 | |
|
231 | + | |
|
231 | 232 | # contest management |
|
232 | 233 | |
|
233 | 234 | def contests |
|
234 | 235 | @contest, @users = find_contest_and_user_from_contest_id(params[:id]) |
|
235 | 236 | @contests = Contest.enabled |
|
236 | 237 | end |
@@ -420,12 +421,14 | |||
|
420 | 421 | |
|
421 | 422 | if params[:commit] |
|
422 | 423 | @action = {} |
|
423 | 424 | @action[:set_enable] = params[:enabled] |
|
424 | 425 | @action[:enabled] = params[:enable] == "1" |
|
425 | 426 | @action[:gen_password] = params[:gen_password] |
|
427 | + @action[:add_group] = params[:add_group] | |
|
428 | + @action[:group_name] = params[:group_name] | |
|
426 | 429 | end |
|
427 | 430 | |
|
428 | 431 | if params[:commit] == "Perform" |
|
429 | 432 | if @action[:set_enable] |
|
430 | 433 | @users.update_all(enabled: @action[:enabled]) |
|
431 | 434 | end |
@@ -434,12 +437,17 | |||
|
434 | 437 | password = random_password |
|
435 | 438 | u.password = password |
|
436 | 439 | u.password_confirmation = password |
|
437 | 440 | u.save |
|
438 | 441 | end |
|
439 | 442 | end |
|
443 | + if @action[:add_group] | |
|
444 | + @uses.each do |u| | |
|
445 | + | |
|
446 | + end | |
|
447 | + end | |
|
440 | 448 | end |
|
441 | 449 | end |
|
442 | 450 | |
|
443 | 451 | protected |
|
444 | 452 | |
|
445 | 453 | def random_password(length=5) |
@@ -43,12 +43,21 | |||
|
43 | 43 | No |
|
44 | 44 | .row.form-group |
|
45 | 45 | .col-md-6 |
|
46 | 46 | %label.checkbox-inline |
|
47 | 47 | = check_box_tag "gen_password", true, params[:gen_password] |
|
48 | 48 | Generate new random password |
|
49 | + .row.form-group | |
|
50 | + .col-md-4 | |
|
51 | + %label.checkbox-inline | |
|
52 | + = check_box_tag "add_group", true, params[:add_group] | |
|
53 | + Add users to group | |
|
54 | + %label.col-md-3.control-label.text-right Group name | |
|
55 | + .col-md-5 | |
|
56 | + = text_field_tag "group_name", params[:group_name], id: 'group_name',class: 'form-control select2' | |
|
57 | + | |
|
49 | 58 | |
|
50 | 59 | .row |
|
51 | 60 | .col-md-12 |
|
52 | 61 | = submit_tag "Preview Result", class: 'btn btn-default' |
|
53 | 62 | - if @users |
|
54 | 63 | .row |
You need to be logged in to leave comments.
Login now