Modifications of the user model

This commit is contained in:
chris2tof committed 2011-04-28 22:47:34 +08:00
1 parent 1909edbe2a
commit 509c106b3e
7 files changed
+64 -19

No files matched your search

@@ -13,20 +13,24 @@
</tr>
<% ua.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 %>
<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 %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= text_field_tag "user[user_#{type}s][][#{attr.key}_#{locale}]", (user_attribute["#{attr.key}_#{locale}"] rescue nil) %>
<%= text_field_tag "user[user_#{type}s][][attributes][][#{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][][#{attr.key}]", (user_attribute[attr.key] rescue nil) %>
<%= text_field_tag "user[user_#{type}s][][attributes][][non_locale]", (value['non_locale'] rescue nil) %>
<% elsif attr["markup"] == "select" %>
<%= select_tag "user[user_#{type}s][][#{attr.key}]", options_for_select(attr["options"], user_attribute[attr.key]) %>
<%= select_tag "user[user_#{type}s][][attributes][][non_locale]", options_for_select(attr["options"], value['non_locale']) %>
<% end -%>
</td>
<% end -%>