Changes for sub_roles

Issues: update doesn't create new i18n_variables, role form has bugs
This commit is contained in:
chris2tof committed 2011-12-18 10:07:42 +08:00
1 parent d23cf152da
commit d27d7a623c
62 files changed
+508 -1142

No files matched your search

+2 -2
View File
@@ -1,7 +1,7 @@
module Admin::UserHelper
def show_user_attribute(object, key, locale = '')
attribute = object.attribute_values.detect {|av| av.key.to_s.eql?(key.to_s) || av[locale.to_s].eql?(locale.to_s) } rescue nil
def show_attribute(object, field_id, locale = '')
attribute = object.attribute_values.detect {|av| av.attribute_field_id.eql?(field_id) || av[locale.to_s].eql?(locale.to_s) } rescue nil
if attribute
if locale.to_s.blank?
attribute['key']
+7
View File
@@ -48,5 +48,12 @@ module ApplicationHelper
message % item
end
end
def add_attribute(partial, f, attribute)
new_object = f.object.send(attribute).build
fields = f.fields_for(attribute, new_object, :child_index => "new_#{attribute}") do |f|
render :partial => partial, :object => new_object, :locals => {:f => f}
end
end
end