socialforge/app/views/pull_requests/_show.html.erb

81 lines
4.8 KiB
Plaintext

<div id="create_pull_request_error">
<%= render :partial => "pull_requests/error_message" %>
</div>
<div id="pull_request_show">
<div id="mergeShow" class="f14 fontGrey2 merge-show">
<span class="mr10 open-status"><%= get_state(@request.state) %></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) %> 前
<% if User.current.login == @request.author.try(:username) || is_project_manager?(User.current.id, @project.id) %>
<% unless @request.state == "merged" %>
<%= link_to "#{@request.state == 'closed' ? '重新打开' : '关闭'}", update_pull_request_project_pull_request_path(@request.id, :project_id => @project.id, :state => @request.state =="closed" ? "reopen" : "close"), :class => "BlueCirBtn fr" %>
<% end %>
<% end %>
<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">
<%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>
请求将 <span class="fontGrey3 fb"><%= @request.source_branch %></span> 合并至 <span class="fontGrey3 fb"><%= @request.target_branch %></span>
<% if @commits_count == 0 && @changes_count == 0 %>
<div class="merge-commit-option mt15">
<span class="fontGrey3 fb" style="font-size:13px;"><img src="/images/warning.png" width="16" class="mr5 mt2 fl"><%= @request.source_branch %>没有新内容可以合并至<%= @request.target_branch %></span><br />
<p class="fontGrey2 mt5">请将新改动提交至源分支或者切换到其它目标分支</p>
</div>
</div>
<% else %>
<% if @request.state == "merged" %>
<div class="merge-commit-option mt15">
<% if accept_user(@request.id).blank? %>
<p class="fontGrey2 mt5">改动已合并至<%= @request.target_branch %></p>
<% else %>
<span class="fontGrey3 fb" style="font-size:13px;"><%= link_to User.find(accept_user(@request.id).user_id), user_path(accept_user(@request.id).user_id), :class => "link-blue" %> 于 <%= time_tag(accept_user(@request.id).created_at) %> 前合并</span><br />
<% end %>
</div>
<% else %>
<% if is_project_manager?(User.current.id, @project.id) %>
<div class="merge-commit-option mt15">
<% if @request.state == "closed" %>
该请求已被关闭
<% else %>
<%= link_to "接受请求", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "BlueCirBtn", :remote => true %>
<% end %>
</div>
<% end %>
<% end %>
</div>
<ul class="merge-record" style="border-top:1px solid #ddd;">
<li><%= link_to "留言<span class='project-number-dot'>#{@comments_count}</span>".html_safe, pull_request_comments_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'>#{@commits_count}</span>".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => "2"), :remote => true %></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 => "3"), :remote => true %></li>
</ul>
<% if @type == nil || @type == "1" %>
<div id="merge_record_0">
<%= render :partial => "pull_requests/pull_request_comments" %>
</div>
<% end %>
<div id="merge_record_1" class="undis">
<%= render :partial => "pull_requests/pull_request_commits" %>
</div>
<div id="merge_record_2" class="undis">
<%= render :partial => "pull_requests/pull_request_changes" %>
</div>
<% end %>
</div>
<script>
$("#pull_request_show").parent().css({"width":"730px","background-color":"#fff","padding":"10px","margin-left":"10px","margin-bottom":"10px"});
$(".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, #merge_record_2").hide();
$("#merge_record_" + index).show();
});
</script>