From 88024b17c03f5cc834465574c55a566f8f1a5819 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 24 Mar 2016 15:20:35 +0000 Subject: Standardised the output of the JSON to always include the name The frontend will then always use the name as the ID - like previous --- app/assets/javascripts/milestone_select.js.coffee | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'app/assets/javascripts/milestone_select.js.coffee') diff --git a/app/assets/javascripts/milestone_select.js.coffee b/app/assets/javascripts/milestone_select.js.coffee index 10c776a0501..b569b7eb7bf 100644 --- a/app/assets/javascripts/milestone_select.js.coffee +++ b/app/assets/javascripts/milestone_select.js.coffee @@ -50,19 +50,22 @@ class @MilestoneSelect extraOptions = [] if showAny extraOptions.push( - isAny: true + id: 0 + name: '' title: 'Any Milestone' ) if showNo extraOptions.push( - id: '0' + id: -1 + name: 'No Milestone' title: 'No Milestone' ) if showUpcoming extraOptions.push( - id: '#upcoming' + id: -2 + name: '#upcoming' title: 'Upcoming' ) >>>>>>> Updated to only include upcoming on filters @@ -84,14 +87,11 @@ class @MilestoneSelect milestone.title id: (milestone) -> if !useId - if !milestone.isAny? - milestone.title - else - '' + milestone.name else milestone.id isSelected: (milestone) -> - milestone.title is selectedMilestone + milestone.name is selectedMilestone hidden: -> $selectbox.hide() $value.show() @@ -99,8 +99,10 @@ class @MilestoneSelect if $dropdown.hasClass 'js-filter-bulk-update' return - if $dropdown.hasClass 'js-filter-submit' - if selected.title? + if $dropdown.hasClass('js-filter-submit') and (isIssueIndex or isMRIndex) + if selected.name? + selectedMilestone = selected.name + else if selected.title? selectedMilestone = selected.title $dropdown.parents('form').submit() else -- cgit v1.2.1