2010-03-15 08:13:26 +00:00
|
|
|
<div id="select_user_attributes">
|
|
|
|
<% @user_attributes.each do |ua| %>
|
|
|
|
<%= check_box_tag "user[use_attributes][]", ua.key, @user.use_attributes.include?(ua.key) %> <%= ua.name %>
|
|
|
|
<% end -%>
|
|
|
|
<%= hidden_field_tag 'user[use_attributes][]','' %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<p>
|
|
|
|
<%= f.label :email %>
|
|
|
|
<%= f.text_field :email %>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
2010-03-08 09:14:59 +00:00
|
|
|
<% @user_attributes.each do |ua| %>
|
2010-03-15 08:13:26 +00:00
|
|
|
<div id="attribute_<%= ua.key %>"<%= raw(' style="display: none;"') unless @user.use_attributes.include?(ua.key) %>>
|
2010-03-08 09:14:59 +00:00
|
|
|
<h3><%= ua.name %></h3>
|
|
|
|
|
|
|
|
<% ua.attrs.each do |attr| %>
|
2010-03-18 09:57:26 +00:00
|
|
|
<% if attr["locale"] %>
|
|
|
|
<p>
|
|
|
|
<%= f.label attr["name_#{I18n.locale}"] %>
|
|
|
|
<% if attr["type"] == "text_field" %>
|
|
|
|
|
|
|
|
<% VALID_LOCALES.each do |locale| %>
|
|
|
|
<%= f.text_field "#{ua.key}_#{attr["key"]}_#{locale}" %>(<%= locale %>)
|
|
|
|
<% end -%>
|
|
|
|
|
|
|
|
<% elsif attr["type"] == "select" %>
|
|
|
|
<%= f.select "#{ua.key}_#{attr["key"]}_#{I18n.locale}", attr["options_#{I18n.locale}"].to_a %>
|
|
|
|
<% end -%>
|
|
|
|
</p>
|
|
|
|
<% else %>
|
|
|
|
<p>
|
|
|
|
<%= f.label attr["name"] %>
|
|
|
|
<% if attr["type"] == "text_field" %>
|
|
|
|
<%= f.text_field "#{ua.key}_#{attr["key"]}" %>
|
|
|
|
<% elsif attr["type"] == "select" %>
|
|
|
|
<%= f.select "#{ua.key}_#{attr["key"]}", attr["options"].to_a %>
|
|
|
|
<% end -%>
|
|
|
|
</p>
|
|
|
|
<% end -%>
|
2010-03-08 09:14:59 +00:00
|
|
|
<% end -%>
|
2010-03-15 08:13:26 +00:00
|
|
|
</div>
|
2010-03-08 09:14:59 +00:00
|
|
|
<% end -%>
|
2010-03-04 08:33:26 +00:00
|
|
|
|
2010-03-15 08:13:26 +00:00
|
|
|
<% content_for :page_specific_javascript do %>
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
|
|
$(document).ready(function(){
|
|
|
|
$('#select_user_attributes input').click(function(){
|
|
|
|
$("#attribute_"+this.value).toggle();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<% end -%>
|