增加项目的显示

This commit is contained in:
lizanle 2015-11-14 10:45:49 +08:00
parent e1a88dedbb
commit 56613b6358
6 changed files with 46 additions and 11 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

@ -76,17 +76,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

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

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

@ -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) {
}
);
}