Skip to content

Commit

Permalink
fix(widget): fix widget from central page
Browse files Browse the repository at this point in the history
  • Loading branch information
stonebuzz authored Oct 25, 2022
1 parent 611c977 commit 275757f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
17 changes: 13 additions & 4 deletions inc/history.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,13 @@ static function showCentralSpecificList($type) {
$options['criteria'][2]['value'] = 'mygroups';
$options['criteria'][2]['link'] = 'AND';

echo "<table class='tab_cadrehov' id='pluginEscaladeCentralList'>";
echo "<tr><th colspan='5'>";
echo "<div class='grid-item col-xl-6 col-xxl-4'><div class='card'>";
echo "<div class='card-body p-0'>";
echo "<div class='lazy-widget' data-itemtype='Ticket' data-widget='central_list'>";
echo "<div class='table-responsive card-table'>";
echo "<table class='table table-borderless table-striped table-hover card-table'>";
echo "<thead>";
echo "<tr><th colspan='4'>";
echo "<a href=\"".$CFG_GLPI["root_doc"]."/front/ticket.php?".
Toolbox::append_params($options, '&amp;')."\">".
Html::makeTitle($title, $number, $numrows)."</a>";
Expand All @@ -281,14 +286,18 @@ static function showCentralSpecificList($type) {
echo "<th></th>";
echo "<th>".__('Requester')."</th>";
echo "<th>".__('Associated element')."</th>";
echo "<th>".__('Description')."</th></tr>";
echo "<th>".__('Description')."</th></tr></thead>";
for ($i = 0; $i < $number; $i++) {
$ID = $DB->result($result, $i, "id");
Ticket::showVeryShort($ID, 'Ticket$2');
}
}
echo "</table>";
echo "<br />";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";
}
}
}
27 changes: 9 additions & 18 deletions js/central.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,15 @@
if ($('.nav-link.active:contains($locale_group_view)').length == 0) {
return;
}
// get central list for plugin and insert in group tab
$(".masonry_grid").each(function(){
var masonry_id = $(this).attr('id');
if (this.innerHTML.indexOf('escalade_block') < 0) {
//prepare a span element to load new elements
$(this).prepend("<div class='grid-item col-xl-6 col-xxl-4'><div class='card' id='escalade_block'></div></div>");
//ajax request
$("#escalade_block").load(CFG_GLPI.root_doc+"/"+GLPI_PLUGINS_PATH.escalade+'/ajax/central.php', function() {
if ($("#escalade_block").html() == "") {
$("#escalade_block").closest('.grid-item').remove();
} else {
var msnry = new Masonry('#'+masonry_id);
msnry.layout();
}
});
$.ajax({ type: "GET",
url: CFG_GLPI.root_doc+"/"+GLPI_PLUGINS_PATH.escalade+'/ajax/central.php',
async: false,
success : function(text)
{
if (text !== "") {
$(".masonry_grid").append(text);
window.msnry = new Masonry('.masonry_grid');
}
}
});
}, 100);
Expand Down

0 comments on commit 275757f

Please sign in to comment.