个人主页tab列表

This commit is contained in:
daiao 2016-12-15 09:13:39 +08:00
parent 0d4dc89c73
commit ffd1e3942c
8 changed files with 246 additions and 112 deletions

View File

@ -35,7 +35,7 @@ class UsersController < ApplicationController
#
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list,
:user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
:watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
@ -1829,9 +1829,15 @@ class UsersController < ApplicationController
@message_count = @message_alls.count
@message_alls = paginateHelper @message_alls, 20
# 用户待解决的issue
@unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).count
my_course_ids = StudentsForCourse.where(:student_id => @user.id).blank? ? "(-1)" : "(" + StudentsForCourse.where(:student_id => @user.id).map{|sc| sc.course_id}.join(",") + ")"
=begin
@unsolved_issues = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).order("updated_on desc")
@unsolved_issues_count = @unsolved_issues.count
@unsolved_issue_pages = Paginator.new @unsolved_issues_count, 20, params['page'] || 1
@unsolved_issues = paginateHelper @unsolved_issues, 20
=end
@unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).order("updated_on desc").count
# 用户待完成的作业
my_course_ids = StudentsForCourse.where(:student_id => @user.id).blank? ? "(-1)" : "(" + StudentsForCourse.where(:student_id => @user.id).map{|sc| sc.course_id}.join(",") + ")"
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Date.today}'")
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
@ -1946,6 +1952,45 @@ class UsersController < ApplicationController
end
end
# 待解决的Issue
def unsolved_issues_list
@unsolved_issues = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).order("updated_on desc")
@unsolved_issues_count = @unsolved_issues.count
@limit = 20
@is_remote = true
@unsolved_issues_pages = Paginator.new @unsolved_issues_count, @limit, params['page'] || 1
@offset ||= @unsolved_issues_pages.offset
@unsolved_issues = paginateHelper @unsolved_issues, @limit
respond_to do |format|
format.js
end
end
# 待完成的作业
def unfinished_homework_list
end
# 待完成的测验
def unfinished_test_list
end
# 待完成的问卷
def unfinished_poll_list
end
# 待匿评的作业
def anonymous_evaluation_list
end
# 待审批的申请
def unapproval_homework_list
end
# 课程社区
def course_community
if params[:course_id] != nil

View File

@ -0,0 +1,53 @@
<div class="resources" >
<div class="clear" >
<table class="sy_new_table clear" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>标题</th>
<th style="width:160px">来源</th>
<th style="width:80px">发布人</th>
<th style="width:80px">优先度</th>
<th style="width:80px">状态</th>
</tr>
</thead>
<tbody>
<% @unsolved_issues.each do |ui| %>
<tr>
<th>
<li class="homepageTabTitle">
<%= link_to ui.subject.to_s, issue_path(ui), :target => "_blank", :class => "homepageTabTitle fl ml5" %>
</li>
</th>
<th>
<li class="homepageTabProjectName ml5">
<%= ui.project.try(:name) %>
<li>
</th>
<th>
<li class="homepageTabAuthor ml5" >
<% if ui.author.show_name == ' ' %>
<%= link_to ui.try(:author), user_path(ui.author_id) %>
<% else %>
<%= link_to ui.author.show_name, user_path(ui.author_id) %>
<% end %>
</li>
</th>
<th>
<li class="homepageTabAuthor ml5" >
<%= ui.priority.name %>
</li>
</th>
<th>
<li class="homepageTabAuthor ml5" >
<%= ui.status.name %>
</li>
</th>
</tr>
<% end %>
</tbody>
</table>
<ul class="pages" style="width: auto;display: table;margin-left: auto;margin-right: auto; padding-top: 10px">
<%= pagination_links_full @unsolved_issues_pages, @unsolved_issues_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
</div>
</div>

View File

