summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgfyoung <gfyoung17@gmail.com>2016-11-05 03:50:07 -0400
committergfyoung <gfyoung17@gmail.com>2016-11-10 13:54:37 -0500
commit579090c3a0ed1e88ac3cfa0ed9666e195b1fdf19 (patch)
treecf2e977ed387249aaeb7698e290cb6cc4d0ff154
parentf3231d0f634dc1e8bc9d7d69eaba1f660cd26e36 (diff)
downloadgitlab-ce-579090c3a0ed1e88ac3cfa0ed9666e195b1fdf19.tar.gz
Require projects before creating milestone
-rw-r--r--app/controllers/groups/milestones_controller.rb2
-rw-r--r--app/views/groups/milestones/new.html.haml2
-rw-r--r--changelogs/unreleased/milestone-project-require.yml4
3 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb
index 9d5a28e8d4d..506484932cc 100644
--- a/app/controllers/groups/milestones_controller.rb
+++ b/app/controllers/groups/milestones_controller.rb
@@ -58,7 +58,7 @@ class Groups::MilestonesController < Groups::ApplicationController
def render_new_with_error(empty_project_ids)
@milestone = Milestone.new(milestone_params)
- @milestone.errors.add(:project_id, "Please select at least one project.") if empty_project_ids
+ @milestone.errors.add(:base, "Please select at least one project.") if empty_project_ids
render :new
end
diff --git a/app/views/groups/milestones/new.html.haml b/app/views/groups/milestones/new.html.haml
index 23d438b2aa1..0dfaf743992 100644
--- a/app/views/groups/milestones/new.html.haml
+++ b/app/views/groups/milestones/new.html.haml
@@ -34,7 +34,7 @@
= f.label :projects, "Projects", class: "control-label"
.col-sm-10
= f.collection_select :project_ids, @group.projects.non_archived, :id, :name,
- { selected: @group.projects.non_archived.pluck(:id) }, multiple: true, class: 'select2'
+ { selected: @group.projects.non_archived.pluck(:id) }, required: true, multiple: true, class: 'select2'
.col-md-6
.form-group
diff --git a/changelogs/unreleased/milestone-project-require.yml b/changelogs/unreleased/milestone-project-require.yml
new file mode 100644
index 00000000000..e43033541c7
--- /dev/null
+++ b/changelogs/unreleased/milestone-project-require.yml
@@ -0,0 +1,4 @@
+---
+title: Require projects before creating milestone.
+merge_request: 7301
+author: gfyoung