summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-10-08 21:24:55 -0700
committerStan Hu <stanhu@gmail.com>2015-10-08 23:53:32 -0700
commitb60bc655f2e1318f448f3a3d884437677c1135b7 (patch)
tree5bc98fe85bb39f89c444d2dec221ba06ada1cd1d
parent680b6d88a5c0d63deeb2909f1c83e3630db87780 (diff)
downloadgitlab-ce-b60bc655f2e1318f448f3a3d884437677c1135b7.tar.gz
Restore placeholders in issue filters from "Any" to "Milestone" and "Label"
1f11096c included new filters but made it hard to determine which dropdown did what. This patch restores the original placeholders.
-rw-r--r--app/helpers/labels_helper.rb3
-rw-r--r--app/helpers/milestones_helper.rb3
-rw-r--r--app/models/group_milestone.rb2
-rw-r--r--app/models/label.rb4
-rw-r--r--app/models/milestone.rb6
-rw-r--r--app/views/shared/issuable/_filter.html.haml4
6 files changed, 16 insertions, 6 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index 662ace367b9..66b18eea699 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -95,7 +95,8 @@ module LabelsHelper
def project_labels_options(project)
labels = project.labels.to_a
labels.unshift(Label::None)
- options_from_collection_for_select(labels, 'name', 'name', params[:label_name])
+ labels.unshift(Label::Any)
+ options_from_collection_for_select(labels, 'name', 'title', params[:label_name])
end
# Required for Gitlab::Markdown::LabelReferenceFilter
diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb
index 132a893e532..37a5b58cce8 100644
--- a/app/helpers/milestones_helper.rb
+++ b/app/helpers/milestones_helper.rb
@@ -30,7 +30,8 @@ module MilestonesHelper
grouped_milestones = Milestones::GroupService.new(milestones).execute
grouped_milestones.unshift(Milestone::None)
+ grouped_milestones.unshift(Milestone::Any)
- options_from_collection_for_select(grouped_milestones, 'title', 'title', params[:milestone_title])
+ options_from_collection_for_select(grouped_milestones, 'name', 'title', params[:milestone_title])
end
end
diff --git a/app/models/group_milestone.rb b/app/models/group_milestone.rb
index ab055f6b80b..1dd2be68ebf 100644
--- a/app/models/group_milestone.rb
+++ b/app/models/group_milestone.rb
@@ -1,5 +1,7 @@
class GroupMilestone
+ alias_attribute :name, :title
+
def initialize(title, milestones)
@title = title
@milestones = milestones
diff --git a/app/models/label.rb b/app/models/label.rb
index 14b544b3756..1bb4b5f55cf 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -14,7 +14,9 @@ class Label < ActiveRecord::Base
include Referable
# Represents a "No Label" state used for filtering Issues and Merge
# Requests that have no label assigned.
- None = Struct.new(:title, :name).new('No Label', 'No Label')
+ LabelStruct = Struct.new(:title, :name)
+ None = LabelStruct.new('No Label', 'No Label')
+ Any = LabelStruct.new('Any', '')
DEFAULT_COLOR = '#428BCA'
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index d979a35084b..84acba30b6b 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -16,7 +16,9 @@
class Milestone < ActiveRecord::Base
# Represents a "No Milestone" state used for filtering Issues and Merge
# Requests that have no milestone assigned.
- None = Struct.new(:title).new('No Milestone')
+ MilestoneStruct = Struct.new(:title, :name)
+ None = MilestoneStruct.new('No Milestone', 'No Milestone')
+ Any = MilestoneStruct.new('Any', '')
include InternalId
include Sortable
@@ -47,6 +49,8 @@ class Milestone < ActiveRecord::Base
state :active
end
+ alias_attribute :name, :title
+
class << self
def search(query)
query = "%#{query}%"
diff --git a/app/views/shared/issuable/_filter.html.haml b/app/views/shared/issuable/_filter.html.haml
index 6e6d497c1d2..8f16773077e 100644
--- a/app/views/shared/issuable/_filter.html.haml
+++ b/app/views/shared/issuable/_filter.html.haml
@@ -39,13 +39,13 @@
.filter-item.inline.milestone-filter
= select_tag('milestone_title', projects_milestones_options,
- class: 'select2 trigger-submit', include_blank: 'Any',
+ class: 'select2 trigger-submit', include_blank: true,
data: {placeholder: 'Milestone'})
- if @project
.filter-item.inline.labels-filter
= select_tag('label_name', project_labels_options(@project),
- class: 'select2 trigger-submit', include_blank: 'Any',
+ class: 'select2 trigger-submit', include_blank: true,
data: {placeholder: 'Label'})
.pull-right