Merge pull request #571 from mlorb/ml_sci_316

Remove behavior of not allowing the empty tables in steps [SCI-316]
This commit is contained in:
mlorb 2017-04-25 15:30:30 +02:00 committed by GitHub
commit b930af0033
2 changed files with 3 additions and 21 deletions

View file

@ -188,11 +188,9 @@ function formCallback($form) {
$form.submit(function(){
$(this).find("[data-role='editable-table']").each(function() {
var hot = $(this).find(".hot").handsontable('getInstance');
if (hot && hot.countEmptyRows() != hot.countRows()) {
var contents = $(this).find('.hot-contents');
var data = JSON.stringify({data: hot.getData()});
contents.attr("value", data);
}
var contents = $(this).find('.hot-contents');
var data = JSON.stringify({data: hot.getData()});
contents.attr("value", data);
});
setTimeout(function() {
@ -531,7 +529,6 @@ $("[data-action='new-step']").on("ajax:success", function(e, data) {
function processStep(ev, editMode) {
var $form = $(ev.target.form);
$form.clearFormErrors();
$form.removeBlankExcelTables(editMode);
$form.removeBlankFileForms();
var $fileInputs = $form.find("input[type=file]");

View file

@ -21,18 +21,3 @@ $.fn.removeBlankFileForms = function () {
}
});
}
/*
* Not the actual Excel tables, but are similar.
*/
$.fn.removeBlankExcelTables = function (editMode) {
if(editMode) {
$tables = $(this).find("[data-role='editable-table']");
// In edit mode, tables can't be blank
$tables.each(function () {
if (!$(this).find("td:not(:empty)").length) {
$(this).closest("fieldset").remove();
}
});
}
}