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
end
def deleteOrgMember
destroy
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|%>
<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">
<%= 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,
@ -32,7 +33,8 @@
</li>
<% 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>
<%= 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>
</ul>
<div class="cl"></div>

View File

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

View File

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