Fix widget detail state check logic (#7786)
* Fix widget detail state check logic * remove hidden class style * Update parent.php * Update index.php
This commit is contained in:
+22
-34
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2022-2025
|
Portions created by the Initial Developer are Copyright (C) 2022-2026
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
@@ -330,6 +330,16 @@ foreach ($widgets as $row) {
|
|||||||
echo " padding-top: 0;\n";
|
echo " padding-top: 0;\n";
|
||||||
echo "}\n";
|
echo "}\n";
|
||||||
}
|
}
|
||||||
|
if ($row['widget_details_state'] != "expanded") {
|
||||||
|
echo "#".$widget_id." .hud_details {\n";
|
||||||
|
echo " display: none;\n";
|
||||||
|
echo "}\n";
|
||||||
|
}
|
||||||
|
if ($row['widget_details_state'] == "hidden" || $row['widget_details_state'] == "disabled") {
|
||||||
|
echo "#".$widget_id." .hud_expander {\n";
|
||||||
|
echo " display: none;\n";
|
||||||
|
echo "}\n";
|
||||||
|
}
|
||||||
if (!empty($row['widget_label_text_color']) || !empty($row['widget_label_background_color'])) {
|
if (!empty($row['widget_label_text_color']) || !empty($row['widget_label_background_color'])) {
|
||||||
echo "#".$widget_id." > .hud_box > .hud_content > .hud_title:first-of-type {\n";
|
echo "#".$widget_id." > .hud_box > .hud_content > .hud_title:first-of-type {\n";
|
||||||
if (!empty($row['widget_label_text_color'])) { echo " color: ".$row['widget_label_text_color'].";\n"; }
|
if (!empty($row['widget_label_text_color'])) { echo " color: ".$row['widget_label_text_color'].";\n"; }
|
||||||
@@ -457,7 +467,7 @@ foreach ($widgets as $row) {
|
|||||||
echo "#".$widget_id." {\n";
|
echo "#".$widget_id." {\n";
|
||||||
echo " grid-row: span ".$row_span.";\n";
|
echo " grid-row: span ".$row_span.";\n";
|
||||||
echo "}\n";
|
echo "}\n";
|
||||||
echo "#".$widget_id.".expanded {\n";
|
echo "#".$widget_id.".details_expanded {\n";
|
||||||
echo " grid-row: span ".$expanded_row_span.";\n";
|
echo " grid-row: span ".$expanded_row_span.";\n";
|
||||||
echo "}\n";
|
echo "}\n";
|
||||||
}
|
}
|
||||||
@@ -486,12 +496,6 @@ foreach ($widgets as $row) {
|
|||||||
echo " grid-column: span 1;\n";
|
echo " grid-column: span 1;\n";
|
||||||
echo "}\n";
|
echo "}\n";
|
||||||
}
|
}
|
||||||
if ($row['widget_details_state'] == "hidden" || $row['widget_details_state'] == "disabled") {
|
|
||||||
echo "#".$widget_id." .hud_box .hud_expander, \n";
|
|
||||||
echo "#".$widget_id." .hud_box .hud_details {\n";
|
|
||||||
echo " display: none;\n";
|
|
||||||
echo "}\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
}
|
}
|
||||||
@@ -508,22 +512,6 @@ foreach ($widgets as $row) {
|
|||||||
echo " grid-column: span 2;\n";
|
echo " grid-column: span 2;\n";
|
||||||
echo "}\n";
|
echo "}\n";
|
||||||
}
|
}
|
||||||
if ($row['widget_details_state'] == "expanded") {
|
|
||||||
echo "#".$widget_id." .hud_box .hud_details {\n";
|
|
||||||
echo " display: block;\n";
|
|
||||||
echo "}\n";
|
|
||||||
}
|
|
||||||
if ($row['widget_details_state'] == "contracted") {
|
|
||||||
echo "#".$widget_id." .widget .hud_box .hud_details {\n";
|
|
||||||
echo " display: none;\n";
|
|
||||||
echo "}\n";
|
|
||||||
}
|
|
||||||
if ($row['widget_details_state'] == "hidden" || $row['widget_details_state'] == "disabled") {
|
|
||||||
echo "#".$widget_id." .hud_box .hud_expander, \n";
|
|
||||||
echo "#".$widget_id." .hud_box .hud_details {\n";
|
|
||||||
echo " display: none;\n";
|
|
||||||
echo "}\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
}
|
}
|
||||||
@@ -577,7 +565,7 @@ document.addEventListener('click', function(event) {
|
|||||||
if (hud_content || hud_expander) {
|
if (hud_content || hud_expander) {
|
||||||
let widget = event.target.closest('div.widget, div.child_widget');
|
let widget = event.target.closest('div.widget, div.child_widget');
|
||||||
|
|
||||||
if (widget.classList.contains('disabled')) {
|
if (widget.classList.contains('details_disabled')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -590,11 +578,11 @@ document.addEventListener('click', function(event) {
|
|||||||
function toggle_grid_row_span(widget_id) {
|
function toggle_grid_row_span(widget_id) {
|
||||||
let widget = document.getElementById(widget_id);
|
let widget = document.getElementById(widget_id);
|
||||||
|
|
||||||
if (widget.classList.contains('expanded')) {
|
if (widget.classList.contains('details_expanded')) {
|
||||||
widget.classList.remove('expanded');
|
widget.classList.remove('details_expanded');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
widget.classList.add('expanded');
|
widget.classList.add('details_expanded');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,20 +592,20 @@ function toggle_grid_row_span_all() {
|
|||||||
const widgets = document.querySelectorAll('div.widget, div.child_widget');
|
const widgets = document.querySelectorAll('div.widget, div.child_widget');
|
||||||
|
|
||||||
widgets.forEach(widget => {
|
widgets.forEach(widget => {
|
||||||
if (widget.classList.contains('disabled')) {
|
if (widget.classList.contains('details_disabled')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!first_toggle && widget.classList.contains('expanded')) {
|
if (!first_toggle && widget.classList.contains('details_expanded')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (widget.classList.contains('expanded') || widget.getAttribute('data-expanded-all') === 'true') {
|
if (widget.classList.contains('details_expanded') || widget.getAttribute('data-expanded-all') === 'true') {
|
||||||
widget.classList.remove('expanded');
|
widget.classList.remove('details_expanded');
|
||||||
widget.setAttribute('data-expanded-all', 'false');
|
widget.setAttribute('data-expanded-all', 'false');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
widget.classList.add('expanded');
|
widget.classList.add('details_expanded');
|
||||||
widget.setAttribute('data-expanded-all', 'true');
|
widget.setAttribute('data-expanded-all', 'true');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -719,7 +707,7 @@ window.addEventListener('resize', update_parent_height);
|
|||||||
$widget_path_name = $widget_path_array[1];
|
$widget_path_name = $widget_path_array[1];
|
||||||
$path_array = glob(dirname(__DIR__, 2).'/*/'.$application_name.'/resources/dashboard/'.$widget_path_name.'.php');
|
$path_array = glob(dirname(__DIR__, 2).'/*/'.$application_name.'/resources/dashboard/'.$widget_path_name.'.php');
|
||||||
|
|
||||||
echo "<div class='widget ".$widget_details_state."' id='".$widget_id."' ".($widget_path == 'dashboard/parent' ? "data-is-parent='true'" : null)." draggable='false'>\n";
|
echo "<div class='widget details_".$widget_details_state."' id='".$widget_id."' ".($widget_path == 'dashboard/parent' ? "data-is-parent='true'" : null)." draggable='false'>\n";
|
||||||
if (file_exists($path_array[0])) {
|
if (file_exists($path_array[0])) {
|
||||||
include $path_array[0];
|
include $path_array[0];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,10 @@ div.child_widget div.hud_chart {
|
|||||||
padding: 7px;
|
padding: 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.child_widget .hud_expander {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* dashboard settings */
|
/* dashboard settings */
|
||||||
<?php
|
<?php
|
||||||
foreach ($child_widgets as $row) {
|
foreach ($child_widgets as $row) {
|
||||||
|
|||||||
@@ -4129,10 +4129,6 @@ else { //default: white
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.no_results {
|
.no_results {
|
||||||
display: none;
|
display: none;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
|||||||
@@ -780,10 +780,10 @@
|
|||||||
const text = item.innerText.toLowerCase();
|
const text = item.innerText.toLowerCase();
|
||||||
|
|
||||||
if (text.includes(search_term)) {
|
if (text.includes(search_term)) {
|
||||||
item.classList.remove('hidden');
|
item.style.display = 'block';
|
||||||
visible_count++;
|
visible_count++;
|
||||||
} else {
|
} else {
|
||||||
item.classList.add('hidden');
|
item.style.display = 'none';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user