add new member with role interface. add more not usable.

role management new attribute is ok. delete is ok.
This commit is contained in:
Matthew K. Fu JuYuan authored and chris committed 2012-11-04 20:42:58 +08:00
1 parent fe0e49c3e9
commit beb843f75b
25 files changed
+1159 -512

No files matched your search

+8 -7
View File
@@ -1,10 +1,11 @@
class Admin::InfosController < ApplicationController
layout "admin"
layout "new_admin"
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
helper Admin::AttributeValuesViewHelper
def index
@attributes = Info.all.entries
render :template => 'admin/attributes/index'
@@ -32,8 +33,8 @@ class Admin::InfosController < ApplicationController
def update
@attribute = Info.find(params[:id])
# binding.pry
@attribute.update_attributes(params[:info])
@attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true}
respond_to do |format|
format.html { redirect_to :action => :index }
format.js { render 'admin/attributes/toggle_enable' }
@@ -47,10 +48,10 @@ class Admin::InfosController < ApplicationController
end
def add_attribute_field
@attribute = Info.find(params[:id]) rescue nil
if !@attribute
@attribute = Info.new
end
attribute = Info.find(params[:info_id]) rescue nil
@attribute_field_counter = attribute.attribute_fields.count
@attribute_field = attribute.attribute_fields.build
@attribute_field.save
end
protected
@@ -75,7 +75,6 @@ class Admin::UsersNewInterfaceController < ApplicationController
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)
@@ -84,6 +83,7 @@ class Admin::UsersNewInterfaceController < ApplicationController
# @user.attribute_values.build(value)
# }
# @user.rebuild_sub_roles_from_attribute_values!(attribute_values)
binding.pry
if @user.save
flash[:notice] = t('admin.create_success_user')
redirect_to :action => :index