2011-12-10 10:21:59 +00:00
|
|
|
|
<div id="person" class="clear">
|
|
|
|
|
<% if @user.avatar? %>
|
|
|
|
|
<%= image_tag(@user.avatar.thumb.url) %>
|
|
|
|
|
<% else %>
|
|
|
|
|
<%= image_tag "person.png" %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<%= file_field_tag 'file' %>
|
|
|
|
|
<%= hidden_field_tag :avatar_cache %>
|
|
|
|
|
<label>
|
|
|
|
|
<span><%= t('admin.email') %>:</span>
|
|
|
|
|
<%= f.text_field :email, :onfocus => "this.value='';", :onblur => "if(this.value==''){this.value=#{t('admin.email')};}", :value => (@user.email.blank? ? t('admin.email') : @user.email), :class => 'user_mail' %>
|
|
|
|
|
</label>
|
|
|
|
|
<label>
|
|
|
|
|
<%= f.check_box :admin %>
|
|
|
|
|
<span><%= t('admin.admin') %>:</span>
|
|
|
|
|
</label>
|
|
|
|
|
<label>
|
|
|
|
|
<span><%= t('admin.role') %>:</span>
|
2011-12-18 02:07:42 +00:00
|
|
|
|
<%= f.select :active_role, @roles.sort_by{|role| role.key }.collect {|role| [ role.i18n_variable[I18n.locale], role.key ]}, :selected => (@user.active_role || 'student') %>
|
2011-12-10 10:21:59 +00:00
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
|
2011-12-18 02:07:42 +00:00
|
|
|
|
<% @infos.each do |ua| %>
|
|
|
|
|
<div id="basic_block" class="attributes_block <%= @class %>">
|
2011-12-10 10:21:59 +00:00
|
|
|
|
<h2><%= ua.i18n_variable[I18n.locale] %></h2>
|
|
|
|
|
<hr>
|
2011-12-18 02:07:42 +00:00
|
|
|
|
<%= render :partial => 'attribute',
|
|
|
|
|
:object => (@user.infos.detect {|u| u.key == ua.key } || @user.infos.build),
|
2011-12-10 10:21:59 +00:00
|
|
|
|
:locals => {:ua => ua, :type => 'info'} %>
|
|
|
|
|
</div>
|
|
|
|
|
<% end -%>
|
|
|
|
|
|
2011-12-18 02:07:42 +00:00
|
|
|
|
<div id='roles'>
|
|
|
|
|
<% @roles.each do |ua| %>
|
|
|
|
|
<div id="<%= ua.key %>_block" class="attributes_block <%= @class %>" <%= raw(' style="display: none;"') unless ((@user.active_role.eql?(ua.key) rescue nil) || (ua.key.eql?('student') && @user.new_record?)) %>>
|
2011-12-10 10:21:59 +00:00
|
|
|
|
<h2><%= ua.i18n_variable[I18n.locale] %></h2>
|
|
|
|
|
<hr>
|
2011-12-18 02:07:42 +00:00
|
|
|
|
<%= render :partial => 'attribute',
|
|
|
|
|
:object => (@user.roles.detect {|u| u.key == ua.key } || @user.roles.build),
|
2011-12-10 10:21:59 +00:00
|
|
|
|
:locals => {:ua => ua, :type => 'role'} %>
|
|
|
|
|
</div>
|
|
|
|
|
<% end -%>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
|
|
|
<%= javascript_include_tag "user_form" %>
|
|
|
|
|
<% end -%>
|