合作者提供删除功能

This commit is contained in:
huang 2017-05-19 17:14:15 +08:00
parent 287ddf7115
commit 7ad005d28e
6 changed files with 17 additions and 3 deletions

View File

@ -45,6 +45,16 @@ class ShixunsController < ApplicationController
@collaborators = @shixun.collaborators
end
def collaborators_delete
user_id = params[:c_id]
shixun_member = ShixunMember.where(:user_id => user_id, :shixun_id => @shixun.id, :role => 2).first
shixun_member.delete
@collaborators = @shixun.collaborators
respond_to do |format|
format.js
end
end
# 已存在的成员不添加
def add_collaborators
if !params[:search].nil?

View File

@ -3,7 +3,9 @@
<a class="fl"><%= image_tag(url_to_avatar(collaborators.user), :width => 60, :height => 60,:class => 'panel-list-img mr15 mt5') %></a>
<ul class="fl font-12 color-grey">
<li><a href="<%= user_path(collaborators.user) %>" class="font-16 mt5 link-name-dark task-hide"><%= collaborators.user.try(:show_name) %></a></li>
<li><span class="mr30"><%= collaborators.user.identity %></span> <a href="#" class="link-color-grey">删除</a></li>
<li><span class="mr30"><%= collaborators.user.identity %></span>
<a href="javascript:void(0);" class="link-color-grey" onclick="delete_confirm_box_2('<%= collaborators_delete_shixun_path(@shixun, :c_id => collaborators.user.id) %>', '确定要删除吗?')">删除</a>
</li>
</ul>
</div>
<% end %>

View File

@ -0,0 +1 @@
$("#collaborators_list").html("<%= j(render :partial => 'shixuns/collaborators_list') %>");

View File

@ -37,6 +37,7 @@ RedmineApp::Application.routes.draw do
get 'statistics'
get 'propaedeutics'
get 'collaborators'
delete 'collaborators_delete'
match 'add_collaborators', :via => [:get, :post]
post 'shixun_members_added'
get 'shixun_monitor'

View File

@ -157,7 +157,7 @@ function delete_confirm_box(url, str){
function delete_confirm_box_2(url, str){
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey">提示</h3><a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a></div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="'+ url +'" class="task-btn task-btn-blue fr" data-method="delete" data-remote="true">确定</a></div></div>';
'<a href="'+ url +'" class="task-btn task-btn-blue fr" data-method="delete" data-remote="true" onclick="hideModal();">确定</a></div></div>';
pop_box_new(htmlvalue, 480, 140);
}

View File

@ -65,7 +65,7 @@ a.rightbar-pause{ color:#29bd8b; font-size: 18px; margin-right:15px; margin-top:
.task-popup-text-center{ text-align: center; color: #666;}
.task-popup-title{ border-bottom: 1px solid #eee; padding:10px 15px; }
.task-popup-content{ padding:15px;}
.task-popup-submit{ margin:15px auto; width: 200px;}
.task-popup-submit{ margin:15px auto; width: 120px;}
/* TPM */
.task-header{ width: 100%;min-width:1200px; background:url("/images/task/task-bg-header.png") 0 0 repeat-x; height: 100px;}
.task-header-info{ width: 1200px; margin: 0 auto; color:#fff; padding:30px 0;}