45 lines
2.0 KiB
Plaintext
45 lines
2.0 KiB
Plaintext
<%= fields_for "user[user_#{type}s]", user_attribute, :index => nil do |f| %>
|
|
<%= f.hidden_field :key, :value => ua.key %>
|
|
<%= f.hidden_field :id unless user_attribute.new_record? %>
|
|
|
|
<div class="info_input">
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
<thead class="list_head">
|
|
<tr>
|
|
<td><%= t("admin.key") %></td>
|
|
<% @site_valid_locales.each do |locale| %>
|
|
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
|
<% end %>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% 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][][attribute_values][][id]", value.id rescue nil %>
|
|
<%= hidden_field_tag "user[user_#{type}s][][attribute_values][][key]", attr.key %>
|
|
<tr class="list_item">
|
|
<td><%= attr.i18n_variable[I18n.locale] %></td>
|
|
<% if attr["locale"] && attr["markup"] == 'text_field' %>
|
|
<%= 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][][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][][attribute_values][][non_locale]", (value['non_locale'] rescue nil) %>
|
|
<% elsif attr["markup"] == "select" %>
|
|
<%= select_tag "user[user_#{type}s][][attribute_values][][non_locale]", options_for_select(attr["options"], value['non_locale']) %>
|
|
<% end -%>
|
|
</td>
|
|
<% end -%>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<% end %>
|