Browse Source

dashboard : wip

idleman 1 year ago
parent
commit
9aec353531

+ 1 - 1
plugin/dashboard/action.php

@@ -168,7 +168,7 @@ Action::register('dashboard_widget_configure',function(&$response){
 	if(empty($_['id'])) throw new Exception('Aucun identifiant renseigné');
 
 	$widget = DashboardWidget::getById($_['id'],1);
-	$widget->meta = json_decode($widget->meta,true);
+	if(is_string($widget->meta)) $widget->meta = json_decode($widget->meta,true);
 	if(!is_array($widget->meta)) $widget->meta = array();
 
 	if(!$widget) throw new Exception('Widget introuvable');

+ 1 - 1
plugin/dashboard/css/component.css

@@ -127,7 +127,7 @@
 	display: flex;
 }
 .dashboard-container .dashboard-widget .dashboard-widget-content{
-	padding: 5px;
+	
 	height: calc(100% - 34px);
 	max-height: calc(100% - 34px);
 	overflow: auto;

+ 1 - 1
plugin/dashboard/js/component.js

@@ -158,7 +158,7 @@ function init_components_dashboard(input){
 			 			$('#dashboard-configure-content').html($('#properties-model').html());
 
 			 			$('#dashboard-properties-form').load('action.php',{action:data.onConfigureForm,id :  widget.id});
-
+			 			init_components();
 			 			$('#dashboard-properties-save').click(function(){
 			 				var bundle ={
 		 						action :  data.onConfigure,

+ 11 - 7
plugin/navigation/navigation.plugin.php

@@ -290,14 +290,12 @@ Plugin::addHook('widget',function(&$models){
 			Plugin::need('dashboard/DashboardWidget');
 		
 
-			if(empty($widget->meta['label'])){
-				$widget->meta['label'] =  'Bloc Menu';
-			}else{
-				$widget->meta['label'] =  '';
-				$widget->meta['icon'] = '';
-			}
-
+			if(empty($widget->meta['label'])) $widget->meta['label'] =  'Bloc Menu';
 			if(empty($widget->meta['url'])) $widget->meta['url'] = '';
+		
+			
+			
+
 			ob_start();
 
 				$icon = empty($widget->meta['icon']) ? 'far fa-bookmark' : $widget->meta['icon'];
@@ -306,7 +304,9 @@ Plugin::addHook('widget',function(&$models){
 				$url = navigation_meta_link($widget->meta['url']);
 				$label = navigation_meta_link($widget->meta['label']);
 
+
 				?>
+
 				<div style="background: <?php echo $color; ?>" class="widgetNavigationContainer">
 					<?php  if(!empty($widget->meta['label'])): ?>
 						<a href="<?php echo $url; ?>" <?php if(!empty($widget->meta['redirect'])) echo 'target="_blank"'; ?> >
@@ -321,11 +321,15 @@ Plugin::addHook('widget',function(&$models){
 			<?php
 
 			$widget->content = ob_get_clean();
+			$widget->headerBackground = $widget->meta['color'];
+			$widget->label = '';
+			$widget->icon = '';
 		};
 
 		$model->configure = function($widget){
 			if(empty($widget->meta['label'])) $widget->meta['label'] =  'Bloc Menu';
 			if(empty($widget->meta['url'])) $widget->meta['url'] = '';
+			if(empty($widget->meta['redirect'])) $widget->meta['redirect'] = '';
 			?>
 			<div id="navigation-widget-form">
 			<label for="">Icone / Titre / Couleur :</label>