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 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

@ -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

@ -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>
<p id="organization_document_<%= document.id %>">
<%= render :partial => 'organizations/show_org_document', :locals => {:document => document} %> <%= render :partial => 'organizations/show_org_document', :locals => {:document => document} %>
</p>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -1,4 +1,4 @@
<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) %>
@ -6,8 +6,9 @@
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo"> <div class="homepagePostTo">
<%= link_to User.find(document.creator_id), user_path(document.creator.id), :class => "newsBlue mr15" %> <%= 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" %> | TO&nbsp;&nbsp;<%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %>
<% if defined?(home_id) %> |
<% if document.organization.home_id == document.id %>
<span style="color:#269ac9;">首页</span> <span style="color:#269ac9;">首页</span>
<% else %> <% else %>
<span style="color:#269ac9;">组织</span> <span style="color:#269ac9;">组织</span>
@ -46,10 +47,10 @@
</li> </li>
</ul> </ul>
</div> </div>
</div>
<div class="cl"></div> <div class="cl"></div>
</div>
<% end %> <% end %>
</div>
</div>
<% comments_for_doc = document.children.reorder("created_at desc") %> <% comments_for_doc = document.children.reorder("created_at desc") %>
<% count = document.children.count() %> <% count = document.children.count() %>

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%"); init_activity_KindEditor_data(<%= @organization.home_id%>, null, "87%");
}); });
</script> </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} %> <%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id} %>
</p>
<% end %> <% end %>
<% unless @activities.nil? %> <% unless @activities.nil? %>
@ -52,15 +51,13 @@
</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>
<p id="organization_document_<%= act.org_act.id %>" style="mt10">
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %> <%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %>
</p>
<% end %> <% end %>
<% end %> <% end %>
<ul class="wlist" style=" border:none; padding-top: 15px;"> <ul class="wlist" style=" border:none; padding-top: 15px;">
@ -69,3 +66,4 @@
<% end %> <% end %>

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 => 20151110011003) 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
@ -960,6 +960,7 @@ ActiveRecord::Schema.define(:version => 20151110011003) do
t.datetime "created_on" t.datetime "created_on"
t.integer "comments_count", :default => 0, :null => false t.integer "comments_count", :default => 0, :null => false
t.integer "course_id" t.integer "course_id"
t.integer "sticky", :default => 0
end end
add_index "news", ["author_id"], :name => "index_news_on_author_id" 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(){ function submit_add_org_members(){
$("#org_member_add_form").submit(); $("#org_member_add_form").submit();
} }
@ -32,3 +32,14 @@ function observeSearchfield(fieldId, targetId, url) {
$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) {
}
);
}