BigW Consortium Gitlab

Commit 49628664 by 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
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) ->
$dropdown = $(dropdown)
$dropdownParent = $dropdown.closest('.dropdown')
$addBtn = $('.js-due-date-add', $dropdownParent)
$datePicker = $dropdownParent.find('.js-due-date-calendar')
$block = $dropdown.closest('.block')
$selectbox = $dropdown.closest('.selectbox')
......@@ -22,13 +23,10 @@ class @DueDateSelect
$value.removeAttr('style')
)
$addBtn.on 'click', (e) ->
e.preventDefault()
e.stopPropagation()
addDueDate = ->
# Create the post date
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[abilityName] = {}
......@@ -48,13 +46,15 @@ class @DueDateSelect
$sidebarValue.html(mediumDate)
).done (data) ->
$dropdown.trigger('loaded.gl.dropdown')
$dropdown.trigger('hidden.gl.dropdown')
$dropdown.dropdown('toggle')
$loading.fadeOut()
$datePicker.datepicker(
dateFormat: "yy-mm-dd",
dateFormat: 'yy-mm-dd',
defaultDate: $("input[name='#{fieldName}']").val()
altField: "input[name='#{fieldName}']"
onSelect: ->
addDueDate()
)
$(document)
......
......@@ -33,7 +33,6 @@ class @IssuableContext
$block.find('.dropdown-menu-toggle').trigger 'click'
, 0
$(".right-sidebar").niceScroll()
initParticipants: ->
......
......@@ -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) } }
%span.dropdown-toggle-text
Due date
= icon('chevron-down')
= icon("chevron-down")
.dropdown-menu.dropdown-menu-due-date
= dropdown_title("Due date")
= dropdown_content do
.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?
.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