for user new interface, member role is working.
This commit is contained in:
1 parent
b301f6522a
commit
bd0d975014
15 files changed
+312
-90
No files matched your search
@@ -43,18 +43,6 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||
@profile_data.push({:name => att_val.attribute_field.title,:value =>att_val.get_value_by_locale(I18n.locale)}) if att_val.attribute_field.attribute.key=="profile" rescue false
|
||||
}
|
||||
|
||||
attribute_values.each{|att_val|
|
||||
@teacher_data.push({:name => att_val.attribute_field.title,:value => att_val.get_value_by_locale(I18n.locale) }) if att_val.attribute_field.role.key=="teacher"rescue false
|
||||
}
|
||||
|
||||
attribute_values.each{|att_val|
|
||||
@student_data.push({:name => att_val.attribute_field.title,:value => att_val.get_value_by_locale(I18n.locale) }) if att_val.attribute_field.role.key=="student"rescue false
|
||||
}
|
||||
|
||||
attribute_values.each{|att_val|
|
||||
@staff_data.push({:name => att_val.attribute_field.title,:value => att_val.get_value_by_locale(I18n.locale) }) if att_val.attribute_field.role.key=="staff_data"rescue false
|
||||
}
|
||||
|
||||
|
||||
if(!params[:show_plugin_profile].nil?)
|
||||
@right_partial = OrbitApp::Plugin::Registration.find_by_key(params[:show_plugin_profile]).profile_partial_path rescue 'plugin_summary'
|
||||
@@ -81,20 +69,21 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||
|
||||
def new
|
||||
@user = User.new
|
||||
@disable_all_field = true
|
||||
# @disable_all_field = true
|
||||
@form_index = 0
|
||||
get_info_and_roles
|
||||
end
|
||||
|
||||
def create
|
||||
binding.pry
|
||||
puts params.to_yaml
|
||||
attribute_values_key = params[:user].has_key?('new_attribute_values') ? 'new_attribute_values' : 'attribute_values'
|
||||
attribute_values = params[:user].delete(attribute_values_key)
|
||||
# attribute_values_key = params[:user].has_key?('new_attribute_values') ? 'new_attribute_values' : 'attribute_values'
|
||||
# attribute_values = params[:user].delete(attribute_values_key)
|
||||
@user = User.new(params["user"])
|
||||
attribute_values.to_hash.each{|key,value|
|
||||
@user.attribute_values.build(value)
|
||||
}
|
||||
@user.rebuild_sub_roles_from_attribute_values!(attribute_values)
|
||||
# attribute_values.to_hash.each{|key,value|
|
||||
# @user.attribute_values.build(value)
|
||||
# }
|
||||
# @user.rebuild_sub_roles_from_attribute_values!(attribute_values)
|
||||
if @user.save
|
||||
flash[:notice] = t('admin.create_success_user')
|
||||
redirect_to :action => :index
|
||||
@@ -111,7 +100,7 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||
end
|
||||
|
||||
def edit
|
||||
@disable_all_field = false
|
||||
# @disable_all_field = false
|
||||
@user = User.find(params[:id])
|
||||
@form_index = 0
|
||||
get_info_and_roles
|
||||
@@ -122,7 +111,7 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||
@user.update_attributes(params[:user])
|
||||
attribute_values_key = params[:user].has_key?('new_attribute_values') ? 'new_attribute_values' : 'attribute_values'
|
||||
attribute_values = params[:user].delete(attribute_values_key)
|
||||
@user.rebuild_sub_roles_from_attribute_values!(attribute_values)
|
||||
# @user.rebuild_sub_roles_from_attribute_values!(attribute_values)
|
||||
@user.save
|
||||
redirect_to :action => :show
|
||||
# # Update changes to the avatar
|
||||
|
||||
Reference in new issue
Block a user