2011-11-18 08:43:14 +00:00
|
|
|
<div id="person">
|
|
|
|
<% if @user.avatar? %>
|
|
|
|
<%= image_tag(@user.avatar.thumb.url) %>
|
|
|
|
<% else %>
|
|
|
|
<%= image_tag "person.png" %>
|
|
|
|
<% end %>
|
|
|
|
<%#= file_field_tag 'file' %>
|
|
|
|
<%#= hidden_field_tag :avatar_cache %>
|
2011-11-19 18:14:51 +00:00
|
|
|
<a id="upload" href="#"><%= t('admin.choose_file') %></a>
|
2011-11-22 10:54:10 +00:00
|
|
|
<%= 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' %>
|
2011-11-18 08:43:14 +00:00
|
|
|
<label>
|
2011-11-19 18:14:51 +00:00
|
|
|
<%= f.check_box :admin %><span><%= t('admin.admin') %></span>
|
2011-11-18 08:43:14 +00:00
|
|
|
</label>
|
2011-11-19 18:14:51 +00:00
|
|
|
<%= f.select :active_role, @user_role_models.sort_by{|role| role.key }.collect {|role| [ role.i18n_variable[I18n.locale], role.key ]}, :selected => (@user.active_role || 'student') %>
|
2010-03-15 08:13:26 +00:00
|
|
|
</div>
|
|
|
|
|
2011-11-18 08:43:14 +00:00
|
|
|
<% @user_info_models.each do |ua| %>
|
|
|
|
<div id="basic_block" class="roles_block">
|
2011-11-19 18:14:51 +00:00
|
|
|
<h2><%= ua.i18n_variable[I18n.locale] %></h2>
|
2011-11-18 08:43:14 +00:00
|
|
|
<hr>
|
|
|
|
<%= render :partial => 'user_attribute',
|
|
|
|
:object => (@user.user_infos.detect {|u| u.key == ua.key } || @user.user_infos.build),
|
|
|
|
:locals => {:ua => ua, :type => 'info'} %>
|
|
|
|
</div>
|
|
|
|
<% end -%>
|
2011-04-13 10:19:51 +00:00
|
|
|
|
2011-11-18 08:43:14 +00:00
|
|
|
<div id='role_models'>
|
|
|
|
<% @user_role_models.each do |ua| %>
|
|
|
|
<div id="<%= ua.key %>_block" class="roles_block" <%= raw(' style="display: none;"') unless ((@user.active_role.eql?(ua.key) rescue nil) || (ua.key.eql?('student') && @user.new_record?)) %>>
|
2011-11-19 18:14:51 +00:00
|
|
|
<h2><%= ua.i18n_variable[I18n.locale] %></h2>
|
2011-11-18 08:43:14 +00:00
|
|
|
<hr>
|
|
|
|
<%= render :partial => 'user_attribute',
|
|
|
|
:object => (@user.user_roles.detect {|u| u.key == ua.key } || @user.user_roles.build),
|
|
|
|
:locals => {:ua => ua, :type => 'role'} %>
|
|
|
|
</div>
|
|
|
|
<% end -%>
|
2010-03-15 08:13:26 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
2011-11-18 08:43:14 +00:00
|
|
|
$(document).ready(function(){
|
|
|
|
$('#user_active_role').change(function(){
|
|
|
|
$('#role_models .roles_block').hide();
|
|
|
|
$('#'+this.value+'_block').toggle();
|
2010-03-15 08:13:26 +00:00
|
|
|
});
|
2011-11-18 08:43:14 +00:00
|
|
|
});
|
2010-03-15 08:13:26 +00:00
|
|
|
</script>
|
2011-04-13 10:19:51 +00:00
|
|
|
<% end -%>
|