diff options
author | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-03-11 08:28:10 +0300 |
---|---|---|
committer | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-03-25 15:03:16 +0300 |
commit | 16ba5eb4d89f903d89fbad33086013a2f69717dd (patch) | |
tree | fbd5d4e681f74b3b38e40e8cfc36cfd215654fcd /app/assets/javascripts/milestone_select.js.coffee | |
parent | 63c8a05bf7f18ac4093ece1f08b4b5fd8dba5fac (diff) |
Updates sidebar milestone to use new dropdowns
Diffstat (limited to 'app/assets/javascripts/milestone_select.js.coffee')
-rw-r--r-- | app/assets/javascripts/milestone_select.js.coffee | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/app/assets/javascripts/milestone_select.js.coffee b/app/assets/javascripts/milestone_select.js.coffee index e17a1adb648..18647e25c55 100644 --- a/app/assets/javascripts/milestone_select.js.coffee +++ b/app/assets/javascripts/milestone_select.js.coffee @@ -1,5 +1,6 @@ class @MilestoneSelect - constructor: -> + constructor: (@opts) -> + opts = @opts $('.js-milestone-select').each (i, dropdown) -> $dropdown = $(dropdown) projectId = $dropdown.data('project-id') @@ -9,6 +10,7 @@ class @MilestoneSelect showAny = $dropdown.data('show-any') useId = $dropdown.data('use-id') defaultLabel = $dropdown.data('default-label') + issuableId = $dropdown.data('issuable-id') $dropdown.glDropdown( data: (term, callback) -> @@ -53,13 +55,14 @@ class @MilestoneSelect milestone.id isSelected: (milestone) -> milestone.title is selectedMilestone - clicked: -> - page = $('body').data 'page' - isIssueIndex = page is 'projects:issues:index' - isMRIndex = page is page is 'projects:merge_requests:index' - if $dropdown.hasClass('js-filter-submit') and (isIssueIndex or isMRIndex) - Issues.filterResults $dropdown.closest('form') - else if $dropdown.hasClass 'js-filter-submit' - $dropdown.closest('form').submit() + clicked: (e) -> + if $(dropdown).hasClass "js-filter-submit" && opts.submitForm + $(dropdown).parents('form').submit() + else + milestoneVal = $(@) + .closest('.selectbox') + .find('input[type="hidden"]') + .val() + Api.issues.update(projectId, issuableId, milestone_id: milestoneVal, (data) => console.log 'data', data) ) |