配置-成员界面休整

This commit is contained in:
huang 2015-04-14 10:23:49 +08:00
parent 6b8022cb23
commit 845794675a
2 changed files with 67 additions and 8 deletions

View File

@ -128,6 +128,15 @@ module ApplicationHelper
end end
end end
def link_to_settings_user(user, options={})
if user.is_a?(User)
name = h(user.name(options[:format]))
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => "w90 c_orange fl"
else
h(user.to_s)
end
end
#重载上面方法,增加样式显示 #重载上面方法,增加样式显示
def link_to_user_header user,canShowRealName=false,options={} def link_to_user_header user,canShowRealName=false,options={}
if user.is_a?(User) if user.is_a?(User)
@ -1341,9 +1350,9 @@ module ApplicationHelper
def delete_link(url, options={}) def delete_link(url, options={})
options = { options = {
:method => :delete, :method => :delete,
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:class => 'icon icon-del' :class => 'icon icon-del'
}.merge(options) }.merge(options)
link_to l(:button_delete), url, options link_to l(:button_delete), url, options

View File

@ -1,12 +1,62 @@
<%= error_messages_for 'member' %>
<%
roles = Role.givable.all
if @project.project_type == Project::ProjectType_course
roles = roles[3..5]
else
roles = roles[0..2]
end
members = @project.member_principals.includes(:roles, :principal).all.sort
%>
<div class="members_left"> <div class="members_left">
<% if members.any? %>
<ul style=" border-bottom:none;"> <ul style=" border-bottom:none;">
<li><span class="w90 f_b" >用户</span><span class="w210 f_b">角色</span><span></span></li> <li><span class="w90 f_b" ><%= l(:label_user) %></span><span class="w210 f_b"><%= l(:label_role_plural) %></span><span></span></li>
<li ><a href="javascript:void(0)" class="w90 c_orange fl">gugu01</a><span class="w210 fl">Manager, Developer</span><a href="javascript:void(0)" class="c_dblue ml15 fl">编辑</a><a href="javascript:void(0)" class="c_dblue ml30 fl">删除</a></li> <%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
<li ><a href="javascript:void(0)" class="w90 c_orange fl">gugu01</a><span class="w210 fl">Manager, Developer, Reporter</span><a href="javascript:void(0)" class="c_dblue ml15 fl">编辑</a><a href="javascript:void(0)" class="c_dblue ml30 fl">删除</a></li> <% members.each do |member| %>
<li ><a href="javascript:void(0)" class="w90 c_orange fl">gugu01</a><span class="w210 fl">Manager</span><a href="javascript:void(0)" class="c_dblue ml15 fl">编辑</a><a href="javascript:void(0)" class="c_dblue ml30 fl">删除</a></li> <li >
<%= link_to_user_header member.principal,false,:class => "w150 c_orange fl" %>
<span class="w150 fl">
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
:method => :put,
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
) do |f| %>
<% roles.each do |role| %>
<ul style="text-align: left;" class="ml20">
<%= radio_button_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? } %>
<label ><%= h role %></label>
</ul>
<!--<br/>-->
<% end %>
<%= hidden_field_tag 'membership[role_ids][]', '' %>
<div class="ml20">
<a href="javascript:void(0)" class="member_btn" onclick="$('#member-<%= member.id%>-roles-form').submit();" style="margin-right: 10px;">
<%= l(:button_change)%>
</a>
<a href="javascript:void(0)" class="member_btn" onclick="$('#member-<%= member.id%>-roles-form').hide();$(this).parent().parent().parent().parent().height(30)">
<%= l(:button_cancel)%>
</a>
</div>
<% end %>
</span>
<%# unless member.roles.first.to_s == "Manager"%>
<a href="javascript:void(0) " class="c_dblue ml15 fl" onclick="$('#member-<%= member.id%>-roles-form').show();$(this).parent().height(110);">编辑</a>
<%= delete_link membership_path(member),
:remote => true,
:class => "c_dblue ml30 fl",
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {confirm: l(:label_delete_confirm)}) if member.deletable? %>
<%# end%>
</li>
<% end%>
</li>
</ul> </ul>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</div><!-- 左边--> </div><!-- 左边-->
<div class="members_right"> <div class="members_right">