Commit a76ee508 authored by Jacob Schatz's avatar Jacob Schatz

Ajax call to milestones via new dropdowns

parent ff86138d
......@@ -14,7 +14,10 @@ class @IssuableContext
block = $(@).parents('.block')
block.find('.selectbox').show()
block.find('.value').hide()
block.find('.js-select2').select2("open")
setTimeout (->
block.find('.dropdown-menu-toggle').trigger 'click'
), 0
$(".right-sidebar").niceScroll()
......
......@@ -11,6 +11,9 @@ class @MilestoneSelect
useId = $dropdown.data('use-id')
defaultLabel = $dropdown.data('default-label')
issuableId = $dropdown.data('issuable-id')
$selectbox = $dropdown.closest('.selectbox')
$block = $selectbox.closest('.block')
$value = $block.find('.value')
$dropdown.glDropdown(
data: (term, callback) ->
......@@ -64,7 +67,7 @@ class @MilestoneSelect
.closest('.selectbox')
.find('input[type="hidden"]')
.val()
console.log 'gonna ajax it with', url: issueUpdateURL, data: issue: milestone_id: selected
$.ajax(
type: 'PUT'
url: issueUpdateURL
......@@ -72,5 +75,17 @@ class @MilestoneSelect
issue:
milestone_id: selected
).done (data) ->
console.log 'databack', data
$selectbox.hide()
href = $value
.show()
.find('.milestone-title')
.text(data.milestone.title)
.end()
.find('a')
.attr('href')
splitHref = href.split('/')
splitHref[splitHref.length - 1] = data.id
$value
.find('a')
.attr('href',splitHref.join('/'))
)
\ No newline at end of file
......@@ -252,6 +252,14 @@
text-decoration: none;
}
}
.dropdown-menu-toggle {
width: 100%;
}
.open .dropdown-menu {
width: 100%;
}
}
.btn-default.gutter-toggle {
......
......@@ -108,7 +108,7 @@ class Projects::IssuesController < Projects::ApplicationController
end
end
format.json do
render json: @issue
render json: @issue.to_json(include: :milestone )
end
end
end
......
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