Commit 49628664 authored by Phil Hughes's avatar Phil Hughes Committed by Robert Speicher

Removed buttons instead clicking date sets it

Fixed issue with dropdown not being toggleable again
parent 989bcfcc
class @DueDateSelect class @DueDateSelect
constructor: -> constructor: ->
$loading = $('.js-issuable-update .due_date').find('.block-loading').hide() $loading = $('.js-issuable-update .due_date')
.find('.block-loading')
.hide()
$('.js-due-date-select').each (i, dropdown) -> $('.js-due-date-select').each (i, dropdown) ->
$dropdown = $(dropdown) $dropdown = $(dropdown)
$dropdownParent = $dropdown.closest('.dropdown') $dropdownParent = $dropdown.closest('.dropdown')
$addBtn = $('.js-due-date-add', $dropdownParent)
$datePicker = $dropdownParent.find('.js-due-date-calendar') $datePicker = $dropdownParent.find('.js-due-date-calendar')
$block = $dropdown.closest('.block') $block = $dropdown.closest('.block')
$selectbox = $dropdown.closest('.selectbox') $selectbox = $dropdown.closest('.selectbox')
...@@ -22,13 +23,10 @@ class @DueDateSelect ...@@ -22,13 +23,10 @@ class @DueDateSelect
$value.removeAttr('style') $value.removeAttr('style')
) )
$addBtn.on 'click', (e) -> addDueDate = ->
e.preventDefault()
e.stopPropagation()
# Create the post date # Create the post date
value = $("input[name='#{fieldName}']").val() value = $("input[name='#{fieldName}']").val()
mediumDate = $.datepicker.formatDate("M d, yy", new Date(value)) mediumDate = $.datepicker.formatDate('M d, yy', new Date(value))
data = {} data = {}
data[abilityName] = {} data[abilityName] = {}
...@@ -48,13 +46,15 @@ class @DueDateSelect ...@@ -48,13 +46,15 @@ class @DueDateSelect
$sidebarValue.html(mediumDate) $sidebarValue.html(mediumDate)
).done (data) -> ).done (data) ->
$dropdown.trigger('loaded.gl.dropdown') $dropdown.trigger('loaded.gl.dropdown')
$dropdown.trigger('hidden.gl.dropdown') $dropdown.dropdown('toggle')
$loading.fadeOut() $loading.fadeOut()
$datePicker.datepicker( $datePicker.datepicker(
dateFormat: "yy-mm-dd", dateFormat: 'yy-mm-dd',
defaultDate: $("input[name='#{fieldName}']").val() defaultDate: $("input[name='#{fieldName}']").val()
altField: "input[name='#{fieldName}']" altField: "input[name='#{fieldName}']"
onSelect: ->
addDueDate()
) )
$(document) $(document)
......
...@@ -33,7 +33,6 @@ class @IssuableContext ...@@ -33,7 +33,6 @@ class @IssuableContext
$block.find('.dropdown-menu-toggle').trigger 'click' $block.find('.dropdown-menu-toggle').trigger 'click'
, 0 , 0
$(".right-sidebar").niceScroll() $(".right-sidebar").niceScroll()
initParticipants: -> initParticipants: ->
......
...@@ -100,16 +100,11 @@ ...@@ -100,16 +100,11 @@
%button.dropdown-menu-toggle.js-due-date-select{ type: "button", data: { toggle: "dropdown", field_name: "#{issuable.to_ability_name}[due_date]", ability_name: issuable.to_ability_name, issue_update: issuable_json_path(issuable) } } %button.dropdown-menu-toggle.js-due-date-select{ type: "button", data: { toggle: "dropdown", field_name: "#{issuable.to_ability_name}[due_date]", ability_name: issuable.to_ability_name, issue_update: issuable_json_path(issuable) } }
%span.dropdown-toggle-text %span.dropdown-toggle-text
Due date Due date
= icon('chevron-down') = icon("chevron-down")
.dropdown-menu.dropdown-menu-due-date .dropdown-menu.dropdown-menu-due-date
= dropdown_title("Due date") = dropdown_title("Due date")
= dropdown_content do = dropdown_content do
.js-due-date-calendar .js-due-date-calendar
.dropdown-footer.dropdown-due-date-footer.clearfix
%button.btn.btn-primary.pull-left.js-due-date-add{ type: "button" }
Add
%button.btn.btn-default.pull-right{ type: "button" }
Cancel
- if issuable.project.labels.any? - if issuable.project.labels.any?
.block.labels .block.labels
......
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