Commit b60bc655 authored by Stan Hu's avatar Stan Hu

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.
parent 680b6d88
...@@ -95,7 +95,8 @@ module LabelsHelper ...@@ -95,7 +95,8 @@ module LabelsHelper
def project_labels_options(project) def project_labels_options(project)
labels = project.labels.to_a labels = project.labels.to_a
labels.unshift(Label::None) 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 end
# Required for Gitlab::Markdown::LabelReferenceFilter # Required for Gitlab::Markdown::LabelReferenceFilter
......
...@@ -30,7 +30,8 @@ module MilestonesHelper ...@@ -30,7 +30,8 @@ module MilestonesHelper
grouped_milestones = Milestones::GroupService.new(milestones).execute grouped_milestones = Milestones::GroupService.new(milestones).execute
grouped_milestones.unshift(Milestone::None) 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
end end
class GroupMilestone class GroupMilestone
alias_attribute :name, :title
def initialize(title, milestones) def initialize(title, milestones)
@title = title @title = title
@milestones = milestones @milestones = milestones
......
...@@ -14,7 +14,9 @@ class Label < ActiveRecord::Base ...@@ -14,7 +14,9 @@ class Label < ActiveRecord::Base
include Referable include Referable
# Represents a "No Label" state used for filtering Issues and Merge # Represents a "No Label" state used for filtering Issues and Merge
# Requests that have no label assigned. # 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' DEFAULT_COLOR = '#428BCA'
......
...@@ -16,7 +16,9 @@ ...@@ -16,7 +16,9 @@
class Milestone < ActiveRecord::Base class Milestone < ActiveRecord::Base
# Represents a "No Milestone" state used for filtering Issues and Merge # Represents a "No Milestone" state used for filtering Issues and Merge
# Requests that have no milestone assigned. # 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 InternalId
include Sortable include Sortable
...@@ -47,6 +49,8 @@ class Milestone < ActiveRecord::Base ...@@ -47,6 +49,8 @@ class Milestone < ActiveRecord::Base
state :active state :active
end end
alias_attribute :name, :title
class << self class << self
def search(query) def search(query)
query = "%#{query}%" query = "%#{query}%"
......
...@@ -39,13 +39,13 @@ ...@@ -39,13 +39,13 @@
.filter-item.inline.milestone-filter .filter-item.inline.milestone-filter
= select_tag('milestone_title', projects_milestones_options, = select_tag('milestone_title', projects_milestones_options,
class: 'select2 trigger-submit', include_blank: 'Any', class: 'select2 trigger-submit', include_blank: true,
data: {placeholder: 'Milestone'}) data: {placeholder: 'Milestone'})
- if @project - if @project
.filter-item.inline.labels-filter .filter-item.inline.labels-filter
= select_tag('label_name', project_labels_options(@project), = 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'}) data: {placeholder: 'Label'})
.pull-right .pull-right
......
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