Make label search work with JSON data

This commit is contained in:
Jacob Schatz 2016-03-12 11:34:26 -05:00
parent a76ee508fb
commit aa4da38435
3 changed files with 13 additions and 8 deletions

View File

@ -14,6 +14,7 @@ class @MilestoneSelect
$selectbox = $dropdown.closest('.selectbox')
$block = $selectbox.closest('.block')
$value = $block.find('.value')
$loading = $block.find('.block-loading').fadeOut()
$dropdown.glDropdown(
data: (term, callback) ->
@ -67,7 +68,10 @@ class @MilestoneSelect
.closest('.selectbox')
.find('input[type="hidden"]')
.val()
console.log 'gonna ajax it with', url: issueUpdateURL, data: issue: milestone_id: selected
# need inline-block here instead of show,
# which will default to the element's style in this case inline.
$loading
.fadeIn()
$.ajax(
type: 'PUT'
url: issueUpdateURL
@ -75,14 +79,15 @@ class @MilestoneSelect
issue:
milestone_id: selected
).done (data) ->
$loading.fadeOut()
$selectbox.hide()
href = $value
.show()
.find('.milestone-title')
.text(data.milestone.title)
.end()
.find('a')
.attr('href')
.show()
.find('.milestone-title')
.text(data.milestone.title)
.end()
.find('a')
.attr('href')
splitHref = href.split('/')
splitHref[splitHref.length - 1] = data.id
$value

View File

@ -23,7 +23,6 @@
.filter-item.inline.labels-filter
= render "shared/issuable/label_dropdown"
.pull-right
= render 'shared/sort_dropdown'

View File

@ -54,6 +54,7 @@
No
.title.hide-collapsed
Milestone
=icon('spinner spin', class: 'block-loading')
- if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
= link_to 'Edit', '#', class: 'edit-link pull-right'
.value.bold.hide-collapsed