Created
October 6, 2017 04:43
-
-
Save paltman/62d32edb6932cf3e808199223083f7b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('eldarion-ajax'); | |
require('bootstrap-daterangepicker'); | |
import moment from 'moment'; | |
import ajaxSendMethod from './ajax'; | |
const loadDatePicker = () => { | |
$('#id_date').daterangepicker({ | |
singleDatePicker: true, | |
startDate: $('#id_date').val() || moment(), | |
locale: { | |
format: 'YYYY-MM-DD' | |
} | |
}); | |
}; | |
$(() => { | |
$(document).ajaxSend(ajaxSendMethod); | |
loadDatePicker(); | |
$(document).on('eldarion-ajax:complete', (event, $el, responseData, textStatus, jqXHR) => { | |
if ($el.attr('id') === 'note-form' || $el.hasClass('note-edit-link')) { | |
loadDatePicker(); | |
} | |
if ($el.hasClass('note-edit-link')) { | |
$el.parent().find('.note').toggleClass('active', false); | |
$el.toggleClass('active'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment