This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/views/panel/users/_form.html.erb

55 lines
1.8 KiB
Plaintext
Raw Normal View History

<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| %>
<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| %>
<% 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 -%>
</div>
2010-03-08 09:14:59 +00:00
<% end -%>
<% 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 -%>