@ -9,15 +9,15 @@
return document.getElementById(o);
}
function HoverLi(n){
g('message_all_list').className='undis';
// g('message_all_list').className='undis';
//如果有N个标签,就将i<=N;
for(var i = 1; i <= 6; i++){
if (g('user_homepage_tab_'+i) != null)
g('user_homepage_tab_'+i).className='flex-cell_homepage';
if(g('message_list_content_'+i) != null)
g('message_list_content_'+i).className='undis';
// if(g('message_list_content_'+i) != null)
// g('message_list_content_'+i).className='undis';
}
g('message_list_content_'+1).className='dis';
// g('message_list_content_'+n).className='dis';
g('user_homepage_tab_'+n).className='homepageClickBackground';
}
</script>
@ -26,7 +26,7 @@
<div class="flex-container_homepage">
<% if @unsolved_issues_count > 0 %>
<div class="flex-cell_homepage" id="user_homepage_tab_1" onclick="HoverLi(1);">
<a href="javascript:void(0)">
<a href="<%= unsolved_issues_list_user_path(@user)%>" data-remote = "true" >
<div class="homepage_tab_div" style="">
<span style="margin: 5px auto; vertical-align: middle; display: inline-block;">
<li class="homepage_issue_tab mb5 fl"></li>
@ -120,7 +120,7 @@
<% end %>
</div>
</div>
<div id="message_all_list">
<div id="user_homepage_message_list">
<div class="homepageRightBanner">
<div class="NewsBannerName">
消息动态
@ -130,15 +130,44 @@
</span>
</div>
<div class="resources">
<div>
<%= render :partial => 'users/new_user_message', :locals => { :message_alls => @message_alls } %>
</div>
</div>
</div>
<!-- <div class="resources" >
<%#= render :partial => 'users/homepage_tab_list' %>
</div>-->
<!-- 待解决issue -->
<div class="issues_filter undis" id="message_list_content_1">
<!--<div id="message_list_content_1" class="undis">
<div class="resources" >
<%#= render :partial => 'users/unsolved_issues_list', :locals => { :unsolved_issues => @unsolved_issues } %>
</div>
</div>
<div id="message_list_content_2" class="undis">
<div class="resources">
2222
</div>
</div>
<div id="message_list_content_3" class="undis">
<div class="resources">
333
</div>
</div>
<div id="message_list_content_4" class="undis">
<div class="resources">
444
</div>
</div>
<div id="message_list_content_5" class="undis">
<div class="resources">
5555
</div>
</div>
<div id="message_list_content_6" class="undis">
<div class="resources">
6666
</div>
</div>-->
<% else %>
<div class="homepageRightBanner">
<div class="NewsBannerName">Ta的动态</div>

View File

@ -0,0 +1 @@
$("#user_homepage_message_list").replaceWith("<%= escape_javascript( render :partial => 'users/unsolved_issues_list') %>");

View File

