项目列表、项目讨论区列表
This commit is contained in:
parent
43c1120b19
commit
23f48b7189
|
@ -153,7 +153,6 @@ class BoardsController < ApplicationController
|
|||
elsif @course
|
||||
render_feed(@messages, :title => "#{@course}: #{@board}")
|
||||
end
|
||||
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -41,7 +41,7 @@ class UsersController < ApplicationController
|
|||
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,
|
||||
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
|
||||
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist]
|
||||
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist]
|
||||
before_filter :auth_user_extension, only: :show
|
||||
#before_filter :rest_user_score, only: :show
|
||||
#before_filter :select_entry, only: :user_projects
|
||||
|
@ -2890,6 +2890,48 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def user_projectlist
|
||||
@order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
|
||||
|
||||
#确定 sort_type
|
||||
if @order.to_i == @type.to_i
|
||||
@c_sort = @c_sort.to_i == 1 ? 2 : 1 #1升序 2降序
|
||||
else
|
||||
@c_sort = 2
|
||||
end
|
||||
|
||||
sort_name = "updated_on"
|
||||
sort_type = @c_sort == 1 ? "asc" : "desc"
|
||||
|
||||
if @user.projects.visible.count > 0
|
||||
project_order_ids = "(" +ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM (SELECT fa.project_id, MAX(fa.created_at) AS created_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ") GROUP BY fa.project_id) AS p ").map {|p| p.project_id}.join(",") + ")"
|
||||
@projects = Project.where("projects.id in #{project_order_ids}").order("#{sort_name} #{sort_type}")
|
||||
else
|
||||
@projects = []
|
||||
end
|
||||
|
||||
#根据 问题+资源数排序 @project.project_score.issue_num @project.project_score.attach_num
|
||||
if @order.to_i == 2
|
||||
@type = 2
|
||||
@c_sort == 1 ? (@projects = @projects.sort{|x,y| x.project_score.issue_num+x.project_score.attach_num <=> y.project_score.issue_num+y.project_score.attach_num }) : (@projects = @projects.sort{|x,y| y.project_score.issue_num+y.project_score.attach_num <=> x.project_score.issue_num+x.project_score.attach_num })
|
||||
else
|
||||
@type = 1
|
||||
end
|
||||
|
||||
#分页
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@atta_count = @projects.count
|
||||
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
||||
@offset ||= @atta_pages.offset
|
||||
@projects = paginateHelper @projects,@limit
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_user
|
||||
|
|
|
@ -72,4 +72,15 @@
|
|||
<input type="hidden" value="<%= page%>" id="course_page_num">
|
||||
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_course('<%= user_courses4show_user_path(user.id)%>');"></a>
|
||||
</li>
|
||||
<% end%>
|
||||
<% end%>
|
||||
<div id="user_hide_course">
|
||||
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
if(document.getElementsByClassName("coursesLineGrey").length > 0){
|
||||
$(".user_hide_course").html();
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -233,8 +233,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuForge').slideToggle();">项目</a>
|
||||
|
||||
<%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :class => "homepageMenuText" %>
|
||||
<% if is_current_user%>
|
||||
<%=link_to "", new_project_path(:host=> Setting.host_name), :class => "homepageMenuSetting fr", :style => "margin-right:10px;", :title => "新建项目"%>
|
||||
<% end%>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<% end %>
|
||||
<p><%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>activity.id, :content=>content} %></p>
|
||||
</div>
|
||||
<div class="ml15">
|
||||
<div class="ml15 mt10">
|
||||
<span class="grayTxt">发帖时间:<%= format_time(activity.created_on) %></span>
|
||||
<span class="grayTxt">更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %></span>
|
||||
<% count=0 %>
|
||||
|
|
|
@ -42,9 +42,9 @@
|
|||
<% end %>
|
||||
<p><%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>activity.id, :content=>content} %></p>
|
||||
</div>
|
||||
<div class="ml15">
|
||||
<div class="ml15 mt10">
|
||||
<span class="grayTxt">发帖时间:<%= format_time(activity.created_on) %></span>
|
||||
<span class="grayTxt">更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %></span>
|
||||
<span class="grayTxt">更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %></span>
|
||||
<% count=0 %>
|
||||
<% if activity.parent %>
|
||||
<% count=activity.parent.children.count%>
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
<div class="listbox">
|
||||
<h2 class="list-h2">项目列表</h2>
|
||||
<div class="category">
|
||||
<span class="grayTxt ">排序:</span>
|
||||
<%= link_to "时间", {:controller => 'users', :action => 'user_projectlist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
|
||||
<% if @type.to_i == 1 %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'user_projectlist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
|
||||
<% end %>
|
||||
<%= link_to "人气", {:controller => 'users', :action => 'user_projectlist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
|
||||
<% if @type.to_i == 2 %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'user_projectlist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="bloglistbox">
|
||||
<% @projects.each do |project|%>
|
||||
<ul class="list-file">
|
||||
<li>
|
||||
<span class="item_list fl"></span>
|
||||
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "course-title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
|
||||
<% projectUser = User.where("id=?",project.user_id).first%>
|
||||
<span class="fr grayTxt">
|
||||
<%='创建者:'+(projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)) %>
|
||||
</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml15">
|
||||
<span class="grayTxt">创建时间:<%= format_time(project.created_on) %></span>
|
||||
<p class="list-info fr grayTxt"><span><%= project.project_score.issue_num %></span><span>问题</span><span>|</span><span> <%= project.project_score.attach_num %></span><span>资源</span></p>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
<div>
|
||||
<ul class="wlist" id="pages" >
|
||||
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//如果右边的列表比左边的高度低则将右边的高度设为与左边对齐
|
||||
var leftHeight = $("#LSide").height()-$(".fontGrey5").height()-20;
|
||||
var rightHeight = $(".homepageRight").height();
|
||||
if (rightHeight < leftHeight){
|
||||
var diffHeight = leftHeight - rightHeight;
|
||||
var tmpHeight = $(".listbox").height()+diffHeight;
|
||||
$(".listbox").css("height",tmpHeight);
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
<div id="project-list">
|
||||
<%= render :partial => 'users/user_project_list'%>
|
||||
</div>
|
|
@ -0,0 +1 @@
|
|||
$("#project-list").html('<%= escape_javascript( render :partial => 'users/user_project_list') %>');
|
|
@ -552,6 +552,7 @@ RedmineApp::Application.routes.draw do
|
|||
|
||||
#addby yk
|
||||
match 'user_courselist', :to => 'users#user_courselist', :via => :get, :as => "user_courselist"
|
||||
match 'user_projectlist', :to => 'users#user_projectlist', :via => :get, :as => "user_projectlist"
|
||||
|
||||
get 'edit_brief_introduction'
|
||||
get "user_resource"
|
||||
|
|
|
@ -1200,3 +1200,31 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;}
|
|||
.popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;}
|
||||
.subjectType {width:70px; text-align:center;}
|
||||
.subjectCount {width:65px; text-align:center;}
|
||||
|
||||
/*博客列表界面样式*/
|
||||
a{text-decoration:none}
|
||||
.listbox{ width:730px; background-color:#fff; border:1px solid #ddd; padding:10px; }
|
||||
/*.bloglistbox{ min-height:690px;}*/
|
||||
.list-h2{ font-size:16px; font-weight:bold; color:#000; border-bottom:2px solid #269ac9; padding-bottom:5px;}
|
||||
.category{ padding:10px 0; border-bottom:1px solid #ddd;}
|
||||
.category a,.category span{ float:left; margin-right:5px;}
|
||||
.grayTxt{ color:#9093a6;}
|
||||
.category a.sortTxt{ color:#9093a6;}
|
||||
.category .sortTxt:hover{ color:#28be6c;}
|
||||
a.sortupbtn{ background: url(../images/liststyle.png) 0 3px no-repeat; width:12px; height:17px; display:block; margin-right:10px; cursor:pointer;}
|
||||
a.sortdownbtn{ background: url(../images/liststyle.png) 0 -12px no-repeat; width:12px; height:17px; display:block;margin-right:10px;cursor:pointer; }
|
||||
.item_list{ display:block; width:5px; height:5px;-webkit-border-radius: 25px;border-radius:25px; background-color:#adadad; margin:10px 10px 0 0;}
|
||||
.list-file a.list-title{ font-size:14px; font-weight: bold; color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; max-width:635px;}
|
||||
a:hover.list-title{ color:#269ac9;}
|
||||
.c_red{ font-weight:normal; font-size:12px;}
|
||||
.list-file{ padding:10px 0; border-bottom:1px dashed #ddd;}
|
||||
.list-file li{ line-height:1.9;}
|
||||
.list-info span{ margin-left:5px;}
|
||||
.pages a{ display:block; border:1px solid #d1d1d1; color:#000; float:left; width:30px; text-align:center; padding:3px 0; line-height:1.9; margin-right:5px; }
|
||||
.pages a:hover{ background-color:#269ac9; color:#fff;}
|
||||
a.pages-big{ width:50px;}
|
||||
.pages .active{ background-color:#269ac9; color:#fff;}
|
||||
.pages{width:330px; margin:20px auto 10px;}
|
||||
|
||||
.red-cir-btn{ background:#e74c3c; padding:1px 5px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;}
|
||||
.green-cir-btn{ background:#28be6c; padding:1px 5px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;}
|
||||
|
|
Loading…
Reference in New Issue