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

62 lines
2.0 KiB
Plaintext

<div id="select_user_roles">
<% @user_role_models.each do |ua| %>
<%= check_box_tag "user[active_roles][]", ua.key, (@user.active_roles.include?(ua.key) rescue false) %> <%= ua.i18n_variable[locale] %>
<% end -%>
<%= hidden_field_tag 'user[active_roles][]', '' %>
</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>
<% if @user_info_models %>
<fieldset>
<legend><%= t('panel.infos') %></legend>
<% @user_info_models.each do |ua| %>
<fieldset>
<%= render :partial => 'user_attribute',
:object => (@user.user_infos.detect {|u| u.key == ua.key } || @user.user_infos.build),
:locals => {:ua => ua, :type => 'info'} %>
</fieldset>
<% end -%>
</fieldset>
<% end %>
<%= hidden_field_tag :active_roles, @user.active_roles.size > 0 %>
<% if @user_role_models %>
<fieldset id="roles" <%= raw(' style="display: none;"') unless (@user.active_roles.size > 0 rescue nil) %>>
<legend><%= t('panel.roles') %></legend>
<% @user_role_models.each do |ua| %>
<fieldset id="role_<%= ua.key %>" <%= raw(' style="display: none;"') unless (@user.active_roles.include?(ua.key) rescue nil) %>>
<%= render :partial => 'user_attribute',
:object => (@user.user_roles.detect {|u| u.key == ua.key } || @user.user_roles.build),
:locals => {:ua => ua, :type => 'role'} %>
</fieldset>
<% end -%>
</fieldset>
<% end %>
<% content_for :page_specific_javascript do %>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#select_user_roles input').click(function(){
$('#role_'+this.value).toggle();
if($("#select_user_roles input:checked").length > 0)
{ $('#roles').show(); }
else
{ $('#roles').hide(); }
});
});
</script>
<% end -%>