orbit-basic/app/views/admin/users_new_interface/_role.html.erb

102 lines
3.4 KiB
Plaintext

<div id="roles-area" class="input-area">
<% role_disable = @user.roles.include?(role) ? false : true %>
<div class="attributes <%= role_disable ? 'disabled' : '' %>">
<div class="attributes-header clearfix">
<div class="toggle-control" style="float: right;">
<div class="togglebox <%= role_disable ? 'disabled' : '' %>">
<%= hidden_field_tag("user[disable_role][id][#{role.id}]",role_disable,:for=>@form_index,"data-deploy"=>"right",:class=>"toggle-check",:value=>role_disable)%>
<label><b></b></label>
</div>
</div>
<h4><%= role.title %><%= t(:role_info)%></h4>
</div>
<div class="attributes-body" style="display: <%= role_disable ? 'none' : 'block' %>;" >
<% @form_index = @form_index +1 %>
<div class="control-group">
<%= label_tag t(:status), nil, {:func=>"field_label", :for=>"1", :class=>"control-label muted"} %>
<div class="controls">
<% role.role_statuses.where(:disable => false).each_with_index do |rrs, i|%>
<%= hidden_field_tag("user[role_status][id][#{rrs.id}]", false,:for=>"#{@form_index}")%>
<%= label_tag(i,check_box_tag( "user[role_status][id][#{rrs.id}]", true, @user.role_statuses.include?(rrs))+rrs.title,:class=>"checkbox inline") %>
<% end %>
</div>
</div>
<% @form_index = @form_index +1 %>
<div class="control-group">
<%= label_tag t(:category), nil, {:func=>"field_label", :for=>"1", :class=>"control-label muted"} %>
<div class="controls">
<% role.role_categorys.where(:disable => false).each_with_index do |rrcg, i|%>
<%= hidden_field_tag("user[role_category][id][#{rrcg.id}]", false,:for=>"#{@form_index}")%>
<%= label_tag(i,check_box_tag( "user[role_category][id][#{rrcg.id}]", true, @user.role_categorys.include?(rrcg))+rrcg.title,:class=>"checkbox inline") %>
<% end %>
</div>
</div>
<% role.attribute_fields.asc(:_id).each do |rf|%>
<%= rf.block_helper(@user,@form_index)%>
<% @form_index = @form_index +1 %>
<% end %>
<% @form_index = @form_index +1 %>
<div id="roles-area" class="input-area">
<% role.sub_roles.where(:disabled=>false).asc("_id").each do |sub_role| %>
<% sub_role_disable = @user.sub_roles.include?(sub_role) ? false : true %>
<div class="attributes <%= sub_role_disable ? 'disabled' : '' %>">
<div class="attributes-header clearfix">
<div class="toggle-control" style="float: right;">
<div class="togglebox <%= sub_role_disable ? 'disabled' : '' %>">
<%= hidden_field_tag("user[disable_sub_role][id][#{sub_role.id}]",sub_role_disable,:for=>@form_index,"data-deploy"=>"right",:class=>"toggle-check",:value=>sub_role_disable)%>
<label><b></b></label>
</div>
</div>
<h4><%= sub_role.title %><%= t(:role_info)%></h4>
</div>
<div class="attributes-body" style="display: <%= sub_role_disable ? 'none' : 'block' %>;">
<% sub_role.attribute_fields.asc(:_id).each do |af|%>
<%= af.block_helper(@user,@form_index)%>
<% @form_index = @form_index +1 %>
<% end %>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>