Skip to content

Commit

Permalink
fix(form): list on self service homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Sep 2, 2022
1 parent 043b80e commit ba6d4a5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 32 deletions.
1 change: 0 additions & 1 deletion inc/common.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,6 @@ public static function hookRedefineMenu($menus) {
* @return void
*/
public static function showMiniDashboard(): void {

Plugin::doHook(Hooks::DISPLAY_CENTRAL);

if (PluginFormcreatorEntityconfig::getUsedConfig('is_dashboard_visible', Session::getActiveEntity()) == PluginFormcreatorEntityconfig::CONFIG_DASHBOARD_VISIBLE) {
Expand Down
17 changes: 9 additions & 8 deletions inc/form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1949,17 +1949,18 @@ public function showForCentral() {
echo '<td><div>' . __($row['description'], $domain) . '&nbsp;</div></td>';
echo '</tr>';
}

echo '</table>';
echo '<br />';
echo Html::scriptBlock('function showDescription(id, img){
if(img.alt == "+") {
img.alt = "-";
img.class = "class=\"fas fa-minus-circle\"";

echo Html::scriptBlock('function showDescription(id, img) {
if(img.getAttribute("alt") == "+") {
img.setAttribute("alt", "-");
img.classList.remove("fa-plus-circle");
img.classList.add("fa-minus-circle");
document.getElementById("desc" + id).style.display = "table-row";
} else {
img.alt = "+";
img.src = "class=\"fas fa-plus-circle\"";
img.setAttribute("alt", "+");
img.classList.remove("fa-minus-circle");
img.classList.add("fa-plus-circle");
document.getElementById("desc" + id).style.display = "none";
}
}');
Expand Down
39 changes: 16 additions & 23 deletions js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,7 @@ $(function() {
});

if (location.pathname.indexOf("helpdesk.public.php") != -1) {
$('.ui-tabs-panel:visible').ready(function() {
showHomepageFormList();
});

$('#tabspanel + div.ui-tabs').on("tabsload", function(event, ui) {
showHomepageFormList();
});

showHomepageFormList();
plugin_formcreator.showHomepageFormList();

} else if ($('#plugin_formcreator_wizard_categories').length > 0) {
updateCategoriesView();
Expand Down Expand Up @@ -149,20 +141,6 @@ $(function() {
}
});

function showHomepageFormList() {
if ($('#plugin_formcreatorHomepageForms').length) {
return;
}

$.get({
url: formcreatorRootDoc + '/ajax/homepage_forms.php',
}).done(function(response){
if (!$('#plugin_formcreatorHomepageForms').length) {
$('.central > tbody:first').first().prepend(response);
}
});
}

function updateCategoriesView() {
$.post({
url: formcreatorRootDoc + '/ajax/homepage_wizard.php',
Expand Down Expand Up @@ -509,6 +487,21 @@ var plugin_formcreator = new function() {
this.questionsColumns = 4; // @see PluginFormcreatorSection::COLUMNS
this.dirty = false;


this.showHomepageFormList = function () {
if ($('#plugin_formcreatorHomepageForms').length) {
return;
}

$.get({
url: formcreatorRootDoc + '/ajax/homepage_forms.php',
}).done(function(response){
// $('.central').first().prepend(response);
var card = $(response);
$('table.central').append(card)
});
}

this.setupGridStack = function(group) {
var that = this;
group.gridstack
Expand Down

0 comments on commit ba6d4a5

Please sign in to comment.