Merge remote-tracking branch 'origin/develop' into weixin_guange

This commit is contained in:
guange 2016-06-27 16:03:55 +08:00
commit 5477c794ba
6 changed files with 47 additions and 23 deletions

View File

@ -54,4 +54,8 @@ class OrgMemberController < ApplicationController
def index def index
end end
def deleteOrgMember
destroy
end
end end

View File

@ -0,0 +1,3 @@
$("#org_members_count_id").html("");
$("#org_members_count_id").html("<%= @org.org_members.count %>")
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');

View File

@ -1,6 +1,7 @@
<% members.each do |member|%> <% members.each do |member|%>
<ul class="orgListRow"> <ul class="orgListRow">
<li class="orgListUser hidden"><a href="<%= user_url_in_org(member.user_id) %>" class="linkBlue"><%= User.find(member.user_id).realname.blank? ? User.find(member.user_id).login : User.find(member.user_id).realname %></a></li> <% username = User.find(member.user_id).realname.blank? ? User.find(member.user_id).login : User.find(member.user_id).realname %>
<li class="orgListUser hidden"><a href="<%= user_url_in_org(member.user_id) %>" class="linkBlue"><%= username %></a></li>
<li class="orgListRole"> <li class="orgListRole">
<%= get_org_member_role_name member %> <%= get_org_member_role_name member %>
<%= form_for(member, {:as => :org_member, :remote => true, :url => Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s, <%= form_for(member, {:as => :org_member, :remote => true, :url => Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s,
@ -32,7 +33,8 @@
</li> </li>
<% if ( (User.current.id == member.organization.creator_id || User.current.admin_of_org?(member.organization) ) && member.user_id != member.organization.creator_id )%> <% if ( (User.current.id == member.organization.creator_id || User.current.admin_of_org?(member.organization) ) && member.user_id != member.organization.creator_id )%>
<a href="javascript:void(0);" style="color: #0781B4;margin-left: 30px;float: left" onclick="$(this).parent().height();$('#org-member-<%= member.id%>-roles-form').show();">编辑</a> <a href="javascript:void(0);" style="color: #0781B4;margin-left: 30px;float: left" onclick="$(this).parent().height();$('#org-member-<%= member.id%>-roles-form').show();">编辑</a>
<%= link_to '删除', Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s,:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %> <a href="javascript:void(0)" style = "color: #0781B4;margin-left: 30px;float: left" onclick = "ifDeleteOrgMember('<%= member.id %>','<%= username %>')" >删除</a>
<%#= link_to '删除', Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s,:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %>
<div class="cl"></div> <div class="cl"></div>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>

View File

@ -116,6 +116,7 @@ RedmineApp::Application.routes.draw do
end end
collection do collection do
get 'org_member_autocomplete' get 'org_member_autocomplete'
get 'deleteOrgMember'
end end
end end

View File

@ -328,27 +328,27 @@ function enablePasteImg(_editor) {
$(nodeBody).on('pasteImage', function(ev, data) { $(nodeBody).on('pasteImage', function(ev, data) {
//粘贴图片时走这里会出现两张图片走df()即可 //粘贴图片时走这里会出现两张图片走df()即可
// console.log('pasteImage'); console.log('pasteImage');
// console.log("dataURL: " + data.dataURL); console.log("dataURL: " + data.dataURL);
// console.log("width: " + data.width); console.log("width: " + data.width);
// console.log("height: " + data.height); console.log("height: " + data.height);
// var blob = dataURItoBlob(data.dataURL); var blob = dataURItoBlob(data.dataURL);
// if (data.blob !== null) { if (data.blob !== null) {
// var data = new FormData(); var data = new FormData();
// data.append("imgFile",blob, "imageFilename.png"); data.append("imgFile",blob, "imageFilename.png");
// console.log(data); console.log(data);
// $.ajax({ $.ajax({
// url: '/kindeditor/upload?dir=image', url: '/kindeditor/upload?dir=image',
// contentType: false, contentType: false,
// type: 'POST', type: 'POST',
// data: data, data: data,
// processData: false, processData: false,
// success: function(data) { success: function(data) {
// console.log(data); console.log(data);
// editor.exec('insertimage', JSON.parse(data).url); editor.exec('insertimage', JSON.parse(data).url);
// } }
// }); });
// } }
}); });
return; return;
}; };

View File

@ -1555,4 +1555,18 @@ function edit_file_description(url,id){
} }
); );
} }
//删除组织成员
function ifDeleteOrgMember(id,name){
var htmlvalue = "</br><div style='width:550px;text-align:center'>您确定要删除"+name+"吗?</div></br><div style='width:164px; margin:0 auto; text-align:center'><a href='javascript:void(0);' class='Blue-btn fl' onclick='deleteOrgMember("+id+")'>确定</a><a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>取消</a></div>" +
"<script>function deleteOrgMember(id){" +
"$.ajax({\n\
url: '/org_member/deleteOrgMember',\n\
type: 'get',\n\
dataType: 'jsonp',\n\
data: {id:id},\n\
success: function(data){},\n\
});\n\
hideModal();}</script>";
pop_up_box(htmlvalue,580,30,50);
}