Commit 4fde6b81 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'new-dropdowns' into 'master'

Weight filter uses the new dropdown



See merge request !261
parents f20f7b7b 2f6c4124
class @WeightSelect
constructor: ->
$('.js-weight-select').each (i, dropdown) ->
$(dropdown).glDropdown(
selectable: true
fieldName: $(dropdown).data("field-name")
id: (obj, el) ->
$(el).data "id"
clicked: ->
if $(dropdown).is ".js-filter-submit"
$(dropdown).parents('form').submit()
)
......@@ -81,9 +81,15 @@
- if controller.controller_name == 'issues'
.filter-item.inline.weight-filter
= select_tag('weight', issues_weight_options(edit: false),
class: 'select2 trigger-submit', include_blank: true,
data: {placeholder: 'Weight'})
- if params[:weight]
= hidden_field_tag(:weight, params[:weight])
= dropdown_tag("Weight", options: { title: "Filter by weight", toggle_class: 'js-weight-select js-filter-submit', dropdown_class: "dropdown-menu-selectable",
placeholder: "Search weight", data: { field_name: "weight" } }) do
%ul
- Issue.weight_options.each do |weight|
%li
%a{href: "#", data: { id: weight }, class: ("is-active" if params[:weight] == weight.to_s)}
= weight
.pull-right
= render 'shared/sort_dropdown'
......@@ -118,6 +124,7 @@
new LabelsSelect();
new MilestoneSelect();
new IssueStatusSelect();
new WeightSelect();
$('form.filter-form').on('submit', function (event) {
event.preventDefault();
Turbolinks.visit(this.action + '&' + $(this).serialize());
......
......@@ -42,11 +42,10 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps
end
step 'I click "All" link' do
find('.js-author-search').click
find('.dropdown-menu-user-full-name', match: :first).click
find('.js-assignee-search').click
find('.dropdown-menu-user-full-name', match: :first).click
find(".js-author-search").click
find(".dropdown-menu-author li a", match: :first).click
find(".js-assignee-search").click
find(".dropdown-menu-assignee li a", match: :first).click
end
def should_see(issue)
......
require 'rails_helper'
feature 'Issue filtering by Weight', feature: true do
include Select2Helper
let(:project) { create(:project, :public) }
let(:weight_num) { random_weight }
......@@ -45,7 +43,8 @@ feature 'Issue filtering by Weight', feature: true do
end
def filter_by_weight(title)
select2(title, from: '#weight')
find('.js-weight-select').click
find('.weight-filter .dropdown-content a', text: title, match: :first).click
end
def random_weight
......
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