Merge branch 'fix-issue-filter-dropdown-labels' into 'master'
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.
### Before
![image](https://gitlab.com/stanhu/gitlab-ce/uploads/2326b836e364275341ea0ad8c0a0926b/image.png)
### After
![image](https://gitlab.com/stanhu/gitlab-ce/uploads/b0e519f9cf8d1a3c0f054286e3b809cb/image.png)
See merge request !1554
This commit is contained in:
commit
1a881a71f5
6 changed files with 16 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
class GroupMilestone
|
||||
|
||||
alias_attribute :name, :title
|
||||
|
||||
def initialize(title, milestones)
|
||||
@title = title
|
||||
@milestones = milestones
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -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}%"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue