Commit aa4da384 authored by Jacob Schatz's avatar Jacob Schatz

Make label search work with JSON data

parent a76ee508
...@@ -14,6 +14,7 @@ class @MilestoneSelect ...@@ -14,6 +14,7 @@ class @MilestoneSelect
$selectbox = $dropdown.closest('.selectbox') $selectbox = $dropdown.closest('.selectbox')
$block = $selectbox.closest('.block') $block = $selectbox.closest('.block')
$value = $block.find('.value') $value = $block.find('.value')
$loading = $block.find('.block-loading').fadeOut()
$dropdown.glDropdown( $dropdown.glDropdown(
data: (term, callback) -> data: (term, callback) ->
...@@ -67,7 +68,10 @@ class @MilestoneSelect ...@@ -67,7 +68,10 @@ class @MilestoneSelect
.closest('.selectbox') .closest('.selectbox')
.find('input[type="hidden"]') .find('input[type="hidden"]')
.val() .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( $.ajax(
type: 'PUT' type: 'PUT'
url: issueUpdateURL url: issueUpdateURL
...@@ -75,14 +79,15 @@ class @MilestoneSelect ...@@ -75,14 +79,15 @@ class @MilestoneSelect
issue: issue:
milestone_id: selected milestone_id: selected
).done (data) -> ).done (data) ->
$loading.fadeOut()
$selectbox.hide() $selectbox.hide()
href = $value href = $value
.show() .show()
.find('.milestone-title') .find('.milestone-title')
.text(data.milestone.title) .text(data.milestone.title)
.end() .end()
.find('a') .find('a')
.attr('href') .attr('href')
splitHref = href.split('/') splitHref = href.split('/')
splitHref[splitHref.length - 1] = data.id splitHref[splitHref.length - 1] = data.id
$value $value
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
.filter-item.inline.labels-filter .filter-item.inline.labels-filter
= render "shared/issuable/label_dropdown" = render "shared/issuable/label_dropdown"
.pull-right .pull-right
= render 'shared/sort_dropdown' = render 'shared/sort_dropdown'
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
No No
.title.hide-collapsed .title.hide-collapsed
Milestone Milestone
=icon('spinner spin', class: 'block-loading')
- if can?(current_user, :"admin_#{issuable.to_ability_name}", @project) - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
= link_to 'Edit', '#', class: 'edit-link pull-right' = link_to 'Edit', '#', class: 'edit-link pull-right'
.value.bold.hide-collapsed .value.bold.hide-collapsed
......
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