Commit b0639b1f authored by Phil Hughes's avatar Phil Hughes

Weight filter uses the new dropdown

parent baee27cb
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());
......
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