Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
cxt 2016-08-09 10:40:25 +08:00
commit 547aae0743
5 changed files with 44 additions and 28 deletions

View File

@ -98,7 +98,7 @@ class PullRequestsController < ApplicationController
# @return [Gitlab::ObjectifiedHash]
def accept_pull_request
begin
status = @g.accept_merge_rquest(@project.gpid, params[:id])
status = @g.accept_merge_rquest(@project.gpid, params[:id], User.current.gid)
respond_to do |format|
format.js{redirect_to project_pull_request_path(status.id, :project_id => @project.id)}
end

View File

@ -94,6 +94,26 @@
<span><%= applied_project_tip_header(ma) %>以“<%= applied_project_message_type(ma.role) %>”身份加入<% project = Project.find(ma.project_id) %>
<%= link_to project.name, project_path(ma.project_id), :class => "link-blue", :target => '_blank', :title => "#{project.name}" %>
</span>
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 0 %>
<li>
<% content = '<span class="shadowbox_news_user">'+User.where("id=?", ma.applied_user_id).first.show_name+' </span>提交了申请:添加新的单位:'+"“"+ma.name+"”" %>
<%= link_to content.html_safe, unapplied_schools_path(:flag => 1, :applied_message_id => ma.id), :title => "#{User.where("id=?", ma.applied_user_id).first.show_name}提交了申请:添加新的单位“#{ma.name}”", :target => '_blank' %>
</li>
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 1 %>
<li>
<% content = "<span class='shadowbox_news_user'>系统提示:</span>“#{ma.name}”的申请,已通过审核。谢谢!" %>
<%= link_to content.html_safe, { :controller=> "my",:action => "account",:flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.name}”的申请,已通过审核。谢谢!", :target => '_blank'%>
</li>
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 2 %>
<li>
<% content = "<span class='shadowbox_news_user'>系统提示:</span>“#{ma.applied.name}”的申请,因名称不符合规范,系统已将其更改为“#{ma.name}”。谢谢!" %>
<%= link_to content.html_safe, { :controller=> "my",:action => "account", :flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.applied.name}”的申请,因名称不符合规范,系统已将其更改为“#{ma.name}”。谢谢!", :target => '_blank'%>
</li>
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 3 %>
<li>
<% content = "<span class='shadowbox_news_user'>系统提示:</span>“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!" %>
<%= link_to content.html_safe, { :controller=> "my",:action => "account", :flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!", :target => '_blank'%>
</li>
<% end %>
<% elsif ma.class == ForgeMessage %>
<% if ma.forge_message_type == "AppliedProject" %>
@ -142,28 +162,6 @@
<% content = '<span class="shadowbox_news_user">'+ma.author.show_name+' </span>提到了你:'+ma.subject.html_safe %>
<li><%=link_to content.html_safe, ma.url, :title => ma.author.show_name+' 提到了你:'+ma.subject.html_safe, :target => '_blank' %></li>
<% end %>
<% elsif ma.class == AppliedMessage %>
<% if ma.applied_type == "ApplyAddSchools" && ma.status == 0 %>
<li>
<% content = '<span class="shadowbox_news_user">'+User.where("id=?", ma.applied_user_id).first.show_name+' </span>提交了申请:添加新的单位:'+"“"+ma.name+"”" %>
<%= link_to content.html_safe, unapplied_schools_path(:flag => 1, :applied_message_id => ma.id), :title => "#{User.where("id=?", ma.applied_user_id).first.show_name}提交了申请:添加新的单位“#{ma.name}”", :target => '_blank' %>
</li>
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 1 %>
<li>
<% content = "<span class='shadowbox_news_user'>系统提示:</span>“#{ma.name}”的申请,已通过审核。谢谢!" %>
<%= link_to content.html_safe, { :controller=> "my",:action => "account",:flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.name}”的申请,已通过审核。谢谢!", :target => '_blank'%>
</li>
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 2 %>
<li>
<% content = "<span class='shadowbox_news_user'>系统提示:</span>“#{ma.applied.name}”的申请,因名称不符合规范,系统已将其更改为“#{ma.name}”。谢谢!" %>
<%= link_to content.html_safe, { :controller=> "my",:action => "account", :flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.applied.name}”的申请,因名称不符合规范,系统已将其更改为“#{ma.name}”。谢谢!", :target => '_blank'%>
</li>
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 3 %>
<li>
<% content = "<span class='shadowbox_news_user'>系统提示:</span>“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!" %>
<%= link_to content.html_safe, { :controller=> "my",:action => "account", :flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!", :target => '_blank'%>
</li>
<% end %>
<% end %>
<% end %>
</ul>

View File

@ -9,11 +9,11 @@
</div>
<div class="new-merge-wrap borderBottomNone">
<div class="merge-option-name fl" style="padding:5px 0">源分支</div>
<%= select_tag :branch, options_for_select(@source_rev), :name => "source_branch", :value => "source_branch", :class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;" %>
<%= select_tag :branch, options_for_select(@source_rev), :id => "source_branch", :name => "source_branch", :value => "source_branch", :class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;" %>
<div class="cl mb10"></div>
<div class="merge-option-name fl" style="padding:5px 0">目标分支</div>
<% if @forked_project.nil? %>
<%= select_tag :branch, options_for_select(@source_rev), :name => "target_branch", :value => "target_branch",:class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;", :id => "targetBranch" %>
<%= select_tag :branch, options_for_select(@source_rev), :id => "pull_request_branch", :name => "target_branch", :value => "target_branch",:class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;" %>
<% else %>
<select onchange="choice_branch(this.value, document.getElementById('pull_request_branch'), <%= @source_rev %>, <%= @forked_rev %>);" name="source_project" value="source_project" class="ml30 fontGrey3 fb fl" style = "padding:5px 0 5px 5px;">
<option value="source_project_name"><%= @source_project_name %></option>
@ -26,6 +26,8 @@
</select>
<% end %>
<div class="cl"></div>
<p id ="pull_request_branch_error" class="ml100 fontGrey2 mt5 c_red" style="display: none">同一个项目的源分支和目标分支不能相同</p>
<div class="cl"></div>
</div>
<div class="new-merge-row b_grey" style="border-top:1px solid #ddd;">
<a href="javascript:void(0);" class="BlueCirBtn fl ml10" onclick="pull_request_commit()">提交请求</a>
@ -50,6 +52,22 @@
}
}
function regex_branch()
{
var source_branch = $.trim($("#source_branch").val());
var target_branch = $.trim($("#pull_request_branch").val());
if(source_branch == target_branch)
{
$("#pull_request_branch_error").show();
return false;
}
else
{
$("#pull_request_branch_error").hide();
return true;
}
}
//提交pull request
function pull_request_commit()
{

View File

@ -21,7 +21,7 @@
<% else %>
<% if @request.state == "merged" %>
<div class="merge-commit-option mt15">
<span class="fontGrey3 fb" style="font-size:13px;"><a href="javascript:void(0);" class="link-blue"> <%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %></a>于<%= time_tag(@request.created_at) %> 前合并</span><br />
<span class="fontGrey3 fb" style="font-size:13px;"><%#= 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) %> 前合并</span><br />
<p class="fontGrey2 mt5">改动已合并至<%= @request.target_branch %></p>
</div>
<% else %>

View File

@ -118,8 +118,8 @@ class Gitlab::Client
# @param [Integer] project The ID of a project.
# @param [Integer] id The ID of a merge request.
# @return [Gitlab::ObjectifiedHash]
def accept_merge_rquest(project, id)
put("/projects/#{project}/merge_request/#{id}/merge")
def accept_merge_rquest(project, id, gid)
put("/projects/#{project}/merge_request/#{id}/merge?user_id=#{gid}")
end
private