User Rollenhinzufügen - erster Versuch

This commit is contained in:
Andreas Stephanides
2013-08-13 19:22:53 +02:00
parent d988c22e29
commit ea967240a5
3 changed files with 9 additions and 4 deletions

View File

@@ -2,4 +2,8 @@ class UsersController < ApplicationController
def index
@users = User.all
end
def add_role
@user.find(params[:id])
@user.add_role(params[:role])
end
end

View File

@@ -4,13 +4,13 @@
</li>
</ul>
<table class="table table-striped">
<% @users.each do |user|%>
<% @users.each do |user|%>
<tr><th>Name</th><th>E-Mail</th><th>Rollen</th>
</tr><tr><td></td>
<td>
<td>
<%= user.email %></td><td><ul>
<% user.roles.each do |role| %>
<li><%= role.name%></li>
<% end %></ul></td>
<% end %></ul></td><td><%= link_to 'MK FETUSER', user_add_role_path(user, "fetadmin")%></td>
</tr><% end %>
</table>

View File

@@ -4,7 +4,8 @@
resources :home, :only=>[:index]
#get 'home',:controller=>home,:action=>:index,:as=>"home_index"
scope '(:locale)/admin' do
resources :users
resources :users, :only => [:index]
get 'users/:id/add_role/:role', :controller=>:users, :action=>:add_role, :as=>'user_add_role'
get 'config',:controller=>:config,:action=>:index , :as => 'config'
get 'config/get_git_update',:controller=>:config,:action=>:get_git_update, :as=>'config_getgitupdate'
get 'config/get_git_update',:controller=>:config,:action=>:get_git_update