Merge branch 'dai_ao' into develop

This commit is contained in:
daiao 2016-11-29 12:11:47 +08:00
commit fe18d17a82
7 changed files with 122 additions and 60 deletions

View File

@ -90,51 +90,60 @@ class UsersController < ApplicationController
# order 排序条件
# subject 主题搜索用注意搜索和列表调用同一方法通过参数或者remote区分
def user_issues
@subject = params[:subject]
# author_id = params[:author_id]
params[:assigned_to_id].to_i == 0 ? @assigned_to = nil : @assigned_to = params[:assigned_to_id].to_i
params[:author_id].to_i == 0 ? author_id = nil : author_id = params[:author_id].to_i
params[:project_id].to_i == 0 ? @project_id = nil : @project_id = params[:project_id]
if @project_id.nil?
if @assigned_to.nil?
if author_id.nil?
@issues = Issue.where("(author_id =? or assigned_to_id =? ) and subject like ?",
@user.id , @user.id, "%#{@subject}%").order('updated_on desc')
@subject = params[:subject]
# author_id = params[:author_id]
params[:assigned_to_id].to_i == 0 ? @assigned_to = nil : @assigned_to = params[:assigned_to_id].to_i
params[:author_id].to_i == 0 ? author_id = nil : author_id = params[:author_id].to_i
params[:project_id].to_i == 0 ? @project_id = nil : @project_id = params[:project_id]
if @project_id.nil?
if @assigned_to.nil?
if author_id.nil?
@issues = Issue.where("(author_id =? or assigned_to_id =? ) and subject like ?",
@user.id , @user.id, "%#{@subject}%").order('updated_on desc')
else
@issues = Issue.where("author_id =? and subject like ?",
author_id , "%#{@subject}%").order('updated_on desc')
end
else
@issues = Issue.where("author_id =? and subject like ?",
author_id , "%#{@subject}%").order('updated_on desc')
@issues = Issue.where("assigned_to_id =? and subject like ?", @assigned_to, "%#{@subject}%").order('updated_on desc')
end
else
@issues = Issue.where("assigned_to_id =? and subject like ?", @assigned_to, "%#{@subject}%").order('updated_on desc')
end
else
if @assigned_to.nil?
if author_id.nil?
@issues = Issue.where("(author_id =? or assigned_to_id =? ) and project_id=? and subject like ?",
(author_id ? author_id : @user.id) , @user.id, @project_id, "%#{@subject}%").order('updated_on desc')
else
@issues = Issue.where("author_id =? and project_id=? and subject like ?",
author_id , @project_id, "%#{@subject}%").order('updated_on desc')
end
else
@issues = Issue.where("assigned_to_id =? and project_id=? and subject like ?",
@assigned_to, @project_id, "%#{@subject}%").order('updated_on desc')
if @assigned_to.nil?
if author_id.nil?
@issues = Issue.where("(author_id =? or assigned_to_id =? ) and project_id=? and subject like ?",
(author_id ? author_id : @user.id) , @user.id, @project_id, "%#{@subject}%").order('updated_on desc')
else
@issues = Issue.where("author_id =? and project_id=? and subject like ?",
author_id , @project_id, "%#{@subject}%").order('updated_on desc')
end
else
@issues = Issue.where("assigned_to_id =? and project_id=? and subject like ?",
@assigned_to, @project_id, "%#{@subject}%").order('updated_on desc')
end
end
end
@issues_filter = Issue.where("author_id =? or assigned_to_id =?", (author_id ? author_id : @user.id) , @user).order('updated_on desc')
@issues_assigned_count = Issue.where("assigned_to_id =? and subject like ?", @user.id, "%#{@subject}%").count
@issues_author_count = Issue.where("author_id =? and subject like ?", @user.id, "%#{@subject}%").count
@issue_open_count = Issue.where(" (author_id =? or assigned_to_id =?) and status_id in (1,2,3,4,6)", (author_id ? author_id : @user.id) , @user).count
@issue_close_count = Issue.where("(author_id =? or assigned_to_id =?) and status_id = 5", (author_id ? author_id : @user.id) , @user.id).count
@issue_count = @issues.count
@limit = 10
@is_remote = true
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
@offset ||= @issue_pages.offset
@issues = paginateHelper @issues, @limit
@issues_filter = Issue.where("author_id =? or assigned_to_id =?", (author_id ? author_id : @user.id) , @user).order('updated_on desc')
@issues_assigned_count = Issue.where("assigned_to_id =? and subject like ?", @user.id, "%#{@subject}%").count
@issues_author_count = Issue.where("author_id =? and subject like ?", @user.id, "%#{@subject}%").count
@issue_open_count = Issue.where(" (author_id =? or assigned_to_id =?) and status_id in (1,2,3,4,6)", (author_id ? author_id : @user.id) , @user).count
@issue_close_count = Issue.where("(author_id =? or assigned_to_id =?) and status_id = 5", (author_id ? author_id : @user.id) , @user.id).count
# 导出excel的issues
@excel_issues = @issues
@issue_count = @issues.count
@limit = 10
@is_remote = true
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
@offset ||= @issue_pages.offset
@issues = paginateHelper @issues, @limit
respond_to do |format|
format.html{render :layout => 'static_base'}
format.xls{
filename = "我的_#{l(:label_issue_list_xls)}.xls"
send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
format.api
format.js
end

View File

@ -12,7 +12,7 @@
<%= link_to "", project_pull_request_path(request.id, :project_id => @project.id), :class => "issues_icons_mes fr mr5 ml5" %>
</div>
<div class="c_grey clear mt5">
<p class="fl">由 <%= link_to request.author.try(:username), user_path(get_user_by_login_and(request.author.try(:username))), :class => "linkBlue2" %> 创建于<%= time_tag(request.created_at) %>前</p>
<p class="fl">由 <%= link_to User.find(request.author.id).try(:show_name), user_path(get_user_by_login_and(request.author.try(:username))), :class => "linkBlue2" %> 创建于<%= time_tag(request.created_at) %>前</p>
<span class="fl ml10"><%= time_tag(request.updated_at) %>前更新</span>
<p class="fr"><%= @project.name+"/"+request.source_branch %><span class="c_grey02 ml10 mr10">合并到</span><%= request.target_branch %></p>
</div>

View File

@ -10,7 +10,9 @@
<div style="text-align:left;">
<div style="width:auto; display:inline-block;">
<ul>
<a href="javascript:void(0)" class="hw_btn_blue ml10 mt10 mb10" style="visibility:hidden;" alt="导出EXCEL">导出EXCEL</a>
<!-- <a href="javascript:void(0)" class="hw_btn_blue ml10 mt10 mb10" style="visibility:hidden;" alt="导出EXCEL">导出EXCEL</a>-->
<%= link_to "导出EXCEL", user_issues_user_path(:format => 'xls'), :class => "hw_btn_blue ml10 mt10 mb10", :id=>"sendexcel",
:onclick => "remote_function_export('#{User.current}')"%>
</ul>
</div>

View File

@ -28,8 +28,15 @@
<% end %>
<% if ma.course_message_type == "Comment" && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to User.find(ma.course_message.author_id).show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">评论了通知:</span></li>
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);">
<%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author), :target => '_blank' %>
</a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.course_message.author_id).show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">评论了通知:</span>
</li>
<li class="homepageNewsContent fl">
<%= link_to ma.course_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" , :target => '_blank'%>
@ -48,8 +55,13 @@
<% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status.nil? && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);">
<%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %>
</a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了班级作业:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
@ -255,7 +267,13 @@
<% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 6 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag(url_to_avatar(User.find(ma.apply_user_id)), width: "30px", height: "30px", class: "mt3") %></div></a></li>
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);">
<div class="navHomepageLogo fl">
<%= image_tag(url_to_avatar(User.find(ma.apply_user_id)), width: "30px", height: "30px", class: "mt3") %>
</div>
</a>
</li>
<li class="homepageNewsPubType fl">
<%= link_to ma.course_message.user.show_name,
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
@ -280,8 +298,15 @@
<% end %>
<% if ma.course_message_type == "Poll" && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了问卷:</span></li>
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);">
<%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %>
</a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.course_message.user).show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了问卷:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to format_activity_title(" #{ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name}"), poll_path(ma.course_message.id),
:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}", :target => '_blank' %>
@ -296,9 +321,14 @@
<% end %>
<% if ma.course_message_type == "Message" && !ma.nil? && !ma.course_message.nil? %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);">
<%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author), :target => '_blank' %>
</a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.course_message.author.show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">
<%=link_to User.find(ma.course_message.author).show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">
<%= ma.course_message.parent_id.nil? ? "发布了班级帖子:" : "评论了班级帖子:" %></span></li>
<% if ma.course_message.parent_id.nil? %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
@ -388,9 +418,12 @@
<% if params[:type] != 'homework' %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a>
<a href="javascript:void(0);">
<%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %>
</a>
</li>
<li class="homepageNewsPubType fl"><%= link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<li class="homepageNewsPubType fl">
<%= link_to User.find(ma.course_message.user).show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">在班级中留言了:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
@ -409,9 +442,12 @@
<% elsif ma.course_message.jour_type == 'HomeworkCommon' %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a>
<a href="javascript:void(0);">
<%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %>
</a>
</li>
<li class="homepageNewsPubType fl"><%= link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<li class="homepageNewsPubType fl">
<%= link_to User.find(ma.course_message.user).show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">
<% if ma.course_message.m_parent_id.nil? %>
回复了您的<span class="fontBlue2" title="作业:<%=ma.course_message.jour.name %>">作业</span>
@ -435,7 +471,9 @@
<% else %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a>
<a href="javascript:void(0);">
<%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %>
</a>
</li>
<li class="homepageNewsPubType fl">
<%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname +
@ -452,7 +490,8 @@
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= User.current.show_name %>老师您好!
<%= ma.course_message.user.show_name%><%= ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"%>回复了您的作品评论。详情如下:
<%= User.find(ma.course_message.user).show_name %>
<%= ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"%>回复了您的作品评论。详情如下:
</p>
<ul class="ul_normal_color">
<li>回复内容:<span style="color:red;"><%= ma.course_message.notes %></span></li>

