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 ...@@ -14,7 +14,10 @@ class @IssuableContext
block = $(@).parents('.block') block = $(@).parents('.block')
block.find('.selectbox').show() block.find('.selectbox').show()
block.find('.value').hide() block.find('.value').hide()
block.find('.js-select2').select2("open") setTimeout (->
block.find('.dropdown-menu-toggle').trigger 'click'
), 0
$(".right-sidebar").niceScroll() $(".right-sidebar").niceScroll()
......
...@@ -11,6 +11,9 @@ class @MilestoneSelect ...@@ -11,6 +11,9 @@ class @MilestoneSelect
useId = $dropdown.data('use-id') useId = $dropdown.data('use-id')
defaultLabel = $dropdown.data('default-label') defaultLabel = $dropdown.data('default-label')
issuableId = $dropdown.data('issuable-id') issuableId = $dropdown.data('issuable-id')
$selectbox = $dropdown.closest('.selectbox')
$block = $selectbox.closest('.block')
$value = $block.find('.value')
$dropdown.glDropdown( $dropdown.glDropdown(
data: (term, callback) -> data: (term, callback) ->
...@@ -64,7 +67,7 @@ class @MilestoneSelect ...@@ -64,7 +67,7 @@ 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
$.ajax( $.ajax(
type: 'PUT' type: 'PUT'
url: issueUpdateURL url: issueUpdateURL
...@@ -72,5 +75,17 @@ class @MilestoneSelect ...@@ -72,5 +75,17 @@ class @MilestoneSelect
issue: issue:
milestone_id: selected milestone_id: selected
).done (data) -> ).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 @@ ...@@ -252,6 +252,14 @@
text-decoration: none; text-decoration: none;
} }
} }
.dropdown-menu-toggle {
width: 100%;
}
.open .dropdown-menu {
width: 100%;
}
} }
.btn-default.gutter-toggle { .btn-default.gutter-toggle {
......
...@@ -108,7 +108,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -108,7 +108,7 @@ class Projects::IssuesController < Projects::ApplicationController
end end
end end
format.json do format.json do
render json: @issue render json: @issue.to_json(include: :milestone )
end end
end 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