Fix new step button on empty task [SCI-3826] (#2026)

* Fix new step button on empty task

* Fix markup
This commit is contained in:
aignatov-bio 2019-09-09 10:43:38 +02:00 committed by GitHub
parent fdce4e6c7c
commit 16ae00782a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -107,7 +107,6 @@
$("[data-action='cancel-edit']")
.on("ajax:success", function(e, data) {
var $form = $(this).closest("form");
$form.after(data.html);
var $new_step = $(this).next();
$(this).remove();
@ -139,7 +138,6 @@
var $edit_step = $step.after(data.html);
var $form = $step.next();
$step.remove();
formCallback($form);
initEditableHandsOnTable($form);
applyCancelCallBack();
@ -268,8 +266,9 @@
function toggleButtons(show) {
if (show) {
$("[data-action='new-step']").show();
$("[data-action='new-step']:first").show();
$("[data-action='edit-step']").show();
if ($('#steps .step').length > 0) $("[data-action='new-step']:last").show();
} else {
$("[data-action='new-step']").hide();
$("[data-action='edit-step']").hide();
@ -361,7 +360,6 @@
event.preventDefault();
event.stopPropagation();
event.stopImmediatePropagation();
var $form = $(this).closest("form");
$form.parent().remove().promise().done(function() {
newStepHandler();