@ -4,7 +4,7 @@
<script xmlns="http://www.w3.org/1999/html">
function add_style(){
// $("#proeject_id").val("来源");
// $("#proeject_id").val("来源");
if($("select[id='tracker_id']").val() != 0){
$("#tracker_id").addClass('issues_filter_active');
}
@ -83,7 +83,7 @@
function remote_function_export(user) {
var project_id = $("#project_id").attr("value");
var tracker_id = $("#tracker_id").attr("value");
var tracker_id = $("#tracker_id").attr("value");
var subject = $("#v_subject").attr("value");
var assigned_to_id = $("#assigned_to_id").attr("value");
var fixed_version_id = $("#fixed_version_id").attr("value");
@ -175,98 +175,98 @@
<!--缺陷列表开始-->
<div id="myissues_con" class="myissues_con mb10">
<div class="myissues_head mb5">
<h2 class="ml15">我的Issue</h2>
</div>
<div class="clear mb5">
<div class="issues_statistics fl">
<ul>
<li>所有<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issues_filter.count %></a></li>
<li>开启<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issue_open_count %></a></li>
<li>关闭<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issue_close_count %></a></li>
</ul>
</div><!--issues_statistics end-->
</div>
<%= form_tag( user_issues_user_path(@user), :remote=>'xls', :method => "post", :id=>"issue_query_form", :class => 'query_form') do %>
<div class="clear mb10">
<div class="hw_search_box fl ">
<input class="hw_search-input" placeholder="输入Issue名称进行搜索" type="text" id="v_subject" name="subject" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
<a href="javascript:void(0);" class="hw_btn_search" onclick="remote_function();" ></a>
<div class="myissues_head mb5">
<h2 class="ml15">我的Issue</h2>
</div>
<a href="javascript:void(0);" class="sy_btn_grey fl ml5" onclick="all_reset_form();">清除</a>
<!-- <div class="issues_filter_data fr">
<input type="text" placeholder="开始日期" class="issues_calendar_input fl " ><a href="" class="issues_data_img fl" style="border-right:none;"></a>
<input type="text" placeholder="结束日期" class="issues_calendar_input fl " ><a href="" class="issues_data_img fl"></a>
</div>-->
</div>
<div class="clear mb5">
<div class="issues_statistics fl">
<ul>
<li>所有<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issues_filter.count %></a></li>
<li>开启<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issue_open_count %></a></li>
<li>关闭<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issue_close_count %></a></li>
</ul>
</div><!--issues_statistics end-->
<div class="issues_con_list" style="position: relative;">
<ul id="issues_list_nav" >
<li id="issues_list_nav_1" class="issues_nav_hover" onclick="HoverLi(1);all_reset_form();">
<a href="javascript:void(0);" id="issues_type_1" onclick="all_reset_form();" >搜索结果</a>
<span id="issue_filter_all"><%= render :partial => "users/my_issue_filter_all" %></span>
</li>
<li id="issues_list_nav_2" onclick="HoverLi(2);">
<a href="javascript:void(0);" id="issues_type_2" onclick="switch_assign_to(<%= User.current.id %>)">指派给我
<span id="issue_assigned_count"><%= render :partial => "users/my_issue_assigned_filter" %></span>
</a>
</li>
<li id="issues_list_nav_3" onclick="HoverLi(3);">
<a href="javascript:void(0);" id="issues_type_3" onclick="createByMe(<%= User.current.id %>)">我的发布<span class="issues_nav_tag ml5">
</div>
<%= form_tag( user_issues_user_path(@user), :remote=>'xls', :method => "post", :id=>"issue_query_form", :class => 'query_form') do %>
<div class="clear mb10">
<div class="hw_search_box fl ">
<input class="hw_search-input" placeholder="输入Issue名称进行搜索" type="text" id="v_subject" name="subject" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
<a href="javascript:void(0);" class="hw_btn_search" onclick="remote_function();" ></a>
</div>
<a href="javascript:void(0);" class="sy_btn_grey fl ml5" onclick="all_reset_form();">清除</a>
<!-- <div class="issues_filter_data fr">
<input type="text" placeholder="开始日期" class="issues_calendar_input fl " ><a href="" class="issues_data_img fl" style="border-right:none;"></a>
<input type="text" placeholder="结束日期" class="issues_calendar_input fl " ><a href="" class="issues_data_img fl"></a>
</div>-->
</div>
<div class="issues_con_list" style="position: relative;">
<ul id="issues_list_nav" >
<li id="issues_list_nav_1" class="issues_nav_hover" onclick="HoverLi(1);all_reset_form();">
<a href="javascript:void(0);" id="issues_type_1" onclick="all_reset_form();" >搜索结果</a>
<span id="issue_filter_all"><%= render :partial => "users/my_issue_filter_all" %></span>
</li>
<li id="issues_list_nav_2" onclick="HoverLi(2);">
<a href="javascript:void(0);" id="issues_type_2" onclick="switch_assign_to(<%= User.current.id %>)">指派给我
<span id="issue_assigned_count"><%= render :partial => "users/my_issue_assigned_filter" %></span>
</a>
</li>
<li id="issues_list_nav_3" onclick="HoverLi(3);">
<a href="javascript:void(0);" id="issues_type_3" onclick="createByMe(<%= User.current.id %>)">我的发布<span class="issues_nav_tag ml5">
<%= @issues_author_count %>
</span></a>
</li>
<div class="cl"></div>
</ul>
<div class="issues_filter">
<div class="issues_form_filter mt5 mr5">
<!-- <select placeholder=" 来源" class="fl mr10" >
<option value="0" selected="selected">来源</option>
<option value="8166">123</option>
<option value="8166">123s</option>
</select>-->
<%= select( :project, :project_id, options_for_issue_project_list(@issues_filter),
{ :include_blank => false,:selected => @project_id ? @project_id : 0 },
{ :onchange => "remote_function();add_style();",:id => "project_id", :name => "project_id", :class => "fl", :style=>"width: 80px; margin-right:20px;"}
)%>
<select placeholder=" 发布人" class="fl my_issues_filter" disabled="disabled" style="padding:0px;width: 50px;margin-right: 15px;">
<option value="0" selected="selected">发布人</option>
</select>
<%= select( :issue, :user_id, [[@user.show_name, @user.id]].unshift(["发布人",0]),
{ :include_blank => false,:selected => @author_id ? @author_id : 0},
{:onchange => "remote_function();add_style();",:id => "author_id", :name => "author_id", :class => "fl", :style => "visibility:hidden;width: 0px;margin:0px;padding:0px;"}
)
%>
</li>
<div class="cl"></div>
</ul>
<div class="issues_filter">
<div class="issues_form_filter mt5 mr5">
<!-- <select placeholder=" 来源" class="fl mr10" >
<option value="0" selected="selected">来源</option>
<option value="8166">123</option>
<option value="8166">123s</option>
</select>-->
<%= select( :project, :project_id, options_for_issue_project_list(@issues_filter),
{ :include_blank => false,:selected => @project_id ? @project_id : 0 },
{ :onchange => "remote_function();add_style();",:id => "project_id", :name => "project_id", :class => "fl", :style=>"width: 80px; margin-right:20px;"}
)%>
<select placeholder=" 发布人" class="fl my_issues_filter" disabled="disabled" style="padding:0px;width: 50px;margin-right: 15px;">
<option value="0" selected="selected">发布人</option>
</select>
<%= select( :issue, :user_id, [[@user.show_name, @user.id]].unshift(["发布人",0]),
{ :include_blank => false,:selected => @author_id ? @author_id : 0},
{:onchange => "remote_function();add_style();",:id => "author_id", :name => "author_id", :class => "fl", :style => "visibility:hidden;width: 0px;margin:0px;padding:0px;"}
)
%>
<select placeholder=" 类型" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px;width:35px; margin-right:10px;">
<option value="0" selected="selected">类型</option>
</select>
<select placeholder=" 指派给" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin-right: 15px;">
<option value="0" selected="selected">指派给</option>
</select>
<%= select( :issue, :user_id, [[@user.show_name, @user.id]].unshift(["指派给",0]),
{ :include_blank => false, :selected => @assigned_to ? @assigned_to : 0},
{:onchange=>"remote_function();add_style();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"fl", :style => "visibility:hidden; width:0px;margin:0px;padding:0px;"} )
%>
<select placeholder=" 优先度" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px">
<option value="0" selected="selected">优先度</option>
</select>
<select placeholder=" 里程碑" class="fl my_issues_filter" disabled="disabled" style="padding:0px;margin-left: 20px; margin-right: 10px">
<option value="0" selected="selected">里程碑</option>
</select>
<select placeholder=" 状态" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin-right:10px;width:35px;">
<option value="0" selected="selected">状态</option>
</select>
<select placeholder=" 完成度" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px">
<option value="0" selected="selected">完成度</option>
</select>
<select placeholder=" 排序" class="fl my_issues_filter" disabled="disabled" style="width:50px;visibility:hidden;margin-left: 0px;margin-right: 0px;">
<option value="0" selected="selected">排序</option>
</select>
</div>
<div class="cl"></div>
</div>
<select placeholder=" 类型" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px;width:35px; margin-right:10px;">
<option value="0" selected="selected">类型</option>
</select>
<select placeholder=" 指派给" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin-right: 15px;">
<option value="0" selected="selected">指派给</option>
</select>
<%= select( :issue, :user_id, [[@user.show_name, @user.id]].unshift(["指派给",0]),
{ :include_blank => false, :selected => @assigned_to ? @assigned_to : 0},
{:onchange=>"remote_function();add_style();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"fl", :style => "visibility:hidden; width:0px;margin:0px;padding:0px;"} )
%>
<select placeholder=" 优先度" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px">
<option value="0" selected="selected">优先度</option>
</select>
<select placeholder=" 里程碑" class="fl my_issues_filter" disabled="disabled" style="padding:0px;margin-left: 20px; margin-right: 10px">
<option value="0" selected="selected">里程碑</option>
</select>
<select placeholder=" 状态" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin-right:10px;width:35px;">
<option value="0" selected="selected">状态</option>
</select>
<select placeholder=" 完成度" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px">
<option value="0" selected="selected">完成度</option>
</select>
<select placeholder=" 排序" class="fl my_issues_filter" disabled="disabled" style="width:50px;visibility:hidden;margin-left: 0px;margin-right: 0px;">
<option value="0" selected="selected">排序</option>
</select>
</div>
<div class="cl"></div>
</div>
<% end %>
<% if @issues.empty? %>
<p class="nodata mt10"><%= l(:label_no_data) %></p>
@ -275,15 +275,15 @@
<%= render :partial => 'users/all_issue_list', :locals => {:issues => @issues, :issue_pages => @issue_pages,:issue_count => @issue_count, :subject => @subject } %>
</div>
<% end %>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div><!--issues_filter end-->
<div id="issues_list_content_1">
</div><!--issues_list_content_1 end-->
<div id="issues_list_content_2" class="undis">
</div><!--issues_list_content_2 end-->
<div id="issues_list_content_3" class="undis">
</div><!--issues_list_content_3 end-->
<div id="issues_list_content_1">
</div><!--issues_list_content_1 end-->
<div id="issues_list_content_2" class="undis">
</div><!--issues_list_content_2 end-->
<div id="issues_list_content_3" class="undis">
</div><!--issues_list_content_3 end-->
<!--issues_con_list end-->

View File

@ -691,6 +691,7 @@ RedmineApp::Application.routes.draw do
get 'expand_courses'
get 'cancel_or_collect'
get 'homepage'
get 'unsolved_issues_list'
# end
end
#resources :blogs

View File

@ -168,3 +168,9 @@ a.user_navmorebox .user_icons_closeclass{display:block;position: absolute;top:5p
.user_navmore_txt li a.user_navmore_li {font-size:12px;color:#888; display:block; width:75px;height:24px;line-height:24px; }
.user_navmore_txt li a.user_navmore_add{ width:10px;color:#888; padding:0 5px; }
.user_navmore_txt li:hover,.user_navmore_txt li a:hover{background-color:#f0f0f0;}
/* 新版个人主页 */
#messageTabList li { float:left; padding:10px 15px; text-align:center; }
.homepageTabTitle { max-width:330px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
.homepageTabProjectName{ max-width:160px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis; }
.homepageTabAuthor { max-width:80px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis; }

View File

@ -1895,6 +1895,5 @@ a.winbox_btn_close{
.winbox_p{
font-size: 14px;
text-align: center;
}
}