summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Tang <dennis@dennistang.net>2018-09-26 09:41:37 +0000
committerNick Thomas <nick@gitlab.com>2018-09-26 09:41:37 +0000
commit715221d629e922261b34920d3e9638c2d78ef1bb (patch)
tree70cd9f4bebb4aa7c5b2ea1d6644c2babf1bdc4fc
parent03e092065ecda656bc493a303bf6ebe02b67f6ff (diff)
downloadgitlab-ce-715221d629e922261b34920d3e9638c2d78ef1bb.tar.gz
Preserve order of project tags list
-rw-r--r--app/models/project.rb2
-rw-r--r--app/views/projects/edit.html.haml2
-rw-r--r--changelogs/unreleased/51839-remove-sorting-on-project-tags.yml5
-rw-r--r--spec/features/projects/settings/user_tags_project_spec.rb14
4 files changed, 13 insertions, 10 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 1156a400a21..503fbc30768 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -111,7 +111,7 @@ class Project < ActiveRecord::Base
after_create :ensure_storage_path_exists
after_save :ensure_storage_path_exists, if: :namespace_id_changed?
- acts_as_taggable
+ acts_as_ordered_taggable
attr_accessor :old_path_with_namespace
attr_accessor :template_name
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index 96ab582b050..bfd165d8ba5 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -40,7 +40,7 @@
.form-group
= f.label :tag_list, "Tags", class: 'label-bold'
- = f.text_field :tag_list, value: @project.tag_list.sort.join(', '), maxlength: 2000, class: "form-control"
+ = f.text_field :tag_list, value: @project.tag_list.join(', '), maxlength: 2000, class: "form-control"
%p.form-text.text-muted Separate tags with commas.
%fieldset.features
%h5.prepend-top-0= _("Project avatar")
diff --git a/changelogs/unreleased/51839-remove-sorting-on-project-tags.yml b/changelogs/unreleased/51839-remove-sorting-on-project-tags.yml
new file mode 100644
index 00000000000..38a7c06b34c
--- /dev/null
+++ b/changelogs/unreleased/51839-remove-sorting-on-project-tags.yml
@@ -0,0 +1,5 @@
+---
+title: Preserve order of project tags list
+merge_request: 21897
+author:
+type: changed
diff --git a/spec/features/projects/settings/user_tags_project_spec.rb b/spec/features/projects/settings/user_tags_project_spec.rb
index 57b4b1287fa..9357215ae6f 100644
--- a/spec/features/projects/settings/user_tags_project_spec.rb
+++ b/spec/features/projects/settings/user_tags_project_spec.rb
@@ -9,15 +9,13 @@ describe 'Projects > Settings > User tags a project' do
visit edit_project_path(project)
end
- context 'when a project is archived' do
- it 'unarchives a project' do
- fill_in 'Tags', with: 'tag1, tag2'
+ it 'sets project tags' do
+ fill_in 'Tags', with: 'tag1, tag2'
- page.within '.general-settings' do
- click_button 'Save changes'
- end
-
- expect(find_field('Tags').value).to eq 'tag1, tag2'
+ page.within '.general-settings' do
+ click_button 'Save changes'
end
+
+ expect(find_field('Tags').value).to eq 'tag1, tag2'
end
end