Merge branch 'szzh' into develop

This commit is contained in:
huang 2015-11-14 10:55:43 +08:00
commit 26e3d6f863
12 changed files with 142 additions and 100 deletions

View File

@ -100,4 +100,13 @@ class OrganizationsController < ApplicationController
def members
@members = OrgMember.where("organization_id =?", @organization.id)
end
def more_org_projects
@organization = Organization.find params[:id]
@page = params[:page]
@org_projects = @organization.org_projects.reorder('created_at').page((params[:page].to_i || 1) +1).per(5)
respond_to do |format|
format.js
end
end
end

View File

@ -0,0 +1,12 @@
<% projects.each do |project|%>
<% pro = Project.find project.project_id %>
<li class="homepageLeftMenuCoursesLine">
<%= link_to pro.name, project_path(pro.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden", :title => pro.name%>
</li>
<% end %>
<% if projects.size == 5%>
<li class="homepageLeftMenuMore" id="show_more_org_project">
<input type="hidden" value="<%= page%>" id="org_project_page_num">
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_org_project('<%= more_org_projects_organization_path(org_id)%>');"></a>
</li>
<% end%>

View File

@ -50,13 +50,9 @@
<% end %>
<% end%>
</div>
<div class="orgName fl mb5 f14">组织id<%= @organization.id %></div>
<% if User.current.admin_of_org?(@organization) %>
<a href="<%= setting_organization_path(@organization) %>" class="pr_join_a c_white"><span class="pr_setting"></span>配置</a>
<% end %>
<div style="clear:both;">
<%= link_to l(:label_org_name)+"#{@organization.name}", organization_path(@organization.id), :class=>"pr_info_name fl c_dark fb break_word" %>
<!--<div class="orgName fl mb5 f14">组织id<%#= @organization.id %></div>-->
<div class="orgName fl mb5 f14">
<%= link_to @organization.name, organization_path(@organization.id), :class=>"pr_info_name fl c_dark fb break_word" %>
<% if @organization.is_public? %>
<span class="img_private"><%= l(:label_public)%></span>
<% else %>
@ -64,6 +60,19 @@
<% end %>
</div>
<% if User.current.admin_of_org?(@organization) %>
<a href="<%= setting_organization_path(@organization) %>" class="pr_join_a c_white"><span class="pr_setting"></span>配置</a>
<% end %>
<!--<div style="clear:both;">-->
<!--<%#= link_to l(:label_org_name)+"#{@organization.name}", organization_path(@organization.id), :class=>"pr_info_name fl c_dark fb break_word" %>-->
<!--<%# if @organization.is_public? %>-->
<!--<span class="img_private"><%#= l(:label_public)%></span>-->
<!--<%# else %>-->
<!--<span class="img_private"><%#= l(:label_private)%></span>-->
<!--<%# end %>-->
<!--</div>-->
<div class="cl"></div>
<div class="f12 fontGrey3">
<%= link_to '文章', organization_org_document_comments_path(@organization) %>&nbsp;(
@ -76,17 +85,18 @@
<div class="homepageLeftMenuBlock">
<%= link_to "动态",organization_path(@organization), :class => "homepageMenuText" %>
</div>
<!--<div class="homepageLeftMenuBlock"><a href="javascript:void(0);" class="homepageMenuText">项目</a><a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a></div>-->
<!--<div class="homepageLeftMenuCourses borderBottomNone">-->
<!--<ul style="display:none;">-->
<!--<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey">项目名称一</a></li>-->
<!--<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey">项目名称二</a></li>-->
<!--<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey">项目名称三</a></li>-->
<!--<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey">项目名称四</a></li>-->
<!--<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey">项目名称五</a></li>-->
<div class="homepageLeftMenuBlock"><a href="javascript:void(0);" class="homepageMenuText">项目</a>
<!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>-->
</div>
<div class="homepageLeftMenuCourses borderBottomNone">
<ul >
<%= render :partial => 'layouts/org_projects',:locals=>{:projects=>@organization.org_projects.reorder('created_at').limit(5),:org_id=>@organization.id,:page=>1}%>
<!--<%#= @organization.org_projects.each do |p|%>-->
<!--<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey"><%#= p.name%></a></li>-->
<!--<%# end %>-->
<!--<li class="homepageLeftMenuMore"><a href="javascript:void(0);" class="homepageLeftMenuMoreIcon"></a></li>-->
<!--</ul>-->
<!--</div>-->
</ul>
</div>
</div>
</div>
<div class="homepageRight">

View File

@ -1,3 +1,3 @@
$("#organization_document_<%= @document.id %>").html("");
$("#organization_document_<%= @document.id %>").html("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document}) %>");
$("#organization_document_<%= @document.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document}) %>");
init_activity_KindEditor_data(<%= @document.id %>,"","87%");

View File

@ -21,6 +21,7 @@
<input class="postDetailInput fl mr15" style="margin-bottom:15px;" maxlength="250" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" value="<%= @org_document.title %>" />
</div>
<div id="doc_title_hint"></div>
<div class="cl"></div>
<div id="org_document_editor" class="mt15" style="">
<div class="mt10">
<%= kindeditor_tag 'org_document_comment[content]',@org_document.content, :editor_id => 'org_document_description_editor', :height => "150px" %>

View File

@ -16,12 +16,9 @@
<% @documents.each do |document| %>
<script>
$(function() {
console.log(111)
init_activity_KindEditor_data(<%= document.id%>, null, "87%");
});
</script>
<p id="organization_document_<%= document.id %>">
<%= render :partial => 'organizations/show_org_document', :locals => {:document => document} %>
</p>
<% end %>
<% end %>

View File

@ -1,75 +1,76 @@
<div class="resources mt10">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_path(document.creator_id) %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo">
<%= link_to User.find(document.creator_id), user_path(document.creator.id), :class => "newsBlue mr15" %>
TO&nbsp;&nbsp;<%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %> |
<% if defined?(home_id) %>
<span style="color:#269ac9;">首页</span>
<% else %>
<span style="color:#269ac9;">组织</span>
<% end %>
<div class="resources mt10" id="organization_document_<%= document.id %>">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_path(document.creator_id) %>
</div>
<div class="homepagePostTitle postGrey"><%= document.title %></div>
<div class="homepagePostDate">
发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %></div>
<% unless document.content.blank? %>
<div class="homepagePostIntro">
<%= document.content.html_safe %>
</div>
<% end %>
<!-- <%# if defined?(home_id) %>
<div class="homepagePostDes">
<div class="homepagePostTo">
<%= link_to User.find(document.creator_id), user_path(document.creator.id), :class => "newsBlue mr15" %>
TO&nbsp;&nbsp;<%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %>
|
<% if document.organization.home_id == document.id %>
<span style="color:#269ac9;">首页</span>
<% else %>
<span style="color:#269ac9;">组织</span>
<% end %>
</div>
<div class="homepagePostTitle postGrey"><%= document.title %></div>
<div class="homepagePostDate">
发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %></div>
<% unless document.content.blank? %>
<div class="homepagePostIntro">
<%= document.content.html_safe %>
</div>
<% end %>
<!-- <%# if defined?(home_id) %>
<div style="float:right;">最后编辑:<%#= User.find() %></div>
<%# end %>-->
<% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id) || User.current.id == document.creator_id) %>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= form_for('new_form',:url => {:controller => 'organizations',:action => 'set_homepage',:id => document.organization_id, :home_id => document.id},:method => "put",:remote => true) do |f|%>
<a href="javascript:void(0);" class="postOptionLink" onclick="$(this).parent().submit();">设为首页</a>
<% end %>
</li>
<li>
<%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :class => "postOptionLink" %>
</li>
<li>
<%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete',
:data => {:confirm => l(:text_are_you_sure)},
:remote => true, :class => 'postOptionLink' %>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="cl"></div>
</div>
<% end %>
<% comments_for_doc = document.children.reorder("created_at desc") %>
<% count = document.children.count() %>
<div class="homepagePostReply fl" 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">
展开更多
</a>
</div>
<% end %>
<% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id) || User.current.id == document.creator_id) %>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => document.organization_id, :home_id => document.id}, :method => "put", :remote => true) do |f| %>
<a href="javascript:void(0);" class="postOptionLink" onclick="$(this).parent().submit();">设为首页</a>
<% end %>
</li>
<li>
<%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :class => "postOptionLink" %>
</li>
<li>
<%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete',
:data => {:confirm => l(:text_are_you_sure)},
:remote => true, :class => 'postOptionLink' %>
</li>
</ul>
</li>
</ul>
</div>
<div class="cl"></div>
<% end %>
</div>
</div>
<div class="homepagePostReplyContainer" id="reply_div_<%= document.id %>" style="display:<%= count == 0?'none':'block' %>">
<% comments_for_doc = document.children.reorder("created_at desc") %>
<% count = document.children.count() %>
<div class="homepagePostReply fl" 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">
展开更多
</a>
</div>
<% end %>
</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| %>
<% reply_id += 1 %>
<li style="display:<%= reply_id > 3? 'none':'' %>">
<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">
@ -87,12 +88,12 @@
</div>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15">
<%=link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_path(User.current) %>
<%= 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>
@ -110,15 +111,15 @@
</div>
<script type="text/javascript">
function expand_reply(container,btnid){
function expand_reply(container, btnid) {
var target = $(container);
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复');
target.show();
}else{
btn.data('init',0);
} else {
btn.data('init', 0);
btn.html('展开更多');
target.hide();
target.eq(0).show();

View File

@ -0,0 +1 @@
$("#show_more_org_project").replaceWith("<%= escape_javascript( render :partial => 'layouts/org_projects',:locals => {:projects => @org_projects,:org_id => @organization, :page => @page} )%>");

View File

@ -30,9 +30,8 @@
init_activity_KindEditor_data(<%= @organization.home_id%>, null, "87%");
});
</script>
<p id="organization_document_<%= @organization.home_id %>">
<%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id} %>
</p>
<% end %>
<% unless @activities.nil? %>
@ -52,15 +51,13 @@
</div>
</div>
<% end %>
<% if act.org_act_type == 'OrgDocumentComment' %>
<% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %>
<script>
$(function() {
init_activity_KindEditor_data(<%= act.org_act.id%>, null, "87%");
});
</script>
<p id="organization_document_<%= act.org_act.id %>" style="mt10">
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %>
</p>
<% end %>
<% end %>
<ul class="wlist" style=" border:none; padding-top: 15px;">
@ -69,3 +66,4 @@
<% end %>

View File

@ -37,6 +37,7 @@ RedmineApp::Application.routes.draw do
get 'clear_org_avatar_temp'
put 'set_homepage'
get 'members'
get 'more_org_projects'
end
collection do
get 'check_uniq'

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20151110011003) do
ActiveRecord::Schema.define(:version => 20151112072948) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -960,6 +960,7 @@ ActiveRecord::Schema.define(:version => 20151110011003) do
t.datetime "created_on"
t.integer "comments_count", :default => 0, :null => false
t.integer "course_id"
t.integer "sticky", :default => 0
end
add_index "news", ["author_id"], :name => "index_news_on_author_id"

View File

@ -1,4 +1,4 @@
//添加组织成员的提交函数
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֯<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function submit_add_org_members(){
$("#org_member_add_form").submit();
}
@ -31,4 +31,15 @@ function observeSearchfield(fieldId, targetId, url) {
var timer = setInterval(check, 300);
$this.bind('keyup click mousemove', reset);
});
}
//显示更多的项目
function show_more_org_project(url){
$.get(
url,
{ page: $("#org_project_page_num").val() },
function (data) {
}
);
}