Fix bug: users can now be saved

This commit is contained in:
chris2tof committed 2011-11-12 17:54:45 +08:00
1 parent 0a6efeb0a2
commit d9d7099da6
7 files changed
+26 -18

No files matched your search

@@ -6,9 +6,9 @@
<td><%= attr.i18n_variable[I18n.locale] %></td>
<td>
<% if attr["locale"] && attr["markup"] == 'text_field' %>
<%= show_user_attribute["#{attr.key}_#{I18n.locale}"] rescue nil %>
<%= show_user_attribute(object, attr.key, I18n.locale) %>
<% else %>
<%= show_user_attribute["#{attr.key}"] rescue nil %>
<%= show_user_attribute(object, attr.key) %>
<% end %>
</td>
</tr>
@@ -14,23 +14,23 @@
<% ua.get_enabled_attribute_models.each do |attr| %>
<% value = user_attribute.attribute_values.detect{|v| v.key == attr.key } %>
<%= hidden_field_tag "user[user_#{type}s][][attributes][][id]", value.id rescue nil %>
<%= hidden_field_tag "user[user_#{type}s][][attributes][][key]", attr.key %>
<%= hidden_field_tag "user[user_#{type}s][][attribute_values][][id]", value.id rescue nil %>
<%= hidden_field_tag "user[user_#{type}s][][attribute_values][][key]", attr.key %>
<tr>
<td><%= attr.i18n_variable[I18n.locale] %></td>
<% if attr["locale"] && attr["markup"] == 'text_field' %>
<%= hidden_field_tag "user[user_#{type}s][][attributes][][non_locale]", nil %>
<%= hidden_field_tag "user[user_#{type}s][][attribute_values][][non_locale]", nil %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= text_field_tag "user[user_#{type}s][][attributes][][#{locale}]", (value[locale] rescue nil) %>
<%= text_field_tag "user[user_#{type}s][][attribute_values][][#{locale}]", (value[locale] rescue nil) %>
</td>
<% end -%>
<% else %>
<td colspan=<%= @site_valid_locales.size %>>
<% if attr["markup"] == "text_field" %>
<%= text_field_tag "user[user_#{type}s][][attributes][][non_locale]", (value['non_locale'] rescue nil) %>
<%= text_field_tag "user[user_#{type}s][][attribute_values][][non_locale]", (value['non_locale'] rescue nil) %>
<% elsif attr["markup"] == "select" %>
<%= select_tag "user[user_#{type}s][][attributes][][non_locale]", options_for_select(attr["options"], value['non_locale']) %>
<%= select_tag "user[user_#{type}s][][attribute_values][][non_locale]", options_for_select(attr["options"], value['non_locale']) %>
<% end -%>
</td>
<% end -%>
+2 -6
View File
@@ -14,9 +14,7 @@
<fieldset>
<legend><%= t('panel.infos') %></legend>
<% @user_info_models.each do |am| %>
<%= render :partial => 'show_user_attribute',
:object => @user.get_info_from_model_key(am.key),
:locals => {:am => am} %>
<%= render :partial => 'show_user_attribute', :locals => {:am => am, :object => @user.get_info_from_model_key(am.key)} %>
<% end -%>
</fieldset>
<% end %>
@@ -25,9 +23,7 @@
<fieldset>
<legend><%= t('panel.roles') %></legend>
<% @user.get_active_role_models.each do |am| %>
<%= render :partial => 'show_user_attribute',
:object => @user.get_role_from_model_key(am.key),
:locals => {:am => am} %>
<%= render :partial => 'show_user_attribute', :locals => {:am => am, :object => @user.get_role_from_model_key(am.key)} %>
<% end -%>
</fieldset>
<% end %>