将pulrequest放入小铃铛消息并加入到待审批消息;调整贴吧样式,及其个人主页头部样式
This commit is contained in:
parent
14eea2f7c4
commit
84a0c1d7b7
|
@ -157,6 +157,9 @@ class PullRequestsController < ApplicationController
|
|||
def show
|
||||
# compare_pull_request source_project, source_branch, target_project, target_branch
|
||||
# compare_pull_request
|
||||
# 如何从个人主页点击进入,则将该消息设为“已读”
|
||||
ForgeMessage.where(:forge_message_id => params[:id], :forge_message_type => "PullRequest", :user_id => User.current.id, :viewed => false).update_all(:viewed => true)
|
||||
|
||||
@project_menu_type = 6
|
||||
@type = params[:type]
|
||||
@request = @g.merge_request(@project.gpid, params[:id])
|
||||
|
@ -191,6 +194,10 @@ class PullRequestsController < ApplicationController
|
|||
@status = @g.accept_merge_rquest(@project.gpid, params[:id], User.current.gid)
|
||||
# 接受后,给用户发消息
|
||||
send_message_to_author(@project.id, @status.author.try(:username), params[:id], 2)
|
||||
# 更新所有管理员的这条pullrequest消息为“已读”,并修改status值
|
||||
ForgeMessage.where(:forge_message_id => params[:id].to_i, :project_id => @project.id, :forge_message_type => "PullRequest", :status => 1).update_all(:viewed => true)
|
||||
# 更新pullrequest的status字段
|
||||
PullRequest.where(:pull_request_id => params[:id].to_i).update_all(:status => 2)
|
||||
|
||||
respond_to do |format|
|
||||
format.js{redirect_to project_pull_request_path(@status.id, :project_id => @project.id)}
|
||||
|
@ -226,6 +233,11 @@ class PullRequestsController < ApplicationController
|
|||
user = User.find_by_login(request.author.try(:username))
|
||||
status = params[:state] == "close" ? 4 : 3
|
||||
send_message_to_manager(@project.id, params[:id], status)
|
||||
# 更新所有管理员的消息为“已读”
|
||||
ForgeMessage.where(:forge_message_id => request.id, :project_id => @project.id, :forge_message_type => "PullRequest", :status => 1).update_all(:viewed => true)
|
||||
# 更新pullrequest的status字段
|
||||
PullRequest.where(:pull_request_id => params[:id].to_i).update_all(:status => status)
|
||||
|
||||
if is_project_manager?(User.current.id, @project.id)
|
||||
send_message_to_author(@project.id, user.login, request.id, status)
|
||||
end
|
||||
|
@ -360,7 +372,7 @@ class PullRequestsController < ApplicationController
|
|||
:project_id => project_id,
|
||||
:forge_message_id => pull_request_id,
|
||||
:forge_message_type => "PullRequest",
|
||||
:viewed => true,
|
||||
:viewed => false,
|
||||
:status => status,
|
||||
:operate_user_id => User.current.id,
|
||||
)
|
||||
|
|
|
@ -2037,7 +2037,7 @@ end
|
|||
|
||||
# 待审批的申请
|
||||
@applied_message_alls = []
|
||||
applied_messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage"]).includes(:message)
|
||||
applied_messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage", "ForgeMessage"]).includes(:message)
|
||||
applied_messages_all.each do |message_all|
|
||||
mess = message_all.message
|
||||
if !mess.nil?
|
||||
|
@ -2053,6 +2053,10 @@ end
|
|||
if mess.course_message_type == "JoinCourseRequest" && mess.status == 0
|
||||
@applied_message_alls << mess
|
||||
end
|
||||
elsif message_all.message_type == "ForgeMessage"
|
||||
if mess.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id=> mess.forge_message_id, :status => [1, 3]).count > 0
|
||||
@applied_message_alls << mess
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2248,7 +2252,7 @@ end
|
|||
def unapproval_applied_list
|
||||
@message_alls = []
|
||||
# messages_all = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")
|
||||
messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage"]).includes(:message).order("created_at desc")
|
||||
messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage", "ForgeMessage"]).includes(:message).order("created_at desc")
|
||||
messages_all.each do |message_all|
|
||||
mess = message_all.message
|
||||
if !mess.nil?
|
||||
|
@ -2264,15 +2268,18 @@ end
|
|||
if mess.course_message_type == "JoinCourseRequest" && mess.status == 0
|
||||
@message_alls << mess
|
||||
end
|
||||
=begin
|
||||
elsif message_all.message_type == "ForgeMessage"
|
||||
if mess.forge_message_type == "PullRequest" && PullRequest.where(:forge_message_id => mess.forge_message_id, :status =>0 )
|
||||
@message_alls << mess
|
||||
if mess.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).count > 0 && ForgeMessage.where(:forge_message_id => mess.forge_message_id, :status => 1).first.operate_user_id != mess.user_id && ForgeMessage.where(:forge_message_id => mess.forge_message_id, :status => [1, 3], :user_id => @user.id).last.id == mess.id
|
||||
if ForgeMessage.where(:forge_message_id => mess.forge_message_id, :status => 3).count > 0 && (ForgeMessage.where(:forge_message_id => mess.forge_message_id, :status => 3, :user_id => @user.id).count == 0 || ForgeMessage.where(:forge_message_id => mess.forge_message_id, :status => 3).last.operate_user_id == @user.id)
|
||||
next
|
||||
else
|
||||
@message_alls << mess
|
||||
end
|
||||
end
|
||||
=end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@message_count = @message_alls.count
|
||||
@message_alls = paginateHelper @message_alls, 20
|
||||
respond_to do |format|
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class PullRequest < ActiveRecord::Base
|
||||
# status 1:创建 2:接受 3:重新打开 4:关闭
|
||||
attr_accessible :gpid, :pull_request_id, :user_id, :project_id, :title
|
||||
attr_accessible :gpid, :pull_request_id, :user_id, :project_id, :title, :status
|
||||
validates_uniqueness_of :pull_request_id
|
||||
|
||||
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
|
||||
|
|
|
@ -2,14 +2,19 @@
|
|||
<div class="fl mr10"><%= link_to image_tag(url_to_avatar(User.current), :width => 50, :height => 50,:alt=>'贴吧图像' ), user_path( User.current) %></div>
|
||||
<div class="fl">
|
||||
<div class="f16 fontGrey2 ml38">我在问吧</div>
|
||||
<div class="homepageImageBlock" style="width: 68px !important;">
|
||||
<div><a href="javascript:void(0);" class="homepageImageNumber" style="cursor: default"><%= @my_memos_count %></a></div>
|
||||
<div class="homepageImageText">回答</div>
|
||||
<div class="homepageImageBlock" style="width: 75px !important;">
|
||||
<!--<div><a href="javascript:void(0);" class="homepageImageNumber" style="cursor: default"><%#= @my_memos_count %></a></div>-->
|
||||
<div class="mt10">
|
||||
<div class="homepageImageText fl ml10">回答</div>
|
||||
<div><a href="javascript:void(0);" class="homepageImageNumber fl ml10" style="cursor: default;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%= @my_memos_count %>"><%= @my_memos_count %></a></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="homepageVerDiv"></div>
|
||||
<div class="homepageImageBlock" style="width: 68px !important;">
|
||||
<div><a href="javascript:void(0);" class="homepageImageNumber" style="cursor: default"><%= @my_forums_count %></a></div>
|
||||
<div class="homepageImageText">发帖</div>
|
||||
<!-- <div class="homepageVerDiv"></div>-->
|
||||
<div class="homepageImageBlock" style="width: 70px !important;">
|
||||
<div class="mt10">
|
||||
<div class="homepageImageText fl ml10">发帖</div>
|
||||
<div><a href="javascript:void(0);" class="homepageImageNumber fl ml10" style="width:26px;cursor:default; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%= @my_forums_count %>"><%= @my_forums_count %></a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
|
||||
<% @forums.each_with_index do |forum, i| %>
|
||||
<div class="wenba-rightbar-li clearfix <%= i > 9 ? 'none' : ''%> " id="forum_list_<%= forum.id %>">
|
||||
<h4 class="fl wenba-rightbar-title mt5 ml10" style="border-bottom: 0px"><%= link_to forum.name, forum_path(forum), :class => "", :target => "_blank" %></h4>
|
||||
<ul class=" fl right-line wenba-rightbar-ul" >
|
||||
<li><%= link_to forum.memo_count, forum_path(forum), :class => "linkGrey5" %></li>
|
||||
<li>回答</li>
|
||||
</ul>
|
||||
<ul class=" fl wenba-rightbar-ul" >
|
||||
<li><%= link_to forum.topic_count, forum_path(forum), :class => "linkGrey5" %></li>
|
||||
<li>帖子</li>
|
||||
</ul>
|
||||
<% @forums.each_with_index do |forum, i| %>
|
||||
<div class="wenba-rightbar-li clearfix <%= i > 9 ? 'none' : ''%> " id="forum_list_<%= forum.id %>">
|
||||
<h4 class="fl wenba-rightbar-title mt5 ml10" style="border-bottom: 0px;font-weight: normal;"><%= link_to forum.name, forum_path(forum), :style => "color:#666;", :target => "_blank" %></h4>
|
||||
<div style="width: 40px; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" class="mt5 mr10 fr" title="回答数+帖子数">
|
||||
<%= link_to forum.topic_count + forum.memo_count, forum_path(forum), :class => "fontGrey4", :style => "font-size: 10px;" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -33,9 +33,10 @@
|
|||
<a href="<%= forum_memo_path(topic.forum, topic)%>" class="postReplyIcon mr5" target="_blank"></a>
|
||||
<% replies_count = Memo.where("root_id = #{topic.id}").count %>
|
||||
<%= link_to (replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %>
|
||||
<a href="javascript:void(0);" class="linkGrey2 disablePostLikeIcon ml10" style="cursor: default" title="点赞人数" > <%= get_praise_num(topic)%></a>
|
||||
<% if get_praise_num(topic) > 0 %>
|
||||
<a href="javascript:void(0);" class="linkGrey2 disablePostLikeIcon ml10" style="cursor: default" title="点赞人数" > <%= get_praise_num(topic)%></a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="postDetailDes maxh300" id = "postDetailDes_<%= topic.id %>">
|
||||
<div id="intro_content_<%= topic.id %>">
|
||||
<%= topic.content.html_safe%>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="postSort" id="popu"><a href="javascript:void(0);" class="linkGrey2 fl">人气</a><a href="javascript:void(0);" id="reorder_popu" class=""></a></div>
|
||||
<div class="postSort" id="complex"><a href="javascript:void(0);" class="linkGrey2 fl">综合</a><a href="javascript:void(0);" id="reorder_complex" class=""></a><!--<a href="javascript:void(0);" class="sortArrowActiveD"></a>--></div>
|
||||
<div class="creatPost" id="create_memo_btn">
|
||||
<%= link_to "发布新帖",new_forum_memo_path(:forum_id => Forum.first.id), :class => "c_white db creatPostIcon bBlue" %>
|
||||
<%= link_to "发布新帖",new_forum_memo_path(:forum_id => Forum.first.id), :class => "c_white db creatPostIcon bGreen" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<div class="wenba-rightbar fr">
|
||||
<div class="wenba-rightbar-top clearfix">
|
||||
<h3 class="fl ml10">问吧</h3>
|
||||
<%= link_to "新建贴吧", new_forum_path, :class => "btn-blue btn fr mt5 mr5", :remote => true %>
|
||||
<%= link_to "新建贴吧", new_forum_path, :class => "btn-blue forum_btn fr mt7 mr5", :remote => true %>
|
||||
</div>
|
||||
<div id="forums_right_list">
|
||||
<%= render :partial => "forums/right_bar" %>
|
||||
|
|
|
@ -58,11 +58,7 @@
|
|||
<% name = name%>
|
||||
|
||||
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
|
||||
<% if hidden_unproject_infos %>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、班级、项目、用户、资源以及帖子" />
|
||||
<% else %>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的项目、用户、资源以及帖子" />
|
||||
<% end %>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索" style="width: 300px" />
|
||||
<input type="hidden" name="search_type" id="type" value="all"/>
|
||||
<input type="text" style="display: none;"/>
|
||||
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
|
||||
|
|
|
@ -202,10 +202,10 @@
|
|||
<li><a href="<%=news_path(ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 发布了新闻:<%= ma.forge_message.title.html_safe%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>发布了新闻:<%= ma.forge_message.title.html_safe%></a></li>
|
||||
<% elsif ma.forge_message_type == "Comment" %>
|
||||
<li><a href="<%=news_path(ma.forge_message.commented.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 评论了新闻:<%= ma.forge_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>评论了新闻:<%= ma.forge_message.commented.title%></a></li>
|
||||
<%# elsif ma.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => ma.forge_message_id).count != 0%>
|
||||
<%# send_message_user = PullRequest.where(:pull_request_id => ma.forge_message_id) %>
|
||||
<%# author = User.find(ma.operate_user_id.nil? ? 2 : ma.operate_user_id) %>
|
||||
<!-- <li><a href="<%#= project_pull_requests_path(ma.project_id) %>" target="_blank" title="<%#= User.find(author.id).show_name %> <%#= pull_request_message_status(ma) %> <%#= send_message_user[0].title %>"><span class="shadowbox_news_user"><%#= User.find(author.id).show_name %> </span><%#= pull_request_message_status(ma) %> <%#= send_message_user[0].title %></a></li>-->
|
||||
<% elsif ma.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => ma.forge_message_id).count != 0%>
|
||||
<% send_message_user = PullRequest.where(:pull_request_id => ma.forge_message_id) %>
|
||||
<% author = User.find(ma.operate_user_id.nil? ? 2 : ma.operate_user_id) %>
|
||||
<li><a href="<%= project_pull_requests_path(ma.project_id) %>" target="_blank" title="<%= User.find(author.id).show_name %> <%= pull_request_message_status(ma) %> <%= send_message_user[0].title %>"><span class="shadowbox_news_user"><%= User.find(author.id).show_name %> </span><%= pull_request_message_status(ma) %> <%= send_message_user[0].title %></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.class == MemoMessage %>
|
||||
<% if ma.memo_type == "Memo" && !ma.memo.nil? && !ma.memo.author.nil? %>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= stylesheet_link_tag 'css/common','css/structure','css/public','css/forum','css/popup' ,:media => 'all'%>
|
||||
<%= stylesheet_link_tag 'css/common','css/structure','css/public','css/forum','css/popup', 'css/font-awesome', :media => 'all'%>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
|
|
|
@ -229,7 +229,7 @@
|
|||
</span>
|
||||
</li>
|
||||
<li class="messageInformationContents">
|
||||
<%= link_to "#{send_message_user[0].title}", project_pull_requests_path(ma.project_id),
|
||||
<%= link_to "#{send_message_user[0].title}", project_pull_request_path(ma.forge_message_id, :project_id => ma.project_id),
|
||||
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
|
||||
|
||||
</li>
|
||||
|
|
|
@ -418,6 +418,7 @@ a:hover.c_grey{ color:#333;}
|
|||
.c_green{ color:#28be6c;}
|
||||
.c_grey{color:#999;}
|
||||
.c_grey02{ color:#666666;}
|
||||
.c_grey03{ color:#bbbaba;}
|
||||
.c_dgrey{ color:#696969;}
|
||||
.c_dblue{ color:#09658c;}
|
||||
.c_white {color:#fff;}
|
||||
|
@ -473,6 +474,8 @@ a.linkGrey7 {color:#888888;}
|
|||
a.linkGrey7:hover {color:#269ac9;}
|
||||
a.bBlue {background-color:#3498db;}
|
||||
a.bBlue:hover {background-color:#297fb8;}
|
||||
a.bGreen {background-color:#60b25e;}
|
||||
a.bGreen:hover {background-color:#51a74f;}
|
||||
a.submit_btn {border:1px solid #3498db; padding:3px 10px; border-radius:3px; color:#3498db;}
|
||||
a.submit_btn:hover {background-color:#3498db; color:#ffffff;}
|
||||
a.link_file_a{ background:url(/images/pic_file.png) 0 2px no-repeat; padding-left:20px; }
|
||||
|
@ -856,6 +859,8 @@ a.export_icon:hover {background: url(/images/item.png) -58px -60px no-repeat;}
|
|||
.break_full_word { word-break: normal !important;word-wrap: break-word !important; }
|
||||
/*模板a标签按钮 20161013byLB*/
|
||||
a.btn{display: inline-block;border:none; padding:0 10px;color: #333;background: #e1e1e1; text-align:center;font-size: 12px; height: 30px;line-height: 30px;-webkit-border-radius: 3px;-moz-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; }
|
||||
a.forum_btn{display: inline-block;border:none; padding:0 10px;color: #333;background: #e1e1e1; text-align:center;font-size: 12px; height: 25px;line-height: 25px;-webkit-border-radius: 3px;-moz-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; }
|
||||
|
||||
a:hover.btn{background: #c3c3c3; color: #333;}
|
||||
a.btn-green{background: #60b25e; color: #fff;}
|
||||
a:hover.btn-green{background: #51a74f; color: #fff;}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
.wenba-rightbar{ border: 1px solid #ddd;background-color:#fff; width: 238px;}
|
||||
.wenba-h3-top{ font-size: 14px; color: #666; }
|
||||
.wenba-rightbar-top{ height: 40px; line-height: 40px; border-bottom:1px solid #ddd; }
|
||||
.wenba-rightbar-li{ padding:10px 0; border-bottom:1px solid #ddd; color: #666;}
|
||||
.wenba-rightbar-li{ padding:10px 0; color: #999;}
|
||||
.wenba-rightbar-title{ font-size: 14px; width: 145px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
|
||||
.right-line{ border-right:1px solid #ddd;}
|
||||
.wenba-rightbar-ul{ width: 40px; text-align: center;}
|
||||
.wenba-rightbar-ul{ width: auto; text-align: center; display: block}
|
||||
.wenba-rightbar-more{ padding:10px 0 ; text-align: center; display: block;}
|
||||
.wenba-tiwenbox{border: 1px solid #ddd;background-color:#fff; width: 718px; padding:15px;}
|
||||
.wenba-tiwen-con{ width: 100%; }
|
||||
|
|
Loading…
Reference in New Issue