orbit-basic/app/views/panel/users/_user_attribute.html.erb

43 lines
1.7 KiB
Plaintext
Raw Normal View History

2011-02-01 07:12:23 +00:00
<%= fields_for "user[user_#{type}s]", user_attribute, :index => nil do |f| %>
<legend><%= ua.i18n_variable[I18n.locale] %></legend>
<%= f.hidden_field :key, :value => ua.key %>
<%= f.hidden_field :id unless user_attribute.new_record? %>
2011-02-01 07:12:23 +00:00
<table>
<tr>
<th><%= t("admin.key") %></th>
<% @site_valid_locales.each do |locale| %>
<th style="color:<%= colorize_in_use_locale(locale) %>"><%= locale %></th>
<% end %>
</tr>
2011-05-02 04:07:31 +00:00
<% ua.get_enabled_attribute_models.each do |attr| %>
2011-04-28 14:47:34 +00:00
<% 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>
2011-02-01 07:12:23 +00:00
<td><%= attr.i18n_variable[I18n.locale] %></td>
<% if attr["locale"] && attr["markup"] == 'text_field' %>
2011-04-28 14:47:34 +00:00
<%= hidden_field_tag "user[user_#{type}s][][attributes][][non_locale]", nil %>
2011-02-01 07:12:23 +00:00
<% @site_valid_locales.each do |locale| %>
<td>
2011-04-28 14:47:34 +00:00
<%= text_field_tag "user[user_#{type}s][][attributes][][#{locale}]", (value[locale] rescue nil) %>
2011-02-01 07:12:23 +00:00
</td>
<% end -%>
<% else %>
<td colspan=<%= @site_valid_locales.size %>>
<% if attr["markup"] == "text_field" %>
2011-04-28 14:47:34 +00:00
<%= text_field_tag "user[user_#{type}s][][attributes][][non_locale]", (value['non_locale'] rescue nil) %>
2011-02-01 07:12:23 +00:00
<% elsif attr["markup"] == "select" %>
2011-04-28 14:47:34 +00:00
<%= select_tag "user[user_#{type}s][][attributes][][non_locale]", options_for_select(attr["options"], value['non_locale']) %>
2011-02-01 07:12:23 +00:00
<% end -%>
</td>
<% end -%>
</tr>
2011-02-01 07:12:23 +00:00
<% end %>
2011-02-01 07:12:23 +00:00
</table>
2011-02-01 07:12:23 +00:00
<% end %>