[noosfero/noosfero][master] 3 commits: Update schema to add profile_id on role table
Rodrigo Souto
gitlab at gitlab.com
Tue May 12 10:04:01 BRT 2015
Rodrigo Souto pushed to branch master at Noosfero / noosfero
Commits:
248c0b7e by Gabriela Navarro at 2015-05-12T12:47:43Z
Update schema to add profile_id on role table
Signed-off-by: Arthur Del Esposte <arthurmde at gmail.com>
Signed-off-by: Gabriela Navarro <navarro1703 at gmail.com>
- - - - -
b084242c by Gabriela Navarro at 2015-05-12T12:49:15Z
Fix profile custom roles management
Signed-off-by: Arthur Del Esposte <arthurmde at gmail.com>
Signed-off-by: Gabriela Navarro <navarro1703 at gmail.com>
- - - - -
9a6bf3c2 by Rodrigo Souto at 2015-05-12T13:03:52Z
Merge branch 'fix_custom_roles_management' into 'master'
Fix custom roles management
This patch updates the schema to add profile_id on roles table and fix the broken custom role creation and task management.
See merge request !570
- - - - -
3 changed files:
- app/controllers/my_profile/profile_roles_controller.rb
- app/views/tasks/_add_member_accept_details.html.erb
- db/schema.rb
Changes:
=====================================
app/controllers/my_profile/profile_roles_controller.rb
=====================================
--- a/app/controllers/my_profile/profile_roles_controller.rb
+++ b/app/controllers/my_profile/profile_roles_controller.rb
@@ -11,8 +11,9 @@ class ProfileRolesController < MyProfileController
end
def create
- @role = Role.create({:name => params[:role][:name], :permissions => params[:role][:permissions], :profile_id => profile.id, :environment => environment }, :without_protection => true)
+ @role = Role.new({:name => params[:role][:name], :permissions => params[:role][:permissions], :environment => environment }, :without_protection => true)
if @role.save
+ profile.custom_roles << @role
redirect_to :action => 'show', :id => @role
else
session[:notice] = _('Failed to create role')
=====================================
app/views/tasks/_add_member_accept_details.html.erb
=====================================
--- a/app/views/tasks/_add_member_accept_details.html.erb
+++ b/app/views/tasks/_add_member_accept_details.html.erb
@@ -1,5 +1,5 @@
<%= content = _("Roles:")+"<br />"
-roles = Profile::Roles.organization_all_roles(task.target.environment.id)
+roles = Profile::Roles.organization_member_roles(task.target.environment.id) + profile.custom_roles
roles.each do |role|
content += labelled_check_box(role.name, "tasks[#{task.id}][task][roles][]", role.id, false)+"<br />"
end
=====================================
db/schema.rb
=====================================
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -593,6 +593,7 @@ ActiveRecord::Schema.define(:version => 20150408231524) do
t.boolean "system", :default => false
t.text "permissions"
t.integer "environment_id"
+ t.integer "profile_id"
end
create_table "scraps", :force => true do |t|
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/524399582fdb8d1aefd50c1648d477eff74d0129...9a6bf3c266b72fbbd99d82896e3e37529d5db5c2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150512/af6e1f78/attachment.html>
More information about the Noosfero-dev
mailing list