implement adding and removing scheduler slots
This commit is contained in:
@ -98,6 +98,7 @@ table.bookmarks .frequency {
|
||||
|
||||
.removable-group.removable .removable-item {
|
||||
flex: 1 0 auto;
|
||||
margin-right: .25rem;
|
||||
}
|
||||
|
||||
.removable-group.removable .option-remove-button {
|
||||
|
@ -1,6 +1,8 @@
|
||||
$.fn.schedulerInput = function() {
|
||||
this.each(function() {
|
||||
var $container = $(this);
|
||||
var $template = $container.find('.template');
|
||||
$template.find('input, select').prop('disabled', true);
|
||||
|
||||
var update = function(value){
|
||||
$container.find('.option').hide();
|
||||
@ -13,5 +15,19 @@ $.fn.schedulerInput = function() {
|
||||
update(value);
|
||||
});
|
||||
update($select.val());
|
||||
|
||||
$container.find('.add-button').on('click', function() {
|
||||
var row = $template.clone();
|
||||
row.removeClass('template').show();
|
||||
row.find('input, select').prop('disabled', false);
|
||||
$template.before(row);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$container.on('click', '.remove-button', function(e) {
|
||||
var row = $(e.target).parents('.scheduler-static-time-inputs');
|
||||
row.remove();
|
||||
});
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user