diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 7db6e592e..58d1cb3b2 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -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 diff --git a/app/views/layouts/_show_messages_list.html.erb b/app/views/layouts/_show_messages_list.html.erb index 5bd4a956d..300cc0879 100644 --- a/app/views/layouts/_show_messages_list.html.erb +++ b/app/views/layouts/_show_messages_list.html.erb @@ -94,6 +94,26 @@ <%= 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}" %> + <% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 0 %> +
  • + <% content = ''+User.where("id=?", ma.applied_user_id).first.show_name+' 提交了申请:添加新的单位:'+"“"+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' %> +
  • + <% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 1 %> +
  • + <% content = "系统提示:“#{ma.name}”的申请,已通过审核。谢谢!" %> + <%= link_to content.html_safe, { :controller=> "my",:action => "account",:flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.name}”的申请,已通过审核。谢谢!", :target => '_blank'%> +
  • + <% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 2 %> +
  • + <% content = "系统提示:“#{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'%> +
  • + <% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 3 %> +
  • + <% content = "系统提示:“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!" %> + <%= link_to content.html_safe, { :controller=> "my",:action => "account", :flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!", :target => '_blank'%> +
  • <% end %> <% elsif ma.class == ForgeMessage %> <% if ma.forge_message_type == "AppliedProject" %> @@ -142,28 +162,6 @@ <% content = ''+ma.author.show_name+' 提到了你:'+ma.subject.html_safe %>
  • <%=link_to content.html_safe, ma.url, :title => ma.author.show_name+' 提到了你:'+ma.subject.html_safe, :target => '_blank' %>
  • <% end %> - <% elsif ma.class == AppliedMessage %> - <% if ma.applied_type == "ApplyAddSchools" && ma.status == 0 %> -
  • - <% content = ''+User.where("id=?", ma.applied_user_id).first.show_name+' 提交了申请:添加新的单位:'+"“"+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' %> -
  • - <% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 1 %> -
  • - <% content = "系统提示:“#{ma.name}”的申请,已通过审核。谢谢!" %> - <%= link_to content.html_safe, { :controller=> "my",:action => "account",:flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.name}”的申请,已通过审核。谢谢!", :target => '_blank'%> -
  • - <% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 2 %> -
  • - <% content = "系统提示:“#{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'%> -
  • - <% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 3 %> -
  • - <% content = "系统提示:“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!" %> - <%= link_to content.html_safe, { :controller=> "my",:action => "account", :flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!", :target => '_blank'%> -
  • - <% end %> <% end %> <% end %> diff --git a/app/views/pull_requests/_form.html.erb b/app/views/pull_requests/_form.html.erb index 52e3ed20a..d5de31723 100644 --- a/app/views/pull_requests/_form.html.erb +++ b/app/views/pull_requests/_form.html.erb @@ -9,11 +9,11 @@
    源分支
    - <%= 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;" %>
    目标分支
    <% 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 %> <% end %>
    + +
    提交请求 @@ -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() { diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index 30c640ee8..7bcf296a3 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -21,7 +21,7 @@ <% else %> <% if @request.state == "merged" %>
    - <%= 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) %> 前合并
    + <%#= 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) %> 前合并

    改动已合并至<%= @request.target_branch %>

    <% else %> diff --git a/lib/gitlab-cli/lib/gitlab/client/merge_requests.rb b/lib/gitlab-cli/lib/gitlab/client/merge_requests.rb index 17b12cdaa..2006c58bf 100644 --- a/lib/gitlab-cli/lib/gitlab/client/merge_requests.rb +++ b/lib/gitlab-cli/lib/gitlab/client/merge_requests.rb @@ -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