组织模块功能实现
This commit is contained in:
parent
a3443ba968
commit
d508cfa381
|
@ -27,6 +27,13 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
@documents = @organization.org_document_comments.where("parent_id is null").order("created_at desc")
|
||||
end
|
||||
def update
|
||||
@org_document = OrgDocumentComment.find(params[:id])
|
||||
respond_to do |format|
|
||||
# format.html {redirect_to :}
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -77,14 +77,19 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
project_org_ids = OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{params[:id]}").map(&:organization_id)
|
||||
if project_org_ids.empty?
|
||||
@orgs_not_in_project = Organization.where("is_public = 1").where("name like ?", condition).page((params[:page].to_i || 1)-1).per(10)
|
||||
@orgs_not_in_project = Organization.where("is_public = 1").where("name like ?", condition).page((params[:page].to_i || 1)).per(10)
|
||||
@org_count = Organization.where("is_public = 1").where("name like ?", condition).count
|
||||
else
|
||||
project_org_ids = "(" + project_org_ids.join(',') + ")"
|
||||
@orgs_not_in_project = Organization.where("id not in #{project_org_ids} and is_public = 1").where("name like ?", condition).page((params[:page].to_i || 1)-1).per(10)
|
||||
@org_count = Organization.where("id not in #{project_org_ids} and is_public = 1").where("name like ?", condition)
|
||||
@orgs_not_in_project = Organization.where("id not in #{project_org_ids} and is_public = 1").where("name like ?", condition).page((params[:page].to_i || 1)).per(10)
|
||||
@org_count = Organization.where("id not in #{project_org_ids} and is_public = 1").where("name like ?", condition).count
|
||||
end
|
||||
# @project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count
|
||||
@orgs_page = Paginator.new @org_count, 10,params[:page]
|
||||
#render :json => {:orgs => @orgs_not_in_project, :count => @org_count}.to_json
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
render :json => {:orgs => @orgs_not_in_project, :count => @org_count}.to_json
|
||||
end
|
||||
|
||||
def index
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<% @documents.each do |document| %>
|
||||
<script>
|
||||
$(function() {
|
||||
console.log(111)
|
||||
init_activity_KindEditor_data(<%= document.id%>, null, "87%");
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
$("#search_orgs_result_list").next().html("");
|
||||
$("#search_orgs_result_list").html("");
|
||||
//$("#search_orgs_result_list").append('<ul class="ml20">');
|
||||
$("#added_orgs").html("");
|
||||
$("#paginator").css("display", "none");
|
||||
$("#added_orgs").html('<%= escape_javascript(render :partial => "projects/settings/added_orgs", :locals => {:orgs => @project.organizations, :project_id => @project.id}) %>')
|
|
@ -1,2 +1,4 @@
|
|||
$("#added_orgs").html("");
|
||||
$("#search_orgs_result_list").html("");
|
||||
$("#paginator").css("display", "none");
|
||||
$("#added_orgs").html('<%= escape_javascript(render :partial => "projects/settings/added_orgs", :locals => {:orgs => @project.organizations, :project_id => @project.id}) %>')
|
|
@ -37,9 +37,10 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<% comments_for_doc = document.children.reorder("created_at desc") %>
|
||||
<div class="homepagePostReply" style="background-color: #f1f1f1;">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%= document.children.count() %>)</div>
|
||||
<% count = document.children.count() %>
|
||||
<div class="homepagePostReply" style="background-color: #f1f1f1;" id="<%= document.id %>">
|
||||
<div class="homepagePostReplyBanner" style="display:<%= count == 0?'none':'block' %>">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%= count %>)</div>
|
||||
<% if count > 3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%= document.id %>" onclick="expand_reply('#reply_div_<%= document.id %> li','#reply_btn_<%=document.id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help">
|
||||
|
@ -47,11 +48,14 @@
|
|||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<!--<div class="homepagePostReplyBannerTime">2015-07-31</div>-->
|
||||
<!--<div class="homepagePostReplyBannerMore"><a href="javascript:void(0);" class="replyGrey">点击展开更多回复</a></div>-->
|
||||
<div class="homepagePostReplyContainer">
|
||||
</div>
|
||||
<div class="homepagePostReplyContainer" id="reply_div_<%= document.id %>" style="display:<%= count == 0?'none':'block' %>">
|
||||
<ul>
|
||||
<% reply_id = 0 %>
|
||||
<% comments_for_doc.each do |comment| %>
|
||||
<div class="homepagePostReplyPortrait"><%= image_tag(url_to_avatar(User.find(comment.creator_id)), :width => 33, :height => 33, :alt => "用户头像") %></div>
|
||||
<% reply_id += 1 %>
|
||||
<li style="display:<%= reply_id > 3? 'none':'' %>">
|
||||
<div class="homepagePostReplyPortrait"><%= link_to image_tag(url_to_avatar(User.find(comment.creator_id)), :width => 33, :height => 33, :alt => "用户头像"), user_path(comment.creator_id) %></div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<%= link_to User.find(comment.creator_id), user_path(comment.creator_id), :class => "newsBlue mr10 f14" %>
|
||||
|
@ -62,16 +66,18 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="homepagePostReplyContainer">
|
||||
<div class="homepagePostReplyPortrait mr15">
|
||||
<%= image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像") %>
|
||||
<%=link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_path(User.current) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyInputContainer">
|
||||
<div nhname='new_message_<%= document.id %>' style="display:none;">
|
||||
<%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id), :method => "post", :remote => true) do |f| %>
|
||||
<input type="hidden" name="user_activity_id" value="<%= document.id %>">
|
||||
<input type="hidden" name="user_activity_id" value="<%= document.id %>" />
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= document.id %>' name="org_content"></textarea>
|
||||
|
||||
<div nhname='toolbar_container_<%= document.id %>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
|
||||
|
@ -87,4 +93,22 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function expand_reply(container,btnid){
|
||||
var target = $(container);
|
||||
var btn = $(btnid);
|
||||
if(btn.data('init')=='0'){
|
||||
btn.data('init',1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
}else{
|
||||
btn.data('init',0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,5 +1,23 @@
|
|||
<%= javascript_include_tag "jquery.infinitescroll.js" %>
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor" %>
|
||||
<style type="text/css">
|
||||
/*回复框*/
|
||||
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
|
||||
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
|
||||
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
|
||||
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-outline {border: none;}
|
||||
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
|
||||
.homepagePostReplyInputContainer .ke-container {float: left;}
|
||||
</style>
|
||||
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %>
|
||||
<script>
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= @organization.home_id%>, null, "87%");
|
||||
});
|
||||
</script>
|
||||
<%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id)} %>
|
||||
<% end %>
|
||||
<div class="homepageRightBanner">
|
||||
|
@ -31,6 +49,12 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<% if act.org_act_type == 'OrgDocumentComment' %>
|
||||
<script>
|
||||
$(function() {
|
||||
console.log(111)
|
||||
init_activity_KindEditor_data(<%= act.org_act.id%>, null, "87%");
|
||||
});
|
||||
</script>
|
||||
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
$("#search_orgs_result_list").html("");
|
||||
$("#search_orgs_result_list").append('<ul class="ml20">');
|
||||
<% @orgs_not_in_project.each do |org|%>
|
||||
link = "<li><label><input type='checkbox'class='mr5 fl mt3' name='orgNames[]' value='<%=org.id%>'/><span class='relateOrgName fl'> <%=org.name %> </span></label></li><div class='cl mt5'></div>";
|
||||
$("#search_orgs_result_list").append(link );
|
||||
<%end %>
|
||||
$("#search_orgs_result_list").append('</ul>')
|
||||
<% if @org_count > 10 %>
|
||||
$("#paginator").html(' <%= pagination_links_full @orgs_page, @org_count ,:per_page_links => true,:remote =>true,:flag=>true%>');
|
||||
$("#paginator").css("display", "block");
|
||||
<% else %>
|
||||
$("#paginator").css("display", "none");
|
||||
<% end %>
|
|
@ -18,9 +18,8 @@
|
|||
<div class="cl mb5"></div>
|
||||
<%= form_tag url_for(:controller => 'org_projects', :action => 'create', :project_id => @project.id), :id => 'join_orgs_for_project', :remote => true %>
|
||||
<input type="text" name="orgs" class="searchOrg mb5 ml20" placeholder="请输入组织名称" />
|
||||
<div id="search_orgs_result_list"></div>
|
||||
<ul class="ml20">
|
||||
</ul>
|
||||
<div id="search_orgs_result_list" class="ml20"></div>
|
||||
<ul id="paginator" class="wlist ml20" style="float:none;"></ul>
|
||||
<a href="javascript:void(0);" class="saveBtn db fl ml20 mr15 mb5" onclick="$('#join_orgs_for_project').submit();">关联</a>
|
||||
<a href="javascript:void(0);" class="cancelBtn db fl" onclick="cancel_join_orgs();">取消</a>
|
||||
</div>
|
||||
|
@ -50,22 +49,22 @@
|
|||
page = 1;
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'projects', :action => 'search_public_orgs_not_in_project') %>'+'?name='+ e.target.value+'&page='+page,
|
||||
type:'post',
|
||||
success: function(data){
|
||||
orgs = data.orgs;
|
||||
count = data.count;
|
||||
maxPage = Math.ceil(count/10);
|
||||
$("#search_orgs_result_list").next().html("");
|
||||
if(orgs.length != undefined && orgs.length != 0){
|
||||
var i = 0;
|
||||
for(; i<orgs.length; i++){
|
||||
link = "<li><label><input type='checkbox'class='mr5 fl mt3' name='orgNames[]' value='"+ orgs[i].organization.id + "'/><span class='relateOrgName fl'>" + orgs[i].organization.name + "</span></label></li><div class='cl mt5'></div>";
|
||||
console.log(link)
|
||||
$("#search_orgs_result_list").next().append(link );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
type:'get'
|
||||
// success: function(data){
|
||||
// orgs = data.orgs;
|
||||
// count = data.count;
|
||||
// maxPage = Math.ceil(count/10);
|
||||
// $("#search_orgs_result_list").next().html("");
|
||||
// if(orgs.length != undefined && orgs.length != 0){
|
||||
// var i = 0;
|
||||
// for(; i<orgs.length; i++){
|
||||
// link = "<li><label><input type='checkbox'class='mr5 fl mt3' name='orgNames[]' value='"+ orgs[i].organization.id + "'/><span class='relateOrgName fl'>" + orgs[i].organization.name + "</span></label></li><div class='cl mt5'></div>";
|
||||
// console.log(link)
|
||||
// $("#search_orgs_result_list").next().append(link );
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -84,25 +83,25 @@
|
|||
$(document).ready(function(){
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'projects', :action => 'search_public_orgs_not_in_project') %>'+'?page=1',
|
||||
type:'post',
|
||||
success: function(data){
|
||||
orgs = data.orgs;
|
||||
count = data.count;
|
||||
maxPage = Math.ceil(count/10);
|
||||
$("#search_orgs_result_list").next().html("");
|
||||
if(orgs.length != undefined && orgs.length != 0){
|
||||
var i = 0;
|
||||
for(; i<orgs.length; i++){
|
||||
link = "<li><label><input type='checkbox'class='mr5 fl mt3' name='orgNames[]' value='"+ orgs[i].organization.id + "'/><span class='relateOrgName fl'>" + orgs[i].organization.name + "</span></label></li><div class='cl mt5'></div>";
|
||||
console.log(link)
|
||||
$("#search_orgs_result_list").next().append(link );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
type:'get'
|
||||
// success: function(data){
|
||||
// orgs = data.orgs;
|
||||
// count = data.count;
|
||||
// maxPage = Math.ceil(count/10);
|
||||
// $("#search_orgs_result_list").next().html("");
|
||||
// if(orgs.length != undefined && orgs.length != 0){
|
||||
// var i = 0;
|
||||
// for(; i<orgs.length; i++){
|
||||
// link = "<li><label><input type='checkbox'class='mr5 fl mt3' name='orgNames[]' value='"+ orgs[i].organization.id + "'/><span class='relateOrgName fl'>" + orgs[i].organization.name + "</span></label></li><div class='cl mt5'></div>";
|
||||
// console.log(link)
|
||||
// $("#search_orgs_result_list").next().append(link );
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
});
|
||||
});
|
||||
function cancel_join_orgs() {
|
||||
$("#search_orgs_result_list").next().html("");
|
||||
$("#search_orgs_result_list").html("");
|
||||
}
|
||||
</script>
|
|
@ -522,7 +522,7 @@ RedmineApp::Application.routes.draw do
|
|||
post 'unarchive'
|
||||
post 'close'
|
||||
post 'reopen'
|
||||
post 'search_public_orgs_not_in_project'
|
||||
get 'search_public_orgs_not_in_project'
|
||||
match 'copy', :via => [:get, :post]
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue