diff --git a/CHANGELOG-EE b/CHANGELOG-EE index d40520a59a..e549b92ddf 100644 --- a/CHANGELOG-EE +++ b/CHANGELOG-EE @@ -1,3 +1,6 @@ +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 diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 0f89f2e88c..089aafc81e 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -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 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 2350191b6b..f10bca9720 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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 ) diff --git a/app/views/projects/_issues_settings.html.haml b/app/views/projects/_issues_settings.html.haml new file mode 100644 index 0000000000..7629192da8 --- /dev/null +++ b/app/views/projects/_issues_settings.html.haml @@ -0,0 +1,11 @@ +%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, placeholder: "This Issue should have: *", class: "form-control", rows: 3 + + diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 65c052319e..672d92fd2c 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -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 diff --git a/db/migrate/20150929160851_add_issues_template_to_project.rb b/db/migrate/20150929160851_add_issues_template_to_project.rb new file mode 100644 index 0000000000..1caf6531c2 --- /dev/null +++ b/db/migrate/20150929160851_add_issues_template_to_project.rb @@ -0,0 +1,5 @@ +class AddIssuesTemplateToProject < ActiveRecord::Migration + def change + add_column :projects, :issues_template, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index e43ceca5ea..fc2ff550a6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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 diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index 9bf4a2a6ff..23981fe2b3 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -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" diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index 4599924dd1..6a26c38f55 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -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