Quellcode durchsuchen

Dashboard : fixes

carruesco vor 1 Jahr
Ursprung
Commit
db8e3c1c40

+ 5 - 5
plugin/dashboard/dashboard.plugin.php

@@ -100,17 +100,17 @@ function dashboard_application_bottom(){
 						<div class="col-md-3 border-right px-0 overflow-auto h-100 dashboard-configure-menu" id="dashboard-configure-menu">
 							<ul class="nav nav-tabs flex-column dashboard-configure-menu rounded-0 border-0" id="dashboard-configure-menu" role="tablist" aria-orientation="vertical">
 								<li data-menu='model' class="nav-item border-bottom">
-									<a class="nav-link border-0 rounded-0 active" id="model-tab" data-toggle="tab" href="#model" role="tab" aria-controls="model" aria-selected="true">
+									<a class="nav-link border-0 rounded-0 active" id="model-tab" data-toggle="tab" role="tab" aria-controls="model" aria-selected="true">
 										<i class="far fa-window-maximize mr-1"></i>Modèle
 									</a>
 								</li>
 								<li data-menu='properties' class="nav-item border-bottom">
-									<a class="nav-link border-0 rounded-0" id="properties-tab" data-toggle="tab" href="#properties" role="tab" aria-controls="properties" aria-selected="false">
+									<a class="nav-link border-0 rounded-0" id="properties-tab" data-toggle="tab" role="tab" aria-controls="properties" aria-selected="false">
 										<i class="fas fa-list-ul mr-1"></i>Propriétés
 									</a>
 								</li>
 								<li data-menu='style' class="nav-item border-bottom">
-									<a class="nav-link border-0 rounded-0" id="style-tab" data-toggle="tab" href="#style" role="tab" aria-controls="style" aria-selected="false">
+									<a class="nav-link border-0 rounded-0" id="style-tab" data-toggle="tab" role="tab" aria-controls="style" aria-selected="false">
 										<i class="fas fa-palette mr-1"></i>Style
 									</a>
 								</li>
@@ -199,8 +199,8 @@ function dashboard_application_bottom(){
 Plugin::addCss("/css/main.css");
 Plugin::addCss("/css/component.css");
 Plugin::addJs("/js/main.js");
-Plugin::addJs("/js/dashboard.js");
-Plugin::addJs("/js/component.js");
+Plugin::addJs("/js/dashboard.js?v=a");
+Plugin::addJs("/js/component.js?v=a");
 
 //Mapping hook / fonctions
 Plugin::addHook("install", "dashboard_install");

+ 12 - 11
plugin/dashboard/js/component.js

@@ -101,7 +101,7 @@ function init_components_dashboard(input){
 		        id : id
 		},function(response){
 			var widget = response.item;
-			$('#dashboard-configure-menu li').off().click(function(){
+			$('#dashboard-configure-menu li').off('click').click(function(){
 					
 			    var li = $(this);
 			    var menu = li.attr('data-menu');
@@ -137,13 +137,8 @@ function init_components_dashboard(input){
 			 				 action : 'dashboard_widget_by_id',
 			 				 id : widget.id
 			 			},function(response){
-			 				$('#configure-style-table').fromJson(response.item).change(function(){
+			 				$('#configure-style-table').fromJson(response.item).off('change').change(function(){
 
-
-
-			 					var widgetData = {action:data.onConfigure};
-			 					
-			 					widgetData.id = widget.id;
 			 					var form = $('#configure-style-table').toJson();
 
 			 					widget.headerBackground = form['widget-header-background'];
@@ -153,8 +148,6 @@ function init_components_dashboard(input){
 			 					widget.titleColor = form['widget-header-title-color'];
 			 					widget.icon = form['widget-header-icon'];
 
-			 		
-
 			 					var customiser = $('.dashboard-widget-customizer');
 			 					$('.dashboard-widget-header',customiser).css('backgroundColor',widget.headerBackground+'!important');
 			 					$('.widget-header-title',customiser).css('color',widget.titleColor+'!important');
@@ -165,12 +158,20 @@ function init_components_dashboard(input){
 			 					$('.widget-header-icon i',customiser).css('color',widget.iconColor+'!important');
 			 					$('.widget-header-icon i',customiser).attr('class',widget.icon);
 
-			 					widgetData = $.extend(widgetData,widget);
 
 			 					component.widgets[widget.id] = widget;
 			 					component.renderContent(widget.id);
 
-			 					$.action(widgetData);
+			 					$.action({
+			 						action :  data.onConfigure,
+			 						id :  widget.id,
+			 						headerBackground : widget.headerBackground,
+									bodyBackground : widget.bodyBackground,
+									bodyColor : widget.bodyColor,
+									iconColor : widget.iconColor,
+									titleColor : widget.titleColor,
+									icon : widget.icon
+			 					});
 			 			});
 
 			 			});

+ 4 - 3
plugin/dashboard/js/dashboard.js

@@ -292,11 +292,12 @@ class Dashboard {
 	renderContent(id) {
 		
 		var widget = this.widgets[id];
+		console.log(id,widget);
 		var widgetElement = widget.element!=null ? widget.element : $(Mustache.render(this.widgetTemplate, widget));
+		
 		if(widget.label !== null) widgetElement.find('.widget-header-title').html(widget.label);
-		if(widget.icon !== null){
-			widgetElement.find('.widget-header-icon i').attr('class', widget.icon);
-		}
+		if(widget.icon !== null) widgetElement.find('.widget-header-icon i').attr('class', widget.icon);
+		
 		if(widget.headerBackground !== null) widgetElement.find('.dashboard-widget-header').css('backgroundColor',widget.headerBackground);
 		if(widget.bodyBackground !== null) widgetElement.find('.dashboard-widget-content').css('backgroundColor',widget.bodyBackground);
 		if(widget.titleColor !== null) widgetElement.find('.widget-header-title,.widget-header-options').css('color',widget.titleColor);