Conflicts:
	db/schema.rb
This commit is contained in:
cxt 2015-11-16 08:53:15 +08:00
commit 24e9f5e7d5
23 changed files with 521 additions and 122 deletions

View File

@ -1,5 +1,33 @@
# encoding: utf-8 # encoding: utf-8
class OrganizationsController < ApplicationController class OrganizationsController < ApplicationController
helper :sort
include SortHelper
helper :custom_fields
include CustomFieldsHelper
include AvatarHelper
include WordsHelper
include GitlabHelper
include UserScoreHelper
include PollHelper
helper :user_score
helper :journals
# added by liuping 关注
helper :watchers
helper :activities
### added by william
include ActsAsTaggableOn::TagsHelper
# fq
helper :words
helper :project_score
helper :issues
include UsersHelper
before_filter :find_organization, :only => [:show, :members] before_filter :find_organization, :only => [:show, :members]
layout 'base_org' layout 'base_org'
def index def index
@ -27,12 +55,22 @@ class OrganizationsController < ApplicationController
def show def show
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
@organization = Organization.find(params[:id]) @organization = Organization.find(params[:id])
@activities = OrgActivity.where('(org_act_id = ? and org_act_type = ?) || (container_id =? and org_act_type =? and org_act_id !=?)', @org_activities = OrgActivity.where('container_id =? and container_type =? ',
@organization.id, 'CreateOrganization ', @organization.id, 'OrgDocumentComment', @organization.home_id).order('updated_at desc') @organization.id, 'Organization ').order('updated_at desc').page(params[:page]).per(10)
@activities = paginateHelper @activities, 10 @org_activities_count = OrgActivity.where('container_id =? and container_type =? ',
@organization.id, 'Organization ').order('updated_at desc').count
project_ids = @organization.projects.map(&:id) << 0
@org_project_activties = ForgeActivity.where("project_id in (#{project_ids.join(',')}) and forge_act_type in('Issue','Message','ProjectCreateInfo')").order("updated_at desc").page(params[:page] || 1).per(10)
@org_project_activties_count = ForgeActivity.where('project_id in (?)',project_ids.join(',')).count
#@org_activities = paginateHelper @org_activities, 10
@page = params[:page]
else else
render_403 render_403
end end
respond_to do |format|
format.html
format.js
end
end end
def update def update
@ -99,4 +137,13 @@ class OrganizationsController < ApplicationController
def members def members
@members = OrgMember.where("organization_id =?", @organization.id) @members = OrgMember.where("organization_id =?", @organization.id)
end 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 end

View File

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

View File

