pull request评论局部刷新及样式

This commit is contained in:
huang 2016-10-25 15:34:32 +08:00
parent 35c8157efa
commit 187a96b251
4 changed files with 6 additions and 7 deletions

View File

@ -179,7 +179,7 @@ class PullRequestsController < ApplicationController
begin
@comments = @g.create_merge_request_comment(@project.gpid, params[:id], content, User.current.gid)
respond_to do |format|
format.html{redirect_to project_pull_request_path(params[:id], :project_id => @project.id)}
format.js{redirect_to project_pull_request_path(params[:id], :project_id => @project.id)}
end
rescue Exception => e
@message = e.message

View File

@ -33,15 +33,12 @@
<ul class="new_roadmap_nav fl" >
<li class="new_roadmap_nav_hover" id="new_roadmap_nav_1" onclick="HoverLi(1);">
<%= link_to "评论<span class='new_roadmap_nav_taghover ml5' id='new_roadmap_num_1'>#{@comments_count}</span>".html_safe, pull_request_comments_project_pull_request_path(@request.id, :project_id => @project.id, :type => "1"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1" %>
<!--<a href="javascript:void(0);" id="new_roadmap_type_1" class="new_roadmap_type_nomal" >评论<span id="new_roadmap_num_1" class="new_roadmap_nav_taghover ml5">210</span></a>-->
</li>
<li id="new_roadmap_nav_2" onclick="HoverLi(2);">
<%= link_to "提交<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_2'>#{@commits_count}</span>".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => "2"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_2" %></li>
<!--<a href="javascript:void(0);" id="new_roadmap_type_2" class="new_roadmap_type_nomal" >提交<span id="new_roadmap_num_2" class="new_roadmap_nav_tagnomal ml5">25</span></a>-->
</li>
<li id="new_roadmap_nav_3" onclick="HoverLi(3);">
<%= link_to "改动<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_3'>#{@changes_count}</span>".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => "3"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_3" %></li>
<!--<a href="javascript:void(0);" id="new_roadmap_type_3" class="new_roadmap_type_nomal" >改动<span id="new_roadmap_num_3" class="new_roadmap_nav_tagnomal ml5">5</span></a>-->
</li>
</ul>

View File

@ -1,2 +1,3 @@
<%= render :partial => "pull_requests/pull_request_container" %>
<div id="pull_request_show">
<%= render :partial => "pull_requests/show" %>
</div>

View File

@ -1,3 +1,4 @@
<%# 详情页面和新建页面都会跳入,所以用两种局部刷新 %>
<%# 新建页面局部替换 %>
$("#pull_request_new_form").html('<%= escape_javascript(render :partial => "pull_requests/show") %>');
<%# 详情页面局部替换 %>
$("#pull_request_show").html('<%= escape_javascript(render :partial => "pull_requests/show") %>');