49 lines
1.8 KiB
Plaintext
49 lines
1.8 KiB
Plaintext
<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 %>
|
|
<a id="upload" href="#"> Choose a file... </a>
|
|
<%= f.text_field :email, :onfocus => "this.value='';", :onblur => "if(this.value==''){this.value='E-Mail';}", :value => "E-Mail", :class => 'user_mail' %>
|
|
<label>
|
|
<%= f.check_box :admin %><span>Admin</span>
|
|
</label>
|
|
<%= f.select :active_role, @user_role_models.sort_by{|role| role.key }.collect {|role| [ role.key.capitalize, role.key ]}, :selected => (@user.active_role || 'student') %>
|
|
</div>
|
|
|
|
<% @user_info_models.each do |ua| %>
|
|
<div id="basic_block" class="roles_block">
|
|
<h2><%= ua.key.capitalize %></h2>
|
|
<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 -%>
|
|
|
|
<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?)) %>>
|
|
<h2><%= ua.key.capitalize %></h2>
|
|
<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 -%>
|
|
</div>
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
<script type="text/javascript" charset="utf-8">
|
|
$(document).ready(function(){
|
|
$('#user_active_role').change(function(){
|
|
$('#role_models .roles_block').hide();
|
|
$('#'+this.value+'_block').toggle();
|
|
});
|
|
});
|
|
</script>
|
|
<% end -%>
|