@ -581,7 +581,10 @@
} }
}); });
//查询学校
$("input[name='province']").on('input', function (e) {
throttle(shcool_search_fn,window,e);
});
function throttle(method,context,e){ function throttle(method,context,e){
clearTimeout(method.tId); clearTimeout(method.tId);
@ -603,10 +606,7 @@
type: 'post', type: 'post',
success: function (data) { success: function (data) {
schoolsResult = data.schools; schoolsResult = data.schools;
count = data.count; //查询学校 count = data.count;
$("input[name='province']").on('input', function (e) {
throttle(shcool_search_fn,window,e);
});
maxPage = Math.ceil(count/100) //最大页码值 maxPage = Math.ceil(count/100) //最大页码值
if(schoolsResult.length != undefined && schoolsResult.length != 0) { if(schoolsResult.length != undefined && schoolsResult.length != 0) {
var i = 0; var i = 0;

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%"); 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 %>" /> <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>
<div id="doc_title_hint"></div> <div id="doc_title_hint"></div>
<div class="cl"></div>
<div id="org_document_editor" class="mt15" style=""> <div id="org_document_editor" class="mt15" style="">
<div class="mt10"> <div class="mt10">
<%= kindeditor_tag 'org_document_comment[content]',@org_document.content, :editor_id => 'org_document_description_editor', :height => "150px" %> <%= 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| %> <% @documents.each do |document| %>
<script> <script>
$(function() { $(function() {
console.log(111)
init_activity_KindEditor_data(<%= document.id%>, null, "87%"); init_activity_KindEditor_data(<%= document.id%>, null, "87%");
}); });
</script> </script>
<div id="organization_document_<%= document.id %>">
<%= render :partial => 'organizations/show_org_document', :locals => {:document => document} %> <%= render :partial => 'organizations/show_org_document', :locals => {:document => document} %>
</div>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -34,8 +34,7 @@
</div> </div>
<% end %> <% end %>
</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 || member.roles[0].name == "orgManager" ) && member.user_id != member.organization.creator_id )%>
<a href="javascript:void(0);" style="color: #0781B4;margin-left: 30px;float: left" onclick="$(this).parent().height(70);$('#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(70);$('#org-member-<%= member.id%>-roles-form').show();">编辑</a>
<%= link_to '删除', org_member_path(member.id),:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %> <%= link_to '删除', org_member_path(member.id),:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %>
<div class="cl"></div> <div class="cl"></div>

View File

@ -1,11 +1,11 @@
<%= stylesheet_link_tag 'courses' %> <%= stylesheet_link_tag 'courses' %>
<div class="resources"> <div class="resources mt10">
<div class="project_r_h" style="width: 720px;"> <div class="project_r_h" style="width: 720px;">
<h2 class="project_h2"> 组织成员</h2> <h2 class="project_h2"> 组织成员</h2>
</div> </div>
<div class="st_list" style="width: 720px;"> <div class="st_list" style="width: 720px;">
<div class="st_box"> <div class="st_box">
<span class="fr fb fontGrey3">加入时间</span> <!--<span class="fr fb fontGrey3">加入时间</span>-->
<div class="cl"></div><!--st_box_top end--> <div class="cl"></div><!--st_box_top end-->
<% members.each do |member| %> <% members.each do |member| %>

View File

@ -0,0 +1,28 @@
<% org_project_activties.each do |act|%>
<% if act %>
<% if act %>
<% case act.forge_act_type.to_s %>
<% when 'Issue' %>
<%= render :partial => 'organizations/org_project_issue', :locals => {:activity => act.forge_act,:user_activity_id =>act.id} %>
<% when 'Message' %>
<%= render :partial => 'organizations/project_message', :locals => {:activity => act.forge_act,:user_activity_id =>act.id} %>
<% when 'ProjectCreateInfo'%>
<%= render :partial => 'organizations/project_create', :locals => {:activity => act,:user_activity_id =>act.id} %>
<% end %>
<% end %>
<% end %>
<% end %>
<% if org_act_count == 10 || pro_act_count == 10 %>
<div id="show_more_activities" class="loadMore mt10 f_grey">展开更多<%=link_to "", organization_path(org,:page => page.to_i + 1),:id => "more_org_activities_link",:remote => "true",:class => "none" %></div>
<%#= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end%>
<script>
$(function(){
$("#show_more_activities").mouseover(function(){
$("#more_org_activities_link").click();
})
})
</script>

View File

@ -0,0 +1,136 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4">
<% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% end %> TO
<%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%>
</div>
<div class="homepagePostTitle break_word">
<%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %>
<span class='<%#= get_issue_priority(activity.priority_id)[0] %>'>
<%#= get_issue_priority(activity.priority_id)[1] %>
</span>
</div>
<div class="homepagePostSubmitContainer">
<div class="homepagePostAssignTo">指派给&nbsp;&nbsp;
<% unless activity.assigned_to_id.nil? %>
<% if activity.try(:assigned_to).try(:realname) == ' ' %>
<%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %>
<% else %>
<%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %>
<% end %>
<% end %>
</div>
<div class="homepagePostDeadline">
时间:
<%=format_time(activity.created_on) %>
</div>
</div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 lh18 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>">
<% if activity.description? %>
<%= textAreailizable activity, :description, :attachments => activity.attachments %>
<% end %>
</div>
</div>
<div class="cl"></div>
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
<div class="mt10" style="font-weight:normal;">
<% if activity.attachments.any? %>
<% activity.attachments.each do |attachment| %>
<div class="break_word">
<span class="fl">
<span title="<%= attachment.filename %>" id="attachment_">
<%= link_to_short_attachment attachment,:length=> 58, :class => 'link_file_a fl newsBlue', :download => true -%>
</span>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
:controller => 'attachments',
:action => 'show',
:id => attachment,
:class => 'fl',
:filename => attachment.filename %>
<% end %>
</span>
<span class="postAttSize">(
<%= number_to_human_size attachment.filesize %>)
</span>
<span class="author" title="<%= attachment.author%>">
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>,
<%= format_time(attachment.created_on) %>
</span>
</div>
<% end %>
<% end %>
</div>
</div>
<div class="cl"></div>
</div>
<% count = activity.journals.count %>
<div class="homepagePostReply">
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(<%= count %></div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<% if count > 3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help">
展开更多
</a>
</div>
<% end %>
</div>
<% replies_all_i = 0 %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<ul>
<% activity.journals.reorder("created_on desc").each do |reply| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= reply.id %>');
});
</script>
<% replies_all_i=replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher mt-4">
<% if reply.try(:user).try(:realname) == ' ' %>
<%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
<% else %>
<%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_time(reply.created_on) %>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
<% if reply.details.any? %>
<% details_to_strings(reply.details).each do |string| %>
<p><%= string %></p>
<% end %>
<% end %>
<P><%= reply.notes.nil? ? "" : reply.notes.html_safe %></P>
</div>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
</div>
<% end %>
</div>
</div>

View File

@ -0,0 +1,38 @@
<% project = Project.find(activity.project_id) %>
<% user = User.find(project.user_id)%>
<div class="resources mt10">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像" %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4">
<% if user.try(:realname) == ' ' %>
<%= link_to user, user_path(user), :class => "newsBlue mr15" %>
<% else %>
<%= link_to user.try(:realname), user_path(user), :class => "newsBlue mr15" %>
<% end %>
TO
<%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %>
</div>
<div class="homepagePostTitle break_word" >
<%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %>
</div>
<div class="homepagePostDate">
创建时间:<%= format_time(project.created_on) %>
</div>
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li><a href="javascript:void(0);" class="postOptionLink">编辑</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">复制</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="cl"></div>
</div>
</div>

View File

@ -0,0 +1,100 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4">
<% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% end %>
TO
<%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%>
<!--<a href="javascript:void(0);" class="newsBlue ml15 mr5"><%= activity.project.name %>(项目讨论区)</a>-->
</div>
<div class="homepagePostTitle break_word">
<% if activity.parent_id.nil? %>
<%= link_to activity.subject.to_s.html_safe, project_boards_path(activity.project,:parent_id =>activity.id, :topic_id => activity.id), :class=> "postGrey"
%>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, project_boards_path(activity.project,:parent_id =>activity.parent_id, :topic_id => activity.id), :class=> "postGrey"
%>
<% end %>
</div>
<div class="homepagePostDate">
时间:<%= format_time(activity.created_on) %>
</div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 lh18 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>">
<% if activity.parent_id.nil? %>
<%= activity.content.to_s.html_safe%>
<% else %>
<%= activity.parent.content.to_s.html_safe%>
<% end %>
</div>
</div>
<div class="cl"></div>
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<% count = 0 %>
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
<% count=activity.children.count%>
<% end %>
<div class="homepagePostReply">
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(
<%=count %>
)</div>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
<%if count>3 %>
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >展开更多</a></div>
<% end %>
</div>
<% activity= activity.parent_id.nil? ? activity : activity.parent %>
<% replies_all_i = 0 %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<ul>
<% activity.children.reorder("created_on desc").each do |reply| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= reply.id %>');
});
</script>
<% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher mt-4">
<% if reply.try(:author).try(:realname) == ' ' %>
<%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
<% else %>
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_time(reply.created_on) %>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
<%= reply.content.html_safe %></div>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
</div>
<% end %>
</div>
</div>

View File

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

@ -31,7 +31,7 @@
<li class=" mb5 ml80"> <li class=" mb5 ml80">
<label >公开&nbsp;&nbsp;</label> <label >公开&nbsp;&nbsp;</label>
<input id="organization_is_public" name="organization[is_public]" type="checkbox" value="1" checked="checked"> <input id="organization_is_public" name="organization[is_public]" type="checkbox" value="1" checked="checked">
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该项目。)</span> <span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)</span>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li class=" ml90" > <li class=" ml90" >

