Commit eceaa30b authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'filter-dropdown-bug' into 'master'

Fixes issue with dropdowns not selecting values

Fixes issue with dropdowns not selecting when navigating between tabs

Closes #14813

See merge request !3478
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 5f54c04c
...@@ -9,6 +9,7 @@ v 8.6.3 (unreleased) ...@@ -9,6 +9,7 @@ v 8.6.3 (unreleased)
- Update gitlab-shell version and doc to 2.6.12. gitlab-org/gitlab-ee!280 - Update gitlab-shell version and doc to 2.6.12. gitlab-org/gitlab-ee!280
- Mentions on confidential issues doesn't create todos for non-members. !3374 - Mentions on confidential issues doesn't create todos for non-members. !3374
- Fix Error 500 when searching for a comment in a project snippet. !3468 - Fix Error 500 when searching for a comment in a project snippet. !3468
- Fix issue with dropdowns not selecting values. !3478
v 8.6.2 v 8.6.2
- Fix dropdown alignment. !3298 - Fix dropdown alignment. !3298
......
...@@ -296,6 +296,8 @@ class GitLabDropdown ...@@ -296,6 +296,8 @@ class GitLabDropdown
input = $(input) input = $(input)
.attr('id', @options.inputId) .attr('id', @options.inputId)
@dropdown.before input @dropdown.before input
else
field.val value
return selectedObject return selectedObject
......
...@@ -63,7 +63,8 @@ class @MilestoneSelect ...@@ -63,7 +63,8 @@ class @MilestoneSelect
milestone.name is selectedMilestone milestone.name is selectedMilestone
hidden: -> hidden: ->
$selectbox.hide() $selectbox.hide()
$value.show() # display:block overrides the hide-collapse rule
$value.removeAttr('style')
clicked: (selected) -> clicked: (selected) ->
if $dropdown.hasClass 'js-filter-bulk-update' if $dropdown.hasClass 'js-filter-bulk-update'
return return
...@@ -71,11 +72,9 @@ class @MilestoneSelect ...@@ -71,11 +72,9 @@ class @MilestoneSelect
if $dropdown.hasClass('js-filter-submit') if $dropdown.hasClass('js-filter-submit')
if selected.name? if selected.name?
selectedMilestone = selected.name selectedMilestone = selected.name
else if selected.title?
selectedMilestone = selected.title
else else
selectedMilestone = '' selectedMilestone = ''
$dropdown.parents('form').submit() Issues.filterResults $dropdown.closest('form')
else else
selected = $selectbox selected = $selectbox
.find('input[type="hidden"]') .find('input[type="hidden"]')
......
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
class: "check_all_issues left" class: "check_all_issues left"
.issues-other-filters .issues-other-filters
.filter-item.inline .filter-item.inline
- if params[:author_id] - if params[:author_id].present?
= hidden_field_tag(:author_id, params[:author_id]) = hidden_field_tag(:author_id, params[:author_id])
= dropdown_tag(user_dropdown_label(params[:author_id], "Author"), options: { toggle_class: "js-user-search js-filter-submit js-author-search", title: "Filter by author", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-author", = dropdown_tag(user_dropdown_label(params[:author_id], "Author"), options: { toggle_class: "js-user-search js-filter-submit js-author-search", title: "Filter by author", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-author",
placeholder: "Search authors", data: { any_user: "Any Author", first_user: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), selected: params[:author_id], field_name: "author_id", default_label: "Author" } }) placeholder: "Search authors", data: { any_user: "Any Author", first_user: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), selected: params[:author_id], field_name: "author_id", default_label: "Author" } })
.filter-item.inline .filter-item.inline
- if params[:assignee_id] - if params[:assignee_id].present?
= hidden_field_tag(:assignee_id, params[:assignee_id]) = hidden_field_tag(:assignee_id, params[:assignee_id])
= dropdown_tag(user_dropdown_label(params[:assignee_id], "Assignee"), options: { toggle_class: "js-user-search js-filter-submit js-assignee-search", title: "Filter by assignee", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee", = dropdown_tag(user_dropdown_label(params[:assignee_id], "Assignee"), options: { toggle_class: "js-user-search js-filter-submit js-assignee-search", title: "Filter by assignee", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee",
placeholder: "Search assignee", data: { any_user: "Any Assignee", first_user: (current_user.username if current_user), null_user: true, current_user: true, project_id: (@project.id if @project), selected: params[:assignee_id], field_name: "assignee_id", default_label: "Assignee" } }) placeholder: "Search assignee", data: { any_user: "Any Assignee", first_user: (current_user.username if current_user), null_user: true, current_user: true, project_id: (@project.id if @project), selected: params[:assignee_id], field_name: "assignee_id", default_label: "Assignee" } })
......
- if params[:label_name] - if params[:label_name].present?
= hidden_field_tag(:label_name, params[:label_name]) = hidden_field_tag(:label_name, params[:label_name])
.dropdown .dropdown
%button.dropdown-menu-toggle.js-label-select.js-filter-submit{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: @project.try(:id), labels: labels_filter_path, default_label: "Label"}} %button.dropdown-menu-toggle.js-label-select.js-filter-submit{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: @project.try(:id), labels: labels_filter_path, default_label: "Label"}}
......
- if params[:milestone_title] - if params[:milestone_title].present?
= hidden_field_tag(:milestone_title, params[:milestone_title]) = hidden_field_tag(:milestone_title, params[:milestone_title])
= dropdown_tag(milestone_dropdown_label(params[:milestone_title]), options: { title: "Filter by milestone", toggle_class: 'js-milestone-select js-filter-submit', filter: true, dropdown_class: "dropdown-menu-selectable", = dropdown_tag(milestone_dropdown_label(params[:milestone_title]), options: { title: "Filter by milestone", toggle_class: 'js-milestone-select js-filter-submit', filter: true, dropdown_class: "dropdown-menu-selectable",
placeholder: "Search milestones", footer_content: @project.present?, data: { show_no: true, show_any: true, show_upcoming: true, field_name: "milestone_title", selected: params[:milestone_title], project_id: @project.try(:id), milestones: milestones_filter_dropdown_path, default_label: "Milestone" } }) do placeholder: "Search milestones", footer_content: @project.present?, data: { show_no: true, show_any: true, show_upcoming: true, field_name: "milestone_title", selected: params[:milestone_title], project_id: @project.try(:id), milestones: milestones_filter_dropdown_path, default_label: "Milestone" } }) do
......
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