Commit 3e71e568 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'add_issues_template' into 'master'

add issues template

This MR implements an issues template that can be set for a project.

![settings_issues_template](https://gitlab.com/gitlab-org/gitlab-ee/uploads/51c3b9cd82cbb2dfdce80ed5c0a406c3/settings_issues_template.png)  
![new_issue_issues_template](https://gitlab.com/gitlab-org/gitlab-ee/uploads/cd7d44440223923db676b88edd412eb9/new_issue_issues_template.png)

This closes gitlab-org/gitlab-ce#1378

@JobV @sytses you owe me a 🍺  😉 

This MR is only marked as WIP because the tests are still running and the `CHANGELOG` hasn't been updated to 8.1 yet.



See merge request !28
parents 086bf47e 926d3c9d
v 8.1.0 (unreleased)
- added an issues template (Hannes Rosenögger)
v 8.0.1
- Correct gem dependency versions
- Re-add the "Help Text" feature that was inadvertently removed
......
......@@ -47,6 +47,12 @@ class Projects::IssuesController < Projects::ApplicationController
)
@issue = @project.issues.new(issue_params)
# Set Issue description based on project template
if @project.issues_template.present?
@issue.description = @project.issues_template
end
respond_with(@issue)
end
......
......@@ -201,7 +201,7 @@ class ProjectsController < ApplicationController
params.require(:project).permit(
: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,
:wiki_enabled, :issues_template, :merge_requests_template, :visibility_level, :merge_requests_rebase_enabled,
:import_url, :last_activity_at, :namespace_id, :avatar,
:approvals_before_merge, :approver_ids, :reset_approvals_on_push, :merge_requests_ff_only_enabled
)
......
%fieldset.issues-feature
%legend
Issues:
.form-group
= f.label :issues_template, class: 'control-label' do
Description template
.col-sm-10
= f.text_area :issues_template, class: "form-control", rows: 3
......@@ -24,7 +24,7 @@
= f.label :merge_requests_template, class: 'control-label' do
Description template
.col-sm-10
= f.text_area :merge_requests_template, placeholder: "This MR should have: *", class: "form-control", rows: 3
= f.text_area :merge_requests_template, class: "form-control", rows: 3
.form-group
= f.label :approvals_before_merge, class: 'control-label' do
......
......@@ -77,6 +77,8 @@
%br
%span.descr Share code pastes with others out of git repository
= render 'issues_settings', f: f
= render 'merge_request_settings', f: f
%fieldset.features
......
class AddIssuesTemplateToProject < ActiveRecord::Migration
def change
add_column :projects, :issues_template, :text
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150920161119) do
ActiveRecord::Schema.define(version: 20150929160851) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -679,6 +679,7 @@ ActiveRecord::Schema.define(version: 20150920161119) do
t.boolean "reset_approvals_on_push", default: true
t.integer "commit_count", default: 0
t.boolean "merge_requests_ff_only_enabled", default: false
t.text "issues_template"
end
add_index "projects", ["created_at", "id"], name: "index_projects_on_created_at_and_id", using: :btree
......
......@@ -77,6 +77,14 @@ class Spinach::Features::Project < Spinach::FeatureSteps
expect(find_field('project_merge_requests_template').value).to eq 'This merge request should contain the following.'
end
step 'I fill in issues template' do
fill_in 'project_issues_template', with: "This issue should contain the following."
end
step 'I should see project with issues template saved' do
expect(find_field('project_issues_template').value).to eq 'This issue should contain the following.'
end
step 'I should see project "Shop" README link' do
page.within '.project-side' do
expect(page).to have_content "README.md"
......
......@@ -10,7 +10,7 @@ module SharedProject
# Create a specific project called "Shop"
step 'I own project "Shop"' do
@project = Project.find_by(name: "Shop")
@project ||= create(:project, name: "Shop", namespace: @user.namespace, snippets_enabled: true, merge_requests_template: "This merge request should contain the following.")
@project ||= create(:project, name: "Shop", namespace: @user.namespace, snippets_enabled: true, issues_template: "This issue should contain the following.", merge_requests_template: "This merge request should contain the following.")
@project.team << [@user, :master]
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