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

36 lines
1002 B
Plaintext

<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>
<% @user_attributes.each do |ua| %>
<div id="attribute_<%= ua.key %>"<%= raw(' style="display: none;"') unless @user.use_attributes.include?(ua.key) %>>
<h3><%= ua.name %></h3>
<% ua.attrs.each do |attr| %>
<p>
<%= f.label attr["name"] %>
<%= f.send(attr["type"], "#{ua.key}_#{attr["key"]}" )%>
</p>
<% end -%>
</div>
<% 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 -%>