角色多选的时候权限控制
This commit is contained in:
parent
84a7bb5907
commit
dfcc076a7f
|
@ -17,7 +17,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<!--退出项目-->
|
<!--退出项目-->
|
||||||
<% if (User.current.member_of? @project) && User.current.login? && !User.current.admin &&
|
<% if (User.current.member_of? @project) && User.current.login? && !User.current.admin &&
|
||||||
Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.first.to_s != "Manager" %>
|
!Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.first.to_s.include?("Manager") %>
|
||||||
<%= exit_project_link(@project) %>
|
<%= exit_project_link(@project) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -18,19 +18,19 @@
|
||||||
<li >
|
<li >
|
||||||
<%= link_to_user_header member.principal,false,:class => "w140_h c_setting_blue fl" %>
|
<%= link_to_user_header member.principal,false,:class => "w140_h c_setting_blue fl" %>
|
||||||
<span class="w180_h fl">
|
<span class="w180_h fl">
|
||||||
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
|
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
|
||||||
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
|
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
|
||||||
:method => :put,
|
:method => :put,
|
||||||
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
|
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
|
||||||
) do |f| %>
|
) do |f| %>
|
||||||
<% roles.each do |role| %>
|
<% roles.each do |role| %>
|
||||||
<ul style="text-align: left;" >
|
<ul style="text-align: left;" >
|
||||||
<%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
|
<%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
|
||||||
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
|
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
|
||||||
<label ><%= h role %></label>
|
<label ><%= h role %></label>
|
||||||
</ul>
|
</ul>
|
||||||
<!--<br/>-->
|
<!--<br/>-->
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= hidden_field_tag 'membership[role_ids][]', '' %>
|
<%= hidden_field_tag 'membership[role_ids][]', '' %>
|
||||||
<div>
|
<div>
|
||||||
<a href="javascript:void(0)" class="member_btn" onclick="$('#member-<%= member.id%>-roles-form').submit();" style="margin-right: 10px;">
|
<a href="javascript:void(0)" class="member_btn" onclick="$('#member-<%= member.id%>-roles-form').submit();" style="margin-right: 10px;">
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
<% unless member.user_id == @project.user_id %>
|
<% unless member.user_id == @project.user_id %>
|
||||||
<a href="javascript:void(0) " class="c_setting_blue ml30 fl" onclick="$('#member-<%= member.id%>-roles-form').show();$(this).parent().height(110);">编辑</a>
|
<a href="javascript:void(0) " class="c_setting_blue ml30 fl" onclick="$('#member-<%= member.id%>-roles-form').show();$(this).parent().height(110);">编辑</a>
|
||||||
<%= delete_link membership_path(member),
|
<%= delete_link membership_path(member),
|
||||||
|
|
Loading…
Reference in New Issue