diff options
author | Phil Hughes <me@iamphill.com> | 2016-04-14 09:53:03 +0100 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-04-20 15:43:32 -0400 |
commit | 49628664eee0ca3e4a9c2dbd8ed27b30a033b21f (patch) | |
tree | d96fb771ae27e247deb21c4bf5486a975509a34b /app | |
parent | 989bcfcc7a933bd83f1ee2aaf8697b445abf06f2 (diff) | |
download | gitlab-ce-49628664eee0ca3e4a9c2dbd8ed27b30a033b21f.tar.gz |
Removed buttons instead clicking date sets it
Fixed issue with dropdown not being toggleable again
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/due_date_select.js.coffee | 18 | ||||
-rw-r--r-- | app/assets/javascripts/issuable_context.js.coffee | 1 | ||||
-rw-r--r-- | app/views/shared/issuable/_sidebar.html.haml | 7 |
3 files changed, 10 insertions, 16 deletions
diff --git a/app/assets/javascripts/due_date_select.js.coffee b/app/assets/javascripts/due_date_select.js.coffee index 58d4f79ed84..78bdb3c0e04 100644 --- a/app/assets/javascripts/due_date_select.js.coffee +++ b/app/assets/javascripts/due_date_select.js.coffee @@ -1,11 +1,12 @@ 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) diff --git a/app/assets/javascripts/issuable_context.js.coffee b/app/assets/javascripts/issuable_context.js.coffee index 9ae0cd06039..3a439b94c59 100644 --- a/app/assets/javascripts/issuable_context.js.coffee +++ b/app/assets/javascripts/issuable_context.js.coffee @@ -33,7 +33,6 @@ class @IssuableContext $block.find('.dropdown-menu-toggle').trigger 'click' , 0 - $(".right-sidebar").niceScroll() initParticipants: -> diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml index 6c19f794a67..61a655a40df 100644 --- a/app/views/shared/issuable/_sidebar.html.haml +++ b/app/views/shared/issuable/_sidebar.html.haml @@ -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 |