Disable 'sortable' when editing poll time options

This commit is contained in:
yflory 2021-09-03 13:22:15 +02:00
parent 6680293ef1
commit 9770d03479
2 changed files with 19 additions and 1 deletions

View File

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

View File

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