1.增加管理员不能退出项目

2.增加退出项目时的提示
This commit is contained in:
sw 2014-09-27 16:18:29 +08:00
parent 8aec3fe8f5
commit 57835abb37
4 changed files with 37 additions and 21 deletions

View File

@ -251,6 +251,7 @@ module WatchersHelper
end
def exit_project_link(project)
link_to("退出项目",exit_cur_project_path(project.id),:remote => true )
link_to(l(:label_exit_project),exit_cur_project_path(project.id),
:remote => true, :confirm => l(:lable_sure_exit_project) )
end
end

View File

@ -20,26 +20,34 @@
<% members.each do |member| %>
<% next if member.new_record? %>
<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
<td class="<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %></td>
<td class="<%= member.principal.class.name.downcase %>">
<%= link_to_user member.principal %>
</td>
<td class="roles">
<span id="member-<%= member.id %>-roles">
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
</span>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
:method => :put,
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
<span id="member-<%= member.id %>-roles">
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
</span>
<%= form_for(member, {:as => :membership, :remote => true,
:url => course_memberships_path(member),:method => :put,
:html => {:id => "member-#{member.id}-roles-form",
:class => 'hol'}}
) do |f| %>
<p>
<% roles.each do |role| %>
<label><%= 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? } %> <%= h role %></label><br/>
<% end %></p>
<label>
<%= 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? } %>
<%= h role %>
</label>
<br/>
<% end %>
</p>
<%= hidden_field_tag 'membership[role_ids][]', '' %>
<p><%= submit_tag l(:button_change), :class => "small" %>
<p>
<%= submit_tag l(:button_change), :class => "small" %>
<%= link_to_function l(:button_cancel),
"$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;"
%></p>
%>
</p>
<% end %>
</td>
<!--modified by huang for: if the user'roles is Manager that he will can't modified himself-->
@ -71,8 +79,10 @@
<%= form_for(@member, {:as => :membership, :url => course_memberships_path(@course), :remote => true, :method => :post}) do |f| %>
<fieldset>
<legend><%= l(:label_member_new) %></legend>
<p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p>
<p>
<%= label_tag "principal_search", l(:label_principal_search) %>
<%= text_field_tag 'principal_search', nil %>
</p>
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_course_memberships_path(@course, :format => 'js') }')" %>
<div id="principals_for_new_member">
@ -82,10 +92,12 @@
<!--show the roles which will select-->
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
<% roles.each do |role| %>
<label><%= radio_button_tag 'membership[role_ids][]', role.id %> <%= h role %></label>
<% end %></p>
<label>
<%= radio_button_tag 'membership[role_ids][]', role.id %>
<%= h role %>
</label>
<% end %>
</p>
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
</fieldset>
<% end %>

View File

@ -14,7 +14,9 @@
<!--添加退出项目-->
<div style="margin-left: 20px;">
<% if ((User.current.member_of? @project) && User.current.login?) %>
<% if ((User.current.member_of? @project) &&
User.current.login? &&
@project.members.where("user_id = #{User.current.id}").first.roles.first.to_s != "Manager") %>
<%= exit_project_link(@project) %>
<% end %>
</div>

View File

@ -2139,3 +2139,4 @@ zh:
lable_user_active: 用户动态
lable_bar_active: 贴吧动态
lable_student_list_visable: 学生列表是否公开
lable_sure_exit_project: 是否确认退出该项目