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

37 lines
1.1 KiB
Plaintext

<div id="select_user_attributes">
<% @user_attribute_models.each do |ua| %>
<%= check_box_tag "user[active_attributes][]", ua.key, (@user.active_attributes.include?(ua.key) rescue false) %> <%= ua.i18n_variable[locale] %>
<% end -%>
<%= hidden_field_tag 'user[active_attributes][]', '' %>
</div>
<div>
<label><%= t('panel.my_avatar') %></label>
<%= image_tag(@user.avatar.thumb.url) if @user.avatar? %>
<%= file_field_tag 'file' %>
<%= hidden_field_tag :avatar_cache %>
</div>
<div>
<p>
<%= f.label :email %>
<%= f.text_field :email %>
</p>
</div>
<% @user_attribute_models.each do |ua| %>
<%= render :partial => 'user_attribute',
:object => (@user.user_attributes.detect {|u| u.key == ua.key } || @user.user_attributes.build),
:locals => {:ua => ua} %>
<% 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 -%>