Commit 377d910bc1bb9e08e573ad590b7a87b9556976e2
Committed by
Gust
1 parent
d0561132
Exists in
master
and in
28 other branches
ban_user: Creating ban button and ban method in user controller
(ActionItemAI3021) Signed-off-by: David Carlos <ddavidcarlos1392@gmail.com> Signed-off-by: Eduardo Vital <vitaldu@gmail.com>
Showing
2 changed files
with
12 additions
and
2 deletions
Show diff stats
app/controllers/admin/users_controller.rb
| ... | ... | @@ -45,6 +45,15 @@ class UsersController < AdminController |
| 45 | 45 | redirect_to :action => :index, :q => params[:q], :filter => params[:filter] |
| 46 | 46 | end |
| 47 | 47 | |
| 48 | + | |
| 49 | + def destroy_user() | |
| 50 | + person = environment.people.find(params[:id]) | |
| 51 | + person.destroy | |
| 52 | + session[:notice] = _('The profile was deleted.') | |
| 53 | + redirect_to :action => :index, :q => params[:q], :filter => params[:filter] | |
| 54 | + end | |
| 55 | + | |
| 56 | + | |
| 48 | 57 | def download |
| 49 | 58 | respond_to do |format| |
| 50 | 59 | format.html |
| ... | ... | @@ -86,7 +95,7 @@ class UsersController < AdminController |
| 86 | 95 | end |
| 87 | 96 | end |
| 88 | 97 | |
| 89 | - private | |
| 98 | + private | |
| 90 | 99 | |
| 91 | 100 | def per_page |
| 92 | 101 | 10 | ... | ... |
app/views/users/_users_list.rhtml
| ... | ... | @@ -28,7 +28,8 @@ |
| 28 | 28 | <% else %> |
| 29 | 29 | <%= button_without_text :'deactivate-user', _('Deactivate user'), :action => 'deactivate', :id => p, :q => @q, :filter => @filter %> |
| 30 | 30 | <% end %> |
| 31 | - </div> | |
| 31 | + <%= button_without_text :'ban-user', _('Ban User'), :action => 'destroy_user', :id => p, :q => @q, :filter => @filter %> | |
| 32 | + </div> | |
| 32 | 33 | </td> |
| 33 | 34 | </tr> |
| 34 | 35 | <% end %> | ... | ... |