Skip to content

Commit 74a55a7

Browse files
committed
fix(wizard): show only one information message
1 parent 7a24970 commit 74a55a7

File tree

1 file changed

+70
-69
lines changed

1 file changed

+70
-69
lines changed

js/scripts.js

Lines changed: 70 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,11 @@ function showTiles(tiles, defaultForms) {
294294
var tiles = sortFormAndFaqItems(tiles, sortByName);
295295
var html = '';
296296
if (defaultForms) {
297-
html += '<p>' + i18n.textdomain('formcreator').__('No form found. Please choose a form below instead', 'formcreator') + '</p>'
297+
if (tiles.length > 0) {
298+
html += '<p>' + i18n.textdomain('formcreator').__('No form found. Please choose a form below instead.', 'formcreator') + '</p>';
299+
} else {
300+
html += '<p>' + i18n.textdomain('formcreator').__('No form found.', 'formcreator') + '</p>';
301+
}
298302
}
299303
html += buildTiles(tiles);
300304

@@ -380,83 +384,80 @@ function buildTiles(list) {
380384

381385
var html = '';
382386
if (list.length == 0) {
383-
html = '<p id="plugin_formcreator_formlist">'
384-
+ i18n.textdomain('formcreator').__('No item yet in this category', 'formcreator')
385-
+ '</p>'
386-
+'<p id="plugin_formcreator_faqlist"></p>';
387-
} else {
388-
var forms = [];
389-
var faqs = [];
390-
$.each(list, function (key, item) {
391-
// Build a HTML tile
392-
var url = formcreatorRootDoc + '/front/formdisplay.php?id=' + item.id;
393-
if (item.type != 'form') {
394-
url = rootDoc + '/front/knowbaseitem.form.php?id=' + item.id;
395-
}
396-
397-
var tiles_design = "";
398-
if (item.tile_template == "1") { // @see PluginFormcreatorEntityConfig::CONFIG_UI_FORM_UNIFORM_HEIGHT
399-
tiles_design = "tile_design_uniform_height";
400-
}
401-
402-
var description = '';
403-
if (item.description) {
404-
description = '<div class="plugin_formcreator_formTile_description '+ tiles_design +'">'
405-
+item.description
406-
+'</div>';
407-
}
387+
return html;
388+
}
408389

409-
var default_class = '';
410-
if (JSON.parse(item.is_default)) {
411-
default_class = 'default_form';
412-
}
390+
var forms = [];
391+
var faqs = [];
392+
$.each(list, function (key, item) {
393+
// Build a HTML tile
394+
var url = formcreatorRootDoc + '/front/formdisplay.php?id=' + item.id;
395+
if (item.type != 'form') {
396+
url = rootDoc + '/front/knowbaseitem.form.php?id=' + item.id;
397+
}
413398

414-
if (item.icon == '') {
415-
if (item.type == 'form') {
416-
item.icon = 'fa fa-question-circle';
417-
} else {
418-
item.icon = 'fa fa-clipboard-list';
419-
}
420-
}
399+
var tiles_design = "";
400+
if (item.tile_template == "1") { // @see PluginFormcreatorEntityConfig::CONFIG_UI_FORM_UNIFORM_HEIGHT
401+
tiles_design = "tile_design_uniform_height";
402+
}
421403

422-
if (item.icon_color == '') {
423-
item.icon_color = '#999999';
424-
}
404+
var description = '';
405+
if (item.description) {
406+
description = '<div class="plugin_formcreator_formTile_description '+ tiles_design +'">'
407+
+item.description
408+
+'</div>';
409+
}
425410

426-
if (item.background_color == '') {
427-
item.background_color = '#e7e7e7';
428-
}
411+
var default_class = '';
412+
if (JSON.parse(item.is_default)) {
413+
default_class = 'default_form';
414+
}
429415

416+
if (item.icon == '') {
430417
if (item.type == 'form') {
431-
forms.push(
432-
'<div data-itemtype="PluginFormcreatorForm" data-id="' + item.id + '" style="background-color: ' + item.background_color + '" class="plugin_formcreator_formTile '+item.type+' '+tiles_design+' '+default_class+'" title="'+item.description+'">'
433-
+ '<i class="' + item.icon + '" style="color: ' + item.icon_color+ '"></i>'
434-
+ '<a href="' + url + '" class="plugin_formcreator_formTile_title">'
435-
+ item.name
436-
+ '</a>'
437-
+ description
438-
+ '</div>'
439-
);
418+
item.icon = 'fa fa-question-circle';
440419
} else {
441-
faqs.push(
442-
'<div style="background-color: ' + item.background_color + '" class="plugin_formcreator_formTile '+item.type+' '+tiles_design+' '+default_class+'" title="'+item.description+'">'
443-
+ '<i class="fa ' + item.icon + '" style="color: ' + item.icon_color+ '"></i>'
444-
+ '<a href="' + url + '" class="plugin_formcreator_formTile_title">'
445-
+ item.name
446-
+ '</a>'
447-
+ description
448-
+ '</div>'
449-
);
420+
item.icon = 'fa fa-clipboard-list';
450421
}
451-
});
422+
}
452423

453-
// concatenate all HTML parts
454-
html = '<div id="plugin_formcreator_formlist">'
455-
+ forms.join("")
456-
+ '</div><div id="plugin_formcreator_faqlist">'
457-
+ faqs.join("")
458-
+ '</div>'
459-
}
424+
if (item.icon_color == '') {
425+
item.icon_color = '#999999';
426+
}
427+
428+
if (item.background_color == '') {
429+
item.background_color = '#e7e7e7';
430+
}
431+
432+
if (item.type == 'form') {
433+
forms.push(
434+
'<div data-itemtype="PluginFormcreatorForm" data-id="' + item.id + '" style="background-color: ' + item.background_color + '" class="plugin_formcreator_formTile '+item.type+' '+tiles_design+' '+default_class+'" title="'+item.description+'">'
435+
+ '<i class="' + item.icon + '" style="color: ' + item.icon_color+ '"></i>'
436+
+ '<a href="' + url + '" class="plugin_formcreator_formTile_title">'
437+
+ item.name
438+
+ '</a>'
439+
+ description
440+
+ '</div>'
441+
);
442+
} else {
443+
faqs.push(
444+
'<div style="background-color: ' + item.background_color + '" class="plugin_formcreator_formTile '+item.type+' '+tiles_design+' '+default_class+'" title="'+item.description+'">'
445+
+ '<i class="fa ' + item.icon + '" style="color: ' + item.icon_color+ '"></i>'
446+
+ '<a href="' + url + '" class="plugin_formcreator_formTile_title">'
447+
+ item.name
448+
+ '</a>'
449+
+ description
450+
+ '</div>'
451+
);
452+
}
453+
});
454+
455+
// concatenate all HTML parts
456+
html = '<div id="plugin_formcreator_formlist">'
457+
+ forms.join("")
458+
+ '</div><div id="plugin_formcreator_faqlist">'
459+
+ faqs.join("")
460+
+ '</div>'
460461

461462
return html;
462463
}

0 commit comments

Comments
 (0)