新建PR成功后JS跳转HTML跳转,相关页面局部刷新,及错误提示

This commit is contained in:
huang 2016-08-04 11:13:31 +08:00
parent a62ede1a33
commit 21747d02a2
7 changed files with 58 additions and 58 deletions

View File

@ -50,10 +50,10 @@ gem 'elasticsearch-model'
gem 'elasticsearch-rails'
#rails 3.2.22.2 bug
gem "test-unit", "~>3.0"
# gem "test-unit", "~>3.0"
### profile
gem 'oneapm_rpm'
# gem 'oneapm_rpm'
group :development do
gem 'grape-swagger'

View File

@ -1,19 +1,16 @@
<div id="create_pull_request_error">
<div id="pull_request_new_form">
<div id="create_pull_request_error">
<%= render :partial => "pull_requests/error_message" %>
</div>
</div>
<div id="new-merge-request" class="new-merge-request">
<div class="f14 fontGrey3 fb mb10">新的合并请求</div>
<!--<div>-->
<!--<span class="fl fontGrey2">从 <span class="fontGrey3 fb">dev_huang</span> 合并至 <span class="fontGrey3 fb">master</span></span><a href="javascript:void(0);" class="fr linkGrey2">修改分支</a>-->
<!--<div class="cl"></div>-->
<!--</div>-->
<div class="new-merge-request">
<div class="f14 fontGrey3 fb mb10">新的合并请求</div>
</div>
<%= render :partial => "pull_requests/form" %>
</div>
<%= render :partial => "pull_requests/form" %>
<script>
$("#new-merge-request").parent().css("width","730px");
$("#pull_request_new_form").parent().css("width","730px");
$("#changed-files").toggle(function(){
$("#changed-files-detail").show();

View File

@ -0,0 +1,43 @@
<div id="mergeShow" class="f14 fontGrey2 merge-show">
<span class="mr10 open-status">待处理</span><span class="mr10">合并请求</span> 由<%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>于<%= time_tag(@request.created_at) %>提交 · 最后编辑时间<%= time_tag(@request.updated_at) %>
<!--<a href="javascript:void(0);" class="BlueCirBtnMini fr mt5">编辑</a>-->
<div class="cl"></div>
</div>
<div class="new-merge-row b_grey"><strong><%= @request.title %></strong><p class="mt10"><%= @request.description %></p></div>
<div class="mt10 mb15">
请求将 <span class="fontGrey3 fb"><%= @request.source_branch %></span> 合并至 <span class="fontGrey3 fb"><%= @request.target_branch %></span>
<div class="merge-commit-option mt15">
<%= link_to "接受请求", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "BlueCirBtn" %>
</div>
</div>
<ul class="merge-record" style="border-top:1px solid #ddd;">
<li><%= link_to "提交<span class='project-number-dot'>#{@commits_count}</span>".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true, :class => "active" %></li>
<li><%= link_to "改动<span class='project-number-dot'>#{@changes_count}</span>".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => 2), :remote => true %></li>
</ul>
<div class="new-merge-row b_grey fontGrey2"><span class="ml10"> 根据最近提交时间排列</span></div>
<div id="merge_record_0">
<%= render :partial => "pull_requests/pull_request_commits" %>
</div>
<div id="merge_record_1" class="undis">
<%= render :partial => "pull_requests/pull_request_changes" %>
</div>
<script>
$("#mergeShow").parent().css("width","730px");
$("#changed-files").toggle(function(){
$("#changed-files-detail").show();
},function(){
$("#changed-files-detail").hide();
});
$(".merge-record li a").click(function(){
$(".merge-record li a").removeClass("active");
$(this).addClass("active");
var index = $(".merge-record li a").index(this);
$("#merge_record_0, #merge_record_1").hide();
$("#merge_record_" + index).show();
});
</script>

View File

@ -1 +1 @@
$("#create_pull_request_error").html('<%= escape_javascript(render :partial => "pull_requests/error_message") %>');
$("#create_pull_request_error").html('<%= escape_javascript(render :partial => "pull_requests/error_message") %>');

View File

@ -1,2 +1,3 @@
<%= render :partial => "pull_requests/pull_request_container" %>
<%= render :partial => "pull_requests/new" %>
<%= render :partial => "pull_requests/new" %>

View File

@ -1,44 +1,2 @@
<%= render :partial => "pull_requests/pull_request_container" %>
<div id="mergeShow" class="f14 fontGrey2 merge-show">
<span class="mr10 open-status">待处理</span><span class="mr10">合并请求</span> 由<%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>于<%= time_tag(@request.created_at) %>提交 · 最后编辑时间<%= time_tag(@request.updated_at) %>
<!--<a href="javascript:void(0);" class="BlueCirBtnMini fr mt5">编辑</a>-->
<div class="cl"></div>
</div>
<div class="new-merge-row b_grey"><strong><%= @request.title %></strong><p class="mt10"><%= @request.description %></p></div>
<div class="mt10 mb15">
请求将 <span class="fontGrey3 fb"><%= @request.source_branch %></span> 合并至 <span class="fontGrey3 fb"><%= @request.target_branch %></span>
<div class="merge-commit-option mt15">
<%= link_to "接受请求", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "BlueCirBtn" %>
</div>
</div>
<ul class="merge-record" style="border-top:1px solid #ddd;">
<li><%= link_to "提交<span class='project-number-dot'>#{@commits_count}</span>".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true, :class => "active" %></li>
<li><%= link_to "改动<span class='project-number-dot'>#{@changes_count}</span>".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => 2), :remote => true %></li>
</ul>
<div class="new-merge-row b_grey fontGrey2"><span class="ml10"> 根据最近提交时间排列</span></div>
<div id="merge_record_0">
<%= render :partial => "pull_requests/pull_request_commits" %>
</div>
<div id="merge_record_1" class="undis">
<%= render :partial => "pull_requests/pull_request_changes" %>
</div>
<script>
$("#mergeShow").parent().css("width","730px");
$("#changed-files").toggle(function(){
$("#changed-files-detail").show();
},function(){
$("#changed-files-detail").hide();
});
$(".merge-record li a").click(function(){
$(".merge-record li a").removeClass("active");
$(this).addClass("active");
var index = $(".merge-record li a").index(this);
$("#merge_record_0, #merge_record_1").hide();
$("#merge_record_" + index).show();
});
</script>
<%= render :partial => "pull_requests/show" %>

View File

@ -0,0 +1 @@
$("#pull_request_new_form").html('<%= escape_javascript(render :partial => "pull_requests/show") %>');