View File

@ -30,13 +30,12 @@
init_activity_KindEditor_data(<%= @organization.home_id%>, null, "87%"); init_activity_KindEditor_data(<%= @organization.home_id%>, null, "87%");
}); });
</script> </script>
<div id="organization_document_<%= @organization.home_id %>">
<%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id} %> <%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id} %>
</div>
<% end %> <% end %>
<% unless @activities.nil? %> <% unless @org_activities.nil? %>
<% @activities.each do |act| %> <% @org_activities.each do |act| %>
<% if act.org_act_type == 'CreateOrganization' %> <% if act.org_act_type == 'CreateOrganization' %>
<div class="resources mt10"> <div class="resources mt10">
<div class="homepagePostBrief"> <div class="homepagePostBrief">
@ -52,20 +51,29 @@
</div> </div>
</div> </div>
<% end %> <% end %>
<% if act.org_act_type == 'OrgDocumentComment' %> <% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %>
<script> <script>
$(function() { $(function() {
init_activity_KindEditor_data(<%= act.org_act.id%>, null, "87%"); init_activity_KindEditor_data(<%= act.org_act.id%>, null, "87%");
}); });
</script> </script>
<div id="organization_document_<%= act.org_act.id %>">
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %> <%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %>
</div>
<% end %> <% end %>
<% end %> <% end %>
<ul class="wlist" style=" border:none; padding-top: 15px;"> <!--<ul class="wlist" style=" border:none; padding-top: 15px;">-->
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> <%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul> <!--</ul>-->
<% end %> <% end %>
<%# @org_project_activties.each do |org_act|%>
<%= render :partial => 'organizations/org_project_activities',
:locals => {:org_project_activties =>@org_project_activties,
:page=>@page,
:org => @organization,
:org_act_count=>@org_activities.count,
:pro_act_count=>@org_project_activties.count}%>
<%# end %>

