Commit 48311f05 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'template_for_merge_request_description' into 'master'

Template for merge request description
parents ccff1051 01a3f830
v 6.9.0 v 6.9.0
- Support Jira ticket mentions in format JIRA-123
- Add support for closing Jira tickets with commits and MR - Add support for closing Jira tickets with commits and MR
- Template for Merge Request description can be added in project settings
v 6.8.0 v 6.8.0
- Customise sign-in page with custom text and logo - Customise sign-in page with custom text and logo
......
...@@ -24,6 +24,14 @@ class Project ...@@ -24,6 +24,14 @@ class Project
else else
$('#project_issues_tracker_id').removeAttr('disabled') $('#project_issues_tracker_id').removeAttr('disabled')
$('#project_merge_requests_enabled').change ->
if ($(this).is(':checked') == true)
$('#project_merge_requests_template').removeAttr('disabled')
else
$('#project_merge_requests_template').attr('disabled', 'disabled')
$('#project_merge_requests_template').change()
@Project = Project @Project = Project
......
...@@ -80,6 +80,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -80,6 +80,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@diffs = compare_action.diffs @diffs = compare_action.diffs
@merge_request.title = @merge_request.source_branch.titleize.humanize @merge_request.title = @merge_request.source_branch.titleize.humanize
@merge_request.description = @merge_request.target_project.merge_requests_template
@target_project = @merge_request.target_project @target_project = @merge_request.target_project
@target_repo = @target_project.repository @target_repo = @target_project.repository
end end
......
...@@ -40,7 +40,8 @@ class Project < ActiveRecord::Base ...@@ -40,7 +40,8 @@ class Project < ActiveRecord::Base
attr_accessible :name, :path, :description, :issues_tracker, :label_list, attr_accessible :name, :path, :description, :issues_tracker, :label_list,
:issues_enabled, :wall_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id, :issues_enabled, :wall_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id,
:wiki_enabled, :visibility_level, :import_url, :last_activity_at, as: [:default, :admin] :wiki_enabled, :visibility_level, :import_url, :last_activity_at,
:merge_requests_template, as: [:default, :admin]
attr_accessible :namespace_id, :creator_id, as: :admin attr_accessible :namespace_id, :creator_id, as: :admin
......
...@@ -66,6 +66,13 @@ ...@@ -66,6 +66,13 @@
= f.check_box :merge_requests_enabled = f.check_box :merge_requests_enabled
%span.descr Submit changes to be merged upstream. %span.descr Submit changes to be merged upstream.
.form-group
= f.label :merge_requests_template, class: 'control-label' do
Merge request template
%span.light (optional)
.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 .form-group
= f.label :wiki_enabled, "Wiki", class: 'control-label' = f.label :wiki_enabled, "Wiki", class: 'control-label'
.col-sm-10 .col-sm-10
......
class AddMrTemplateToProject < ActiveRecord::Migration
def change
add_column :projects, :merge_requests_template, :text
end
end
...@@ -252,6 +252,7 @@ ActiveRecord::Schema.define(version: 20140513095908) do ...@@ -252,6 +252,7 @@ ActiveRecord::Schema.define(version: 20140513095908) do
t.boolean "archived", default: false, null: false t.boolean "archived", default: false, null: false
t.string "import_status" t.string "import_status"
t.float "repository_size", default: 0.0 t.float "repository_size", default: 0.0
t.text "merge_requests_template"
end end
add_index "projects", ["creator_id"], name: "index_projects_on_creator_id", using: :btree add_index "projects", ["creator_id"], name: "index_projects_on_creator_id", using: :btree
......
...@@ -139,3 +139,7 @@ Feature: Project Merge Requests ...@@ -139,3 +139,7 @@ Feature: Project Merge Requests
And I click link "Show inline discussion" of the second file And I click link "Show inline discussion" of the second file
Then I should see a comment like "Line is wrong" in the second file Then I should see a comment like "Line is wrong" in the second file
And I should still see a comment like "Line is correct" in the first file And I should still see a comment like "Line is correct" in the first file
Scenario: I submit new unassigned merge request with template description
Given I click link "New Merge Request"
Then I should see description field pre-filled
...@@ -24,3 +24,10 @@ Feature: Project Feature ...@@ -24,3 +24,10 @@ Feature: Project Feature
When I visit edit project "Shop" page When I visit edit project "Shop" page
And change project path settings And change project path settings
Then I should see project with new path settings Then I should see project with new path settings
Scenario: I visit edit project and fill in merge request template
When I visit edit project "Shop" page
Then I should see project settings
And I fill in merge request template
And I save project
Then I should see project with merge request template saved
...@@ -239,6 +239,10 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -239,6 +239,10 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end end
end end
step 'I should see description field pre-filled' do
find_field('merge_request_description').value.should == 'This merge request should contain the following.'
end
def project def project
@project ||= Project.find_by!(name: "Shop") @project ||= Project.find_by!(name: "Shop")
end end
......
...@@ -14,6 +14,8 @@ class ProjectFeature < Spinach::FeatureSteps ...@@ -14,6 +14,8 @@ class ProjectFeature < Spinach::FeatureSteps
step 'I should see project with new settings' do step 'I should see project with new settings' do
find_field('project_name').value.should == 'NewName' find_field('project_name').value.should == 'NewName'
find('#project_issues_enabled').should_not be_checked
find('#project_merge_requests_enabled').should be_checked
end end
step 'change project path settings' do step 'change project path settings' do
...@@ -24,4 +26,12 @@ class ProjectFeature < Spinach::FeatureSteps ...@@ -24,4 +26,12 @@ class ProjectFeature < Spinach::FeatureSteps
step 'I should see project with new path settings' do step 'I should see project with new path settings' do
project.path.should == "new-path" project.path.should == "new-path"
end end
step 'I fill in merge request template' do
fill_in 'project_merge_requests_template', with: "This merge request should contain the following."
end
step 'I should see project with merge request template saved' do
find_field('project_merge_requests_template').value.should == 'This merge request should contain the following.'
end
end end
...@@ -10,7 +10,7 @@ module SharedProject ...@@ -10,7 +10,7 @@ module SharedProject
# Create a specific project called "Shop" # Create a specific project called "Shop"
And 'I own project "Shop"' do And 'I own project "Shop"' do
@project = Project.find_by(name: "Shop") @project = Project.find_by(name: "Shop")
@project ||= create(:project, name: "Shop", namespace: @user.namespace) @project ||= create(:project, name: "Shop", namespace: @user.namespace, merge_requests_template: "This merge request should contain the following.")
@project.team << [@user, :master] @project.team << [@user, :master]
end end
......
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