View File

@ -162,7 +162,7 @@
<% if ma.forge_message_type == "Message" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to User.find(ma.forge_message.user_id).show_name, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<li class="homepageNewsPubType fl"><%=link_to User.find(ma.forge_message.author).show_name, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %></span></li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.forge_message.subject, board_message_path(ma.forge_message.board_id, ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
@ -181,7 +181,7 @@
</a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.forge_message.user_id).show_name, user_path(ma.forge_message.author),
<%=link_to User.find(ma.forge_message.author).show_name, user_path(ma.forge_message.author),
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">评论了新闻:</span>
</li>

View File

@ -81,7 +81,8 @@
$("#issue_query_form").submit();
}
function remote_function_export(project_id) {
function remote_function_export(user) {
var project_id = $("#project_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");
@ -93,7 +94,7 @@
var priority_id = $("#priority_id").attr("value");
var issue_create_date_start = $("#issue_date_start_issue_export").attr("value");
var issue_create_date_end = $("#issue_date_end_issue_export").attr("value");
$("#sendexcel").attr("href","/projects/"+project_id+"/issues.xls?export=true&set_filter=1&tracker_id="+tracker_id+"&assigned_to_id="+assigned_to_id+"&fixed_version_id="+fixed_version_id+"&status_id="+status_id+"&done_ratio="+done_ratio+"&test="+test+"&author_id="+author_id+"&subject="+subject+"&issue_create_date_start="+issue_create_date_start+"&issue_create_date_end="+issue_create_date_end+"&priority_id="+priority_id);
$("#sendexcel").attr("href","/users/"+user+"/user_issues.xls?project_id="+project_id+"&tracker_id="+tracker_id+"&assigned_to_id="+assigned_to_id+"&fixed_version_id="+fixed_version_id+"&status_id="+status_id+"&done_ratio="+done_ratio+"&test="+test+"&author_id="+author_id+"&subject="+subject+"&issue_create_date_start="+issue_create_date_start+"&issue_create_date_end="+issue_create_date_end+"&priority_id="+priority_id);
///projects/1811/issues.xls?export=true&set_filter=1
}
function EnterPress(e){
@ -112,6 +113,7 @@
$("select[id='assigned_to_id']").find(assign).attr("selected", "selected");
$("select[id='author_id']").val('');
$("select[id='priority_id']").val('');
$("select[id='project_id']").val('');
$("select[id='tracker_id']").val('');
$("select[id='fixed_version_id']").val('');
$("select[id='status_id']").val('');
@ -137,6 +139,7 @@
$("select[id='author_id']").find(user).attr("selected", "selected");
$("select[id='assigned_to_id']").val('');
$("select[id='priority_id']").val('');
$("select[id='project_id']").val('');
$("select[id='tracker_id']").val('');
$("select[id='fixed_version_id']").val('');
$("select[id='status_id']").val('');
@ -225,7 +228,7 @@
</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 => "proeject_id", :name => "project_id", :class => "fl", :style=>"width: 80px; margin-right:20px;"}
{ :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>

View File

@ -0,0 +1,9 @@
class DeleteErrorMessageAllAndOrgMessage < ActiveRecord::Migration
def up
MessageAll.where("message_type = 'OrgMessage' and message_id in(15, 17, 18, 19, 170, 172, 173)").destroy_all
OrgMessage.where("organization_id in (30, 82)").destroy_all
end
def down
end
end