Fixed up frontend code based on feedback
Updated a test to be more specific about where the content is
This commit is contained in:
parent
a87e0dacfc
commit
5995a62981
9 changed files with 16 additions and 19 deletions
|
@ -231,7 +231,7 @@ class @LabelsSelect
|
|||
|
||||
if $form.find("input[type='hidden']\
|
||||
[name='#{$dropdown.data('fieldName')}']\
|
||||
[value='#{this.id(label)}']").length
|
||||
[value=\"#{this.id(label)}\"]").length
|
||||
selectedClass.push 'is-active'
|
||||
|
||||
if $dropdown.hasClass('js-multiselect') and removesAll
|
||||
|
|
|
@ -8,7 +8,7 @@ module IssuablesHelper
|
|||
end
|
||||
|
||||
def multi_label_name(current_labels, default_label)
|
||||
if !current_labels.nil? && current_labels.any?
|
||||
if current_labels && current_labels.any?
|
||||
title = current_labels.first.try(:title)
|
||||
if current_labels.size > 1
|
||||
"#{title} +#{current_labels.size - 1} more"
|
||||
|
|
|
@ -55,10 +55,6 @@ module MilestonesHelper
|
|||
end
|
||||
end
|
||||
|
||||
def milestone_dropdown_selected_text(selected)
|
||||
selected.try(:title) unless selected.nil?
|
||||
end
|
||||
|
||||
def milestone_remaining_days(milestone)
|
||||
if milestone.expired?
|
||||
content_tag(:strong, 'Past due')
|
||||
|
|
|
@ -12,19 +12,19 @@
|
|||
- if params[:author_id].present?
|
||||
= 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 js-filter-submit",
|
||||
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.try(:username), current_user: true, project_id: @project.try(:id), selected: params[:author_id], field_name: "author_id", default_label: "Author" } })
|
||||
|
||||
.filter-item.inline
|
||||
- if params[:assignee_id].present?
|
||||
= 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 js-filter-submit",
|
||||
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.try(:username), null_user: true, current_user: true, project_id: @project.try(:id), selected: params[:assignee_id], field_name: "assignee_id", default_label: "Assignee" } })
|
||||
|
||||
.filter-item.inline.milestone-filter
|
||||
= render "shared/issuable/milestone_dropdown", selected: (@issuable_finder.milestones.first unless @issuable_finder.milestones.nil?), name: :milestone_title, show_any: true, show_upcoming: true
|
||||
= render "shared/issuable/milestone_dropdown", selected: @issuable_finder.milestones.try(:first), name: :milestone_title, show_any: true, show_upcoming: true
|
||||
|
||||
.filter-item.inline.labels-filter
|
||||
= render "shared/issuable/label_dropdown", selected: @issuable_finder.labels.select(:title).uniq, use_id: false, selected_toggle: params[:label_name], data_options: { field_name: "label_name[]" }, show_create: controller.controller_name != "groups"
|
||||
= render "shared/issuable/label_dropdown", selected: @issuable_finder.labels.select(:title).uniq, use_id: false, selected_toggle: params[:label_name], data_options: { field_name: "label_name[]" }
|
||||
|
||||
.pull-right
|
||||
= render 'shared/sort_dropdown'
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
- if issuable.assignee_id
|
||||
= f.hidden_field :assignee_id
|
||||
= dropdown_tag(user_dropdown_label(issuable.assignee_id, "Assignee"), options: { toggle_class: "js-dropdown-keep-input js-user-search js-issuable-form-dropdown js-assignee-search", title: "Filter by assignee", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee js-filter-submit",
|
||||
placeholder: "Search assignee", data: { first_user: (current_user.username if current_user), null_user: true, current_user: true, project_id: (project.try(:id)), selected: issuable.assignee_id, field_name: "#{issuable.class.model_name.param_key}[assignee_id]", default_label: "Assignee" } })
|
||||
placeholder: "Search assignee", data: { first_user: current_user.try(:username), null_user: true, current_user: true, project_id: project.try(:id), selected: issuable.assignee_id, field_name: "#{issuable.class.model_name.param_key}[assignee_id]", default_label: "Assignee" } })
|
||||
.form-group.issue-milestone
|
||||
= f.label :milestone_id, "Milestone", class: "control-label #{"col-lg-4" if has_due_date}"
|
||||
.col-sm-10{ class: ("col-lg-8" if has_due_date) }
|
||||
|
@ -64,12 +64,11 @@
|
|||
= render "shared/issuable/milestone_dropdown", selected: issuable.milestone, name: "#{issuable.class.model_name.param_key}[milestone_id]", show_any: false, show_upcoming: false, extra_class: "js-issuable-form-dropdown js-dropdown-keep-input"
|
||||
.form-group
|
||||
- has_labels = issuable.project.labels.any?
|
||||
- label_dropdown_toggle = issuable.labels.map { |label| label.title }
|
||||
= f.label :label_ids, "Labels", class: "control-label #{"col-lg-4" if has_due_date}"
|
||||
= f.hidden_field :label_ids, multiple: true, value: ''
|
||||
.col-sm-10{ class: "#{"col-lg-8" if has_due_date} #{'issuable-form-padding-top' if !has_labels}" }
|
||||
.issuable-form-select-holder
|
||||
= render "shared/issuable/label_dropdown", classes: ["js-issuable-form-dropdown"], selected: issuable.labels, selected_toggle: label_dropdown_toggle, data_options: { field_name: "#{issuable.class.model_name.param_key}[label_ids][]", show_any: false }
|
||||
= render "shared/issuable/label_dropdown", classes: ["js-issuable-form-dropdown"], selected: issuable.labels, data_options: { field_name: "#{issuable.class.model_name.param_key}[label_ids][]", show_any: false }
|
||||
- if has_due_date
|
||||
.col-lg-6
|
||||
.form-group
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
.dropdown
|
||||
%button.dropdown-menu-toggle.js-label-select.js-multiselect{class: classes.join(' '), type: "button", data: dropdown_data}
|
||||
%span.dropdown-toggle-text{ class: ("is-default" if selected.nil? || selected.empty?) }
|
||||
= h(multi_label_name(selected, "Labels"))
|
||||
= multi_label_name(selected, "Labels")
|
||||
= icon('chevron-down')
|
||||
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
|
||||
= render partial: "shared/issuable/label_page_default", locals: { title: "Filter by label", show_footer: show_footer, show_create: show_create }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
- project = @target_project || @project || @projects
|
||||
- extra_class = extra_class || ''
|
||||
- selected_text = milestone_dropdown_selected_text(selected)
|
||||
- selected_text = selected.try(:title)
|
||||
- if selected.present?
|
||||
= hidden_field_tag(name, selected.id)
|
||||
= dropdown_tag(milestone_dropdown_label(selected_text), options: { title: "Filter by milestone", toggle_class: "js-milestone-select js-filter-submit #{extra_class}", filter: true, dropdown_class: "dropdown-menu-selectable",
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
.dropdown
|
||||
%button.dropdown-menu-toggle.js-label-select.js-multiselect.js-label-sidebar-dropdown{type: "button", data: {toggle: "dropdown", default_label: "Labels", field_name: "#{issuable.to_ability_name}[label_names][]", ability_name: issuable.to_ability_name, show_no: "true", show_any: "true", project_id: (@project.id if @project), issue_update: issuable_json_path(issuable), labels: (namespace_project_labels_path(@project.namespace, @project, :json) if @project)}}
|
||||
%span.dropdown-toggle-text{ class: ("is-default" if selected_labels.empty?)}
|
||||
= h(multi_label_name(selected_labels, "Labels"))
|
||||
= multi_label_name(selected_labels, "Labels")
|
||||
= icon('chevron-down')
|
||||
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
|
||||
= render partial: "shared/issuable/label_page_default"
|
||||
|
|
|
@ -143,9 +143,11 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
|
|||
end
|
||||
|
||||
step 'I should see the users from the target project ID' do
|
||||
expect(page).to have_content 'Unassigned'
|
||||
expect(page).to have_content current_user.name
|
||||
expect(page).to have_content @project.users.first.name
|
||||
page.within '.dropdown-menu-user' do
|
||||
expect(page).to have_content 'Unassigned'
|
||||
expect(page).to have_content current_user.name
|
||||
expect(page).to have_content @project.users.first.name
|
||||
end
|
||||
end
|
||||
|
||||
# Verify a link is generated against the correct project
|
||||
|
|
Loading…
Reference in a new issue