View File

@ -0,0 +1,7 @@
$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'organizations/org_project_activities',
:locals => {:org_project_activties =>@org_project_activties,
:page=>@page,
:org => @organization,
:org_act_count=>@org_activities.count,
:pro_act_count=>@org_project_activties.count} )%>");

View File

@ -6,10 +6,10 @@
<div class="postBanner" style="padding-bottom:5px;"> <div class="postBanner" style="padding-bottom:5px;">
<span class="linkGrey2 f16">组织列表</span> <span class="linkGrey2 f16">组织列表</span>
<form class="resourcesSearchloadBox" style="float:right; margin-top:-5px;"> <!--<form class="resourcesSearchloadBox" style="float:right; margin-top:-5px;">-->
<input type="text" name="serach" placeholder="输入关键词进行搜索" class="searchResource"/> <!--<input type="text" name="serach" placeholder="输入关键词进行搜索" class="searchResource"/>-->
<a href="javascript:void(0);" class="homepageSearchIcon"></a> <!--<a href="javascript:void(0);" class="homepageSearchIcon"></a>-->
</form> <!--</form>-->
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<% @orgs.each do |org| %> <% @orgs.each do |org| %>

View File

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

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20151113025751) do ActiveRecord::Schema.define(:version => 20151112072948) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false

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(){ function submit_add_org_members(){
$("#org_member_add_form").submit(); $("#org_member_add_form").submit();
} }
@ -31,4 +31,15 @@ function observeSearchfield(fieldId, targetId, url) {
var timer = setInterval(check, 300); var timer = setInterval(check, 300);
$this.bind('keyup click mousemove', reset); $this.bind('keyup click mousemove', reset);
}); });
}
//显示更多的项目
function show_more_org_project(url){
$.get(
url,
{ page: $("#org_project_page_num").val() },
function (data) {
}
);
} }