2011-02-01 02:46:26 +00:00
|
|
|
<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] %>
|
2011-04-13 10:19:51 +00:00
|
|
|
<% end -%>
|
2011-02-01 02:46:26 +00:00
|
|
|
<%= hidden_field_tag 'user[active_roles][]', '' %>
|
2010-03-15 08:13:26 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
2011-11-17 12:02:58 +00:00
|
|
|
<label><%= t('admin.my_avatar') %></label>
|
2011-04-13 10:19:51 +00:00
|
|
|
<%= image_tag(@user.avatar.thumb.url) if @user.avatar? %>
|
|
|
|
<%= file_field_tag 'file' %>
|
|
|
|
<%= hidden_field_tag :avatar_cache %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<p>
|
2010-03-15 08:13:26 +00:00
|
|
|
<%= f.label :email %>
|
|
|
|
<%= f.text_field :email %>
|
2011-04-13 10:19:51 +00:00
|
|
|
</p>
|
2011-02-08 06:51:49 +00:00
|
|
|
<p>
|
2011-11-17 12:02:58 +00:00
|
|
|
<%= t('admin.admin') %>
|
2011-02-08 06:51:49 +00:00
|
|
|
<%= f.check_box :admin %>
|
|
|
|
</p>
|
2010-03-15 08:13:26 +00:00
|
|
|
</div>
|
|
|
|
|
2011-02-01 07:12:23 +00:00
|
|
|
<% if @user_info_models %>
|
|
|
|
<fieldset>
|
2011-11-17 12:02:58 +00:00
|
|
|
<legend><%= t('admin.info') %></legend>
|
2011-02-01 07:12:23 +00:00
|
|
|
<% @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 %>
|
|
|
|
|
|
|
|
<% if @user_role_models %>
|
|
|
|
<fieldset id="roles" <%= raw(' style="display: none;"') unless (@user.active_roles.size > 0 rescue nil) %>>
|
2011-11-17 12:02:58 +00:00
|
|
|
<legend><%= t('admin.roles') %></legend>
|
2011-02-01 07:12:23 +00:00
|
|
|
<% @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 %>
|
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(){
|
2011-02-01 02:46:26 +00:00
|
|
|
$('#select_user_roles input').click(function(){
|
2011-02-01 07:12:23 +00:00
|
|
|
$('#role_'+this.value).toggle();
|
|
|
|
if($("#select_user_roles input:checked").length > 0)
|
|
|
|
{ $('#roles').show(); }
|
|
|
|
else
|
|
|
|
{ $('#roles').hide(); }
|
2010-03-15 08:13:26 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
2011-04-13 10:19:51 +00:00
|
|
|
<% end -%>
|