Disable 'sortable' when editing poll time options

pull/1/head
yflory 3 years ago
parent 6680293ef1
commit 9770d03479

@ -600,6 +600,12 @@
} }
} }
.cp-form-edit-block { .cp-form-edit-block {
&.cp-no-sortable {
.cp-form-handle {
visibility: hidden;
cursor: default;
}
}
button.btn-secondary { button.btn-secondary {
margin-left: 30px; margin-left: 30px;
margin-bottom: 5px; margin-bottom: 5px;

@ -374,11 +374,16 @@ define([
var container = h('div.cp-form-edit-block', inputs); var container = h('div.cp-form-edit-block', inputs);
var $container = $(container); var $container = $(container);
Sortable.create(container, { var sortableOption = Sortable.create(container, {
direction: "vertical", direction: "vertical",
handle: ".cp-form-handle", handle: ".cp-form-handle",
draggable: ".cp-form-edit-block-input", draggable: ".cp-form-edit-block-input",
forceFallback: true, forceFallback: true,
store: {
set: function () {
evOnSave.fire();
}
}
}); });
var containerItems; var containerItems;
@ -393,6 +398,11 @@ define([
handle: ".cp-form-handle", handle: ".cp-form-handle",
draggable: ".cp-form-edit-block-input", draggable: ".cp-form-edit-block-input",
forceFallback: true, forceFallback: true,
store: {
set: function () {
evOnSave.fire();
}
}
}); });
} }
@ -456,6 +466,8 @@ define([
var refreshView = function () { var refreshView = function () {
if (!v.type) { return; } if (!v.type) { return; }
var $calendar = $(calendarView); var $calendar = $(calendarView);
sortableOption.option("disabled", v.type !== "text");
$container.toggleClass('cp-no-sortable', v.type !== "text");
if (v.type !== "day") { if (v.type !== "day") {
$calendar.hide(); $calendar.hide();
$container.show(); $container.show();

Loading…
Cancel
Save