Commit 8c830688 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add ability to change amount of required approvals in project settings

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 5c0bfc17
......@@ -189,6 +189,10 @@
width: 250px !important;
}
.approve-btn {
margin-right: 10px;
}
.approved-by-users {
padding: 5px 12px;
padding: 5px 0;
}
......@@ -151,7 +151,7 @@ class ProjectsController < ApplicationController
end
def markdown_preview
text = params[:text]
text = params[:text]
ext = Gitlab::ReferenceExtractor.new(@project, current_user)
ext.analyze(text)
......@@ -188,7 +188,8 @@ class ProjectsController < ApplicationController
:name, :path, :description, :issues_tracker, :tag_list,
:issues_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id, :default_branch,
:wiki_enabled, :merge_requests_template, :visibility_level, :merge_requests_rebase_enabled,
:import_url, :last_activity_at, :namespace_id, :avatar, :merge_requests_rebase_default
:import_url, :last_activity_at, :namespace_id, :avatar, :merge_requests_rebase_default,
:approvals_before_merge
)
end
......
......@@ -152,6 +152,7 @@ class Project < ActiveRecord::Base
validate :avatar_type,
if: ->(project) { project.avatar.present? && project.avatar_changed? }
validates :avatar, file_size: { maximum: 200.kilobytes.to_i }
validates :approvals_before_merge, numericality: true, allow_blank: true
mount_uploader :avatar, AvatarUploader
......
......@@ -74,6 +74,15 @@
.col-sm-10
= f.text_area :merge_requests_template, placeholder: "This MR should have: *", disabled: !@project.merge_requests_enabled, class: "form-control", rows: 3
.form-group
= f.label :approvals_before_merge, class: 'control-label' do
Merge request approvals
.col-sm-10
= f.number_field :approvals_before_merge, disabled: !@project.merge_requests_enabled, class: "form-control"
.help-block
How many users should approve merge request before it can be accepted. 0 - approval is disabled
.form-group
= f.label :wiki_enabled, "Wiki", class: 'control-label'
.col-sm-10
......
......@@ -2,7 +2,7 @@
- unless @merge_request.approved_by?(current_user)
.pull-left
= form_for [:approve, @project.namespace.becomes(Namespace), @project, @merge_request], method: :post do |f|
= f.submit "Approve Merge Request", class: "btn btn-reopen"
= f.submit "Approve Merge Request", class: "btn btn-reopen approve-btn"
- if @merge_request.approvals.any?
.pull-left.approved-by-users
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment