Răsfoiți Sursa

Dashboard : wip

idleman 2 ani în urmă
părinte
comite
e785a92df3
2 a modificat fișierele cu 19 adăugiri și 14 ștergeri
  1. 16 12
      plugin/dashboard/js/component.js
  2. 3 2
      plugin/dashboard/js/dashboard.js

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

@@ -146,24 +146,28 @@ function init_components_dashboard(input){
 			 					widgetData.id = widget.id;
 			 					var form = $('#configure-style-table').toJson();
 
-			 					widgetData.headerBackground = form['widget-header-background'];
-			 					widgetData.bodyBackground = form['widget-body-background'];
-			 					widgetData.bodyColor= form['widget-body-color'];
-			 					widgetData.iconColor = form['widget-header-icon-color'];
-			 					widgetData.titleColor = form['widget-header-title-color'];
-			 					widgetData.icon = form['widget-header-icon'];
+			 					widget.headerBackground = form['widget-header-background'];
+			 					widget.bodyBackground = form['widget-body-background'];
+			 					widget.bodyColor= form['widget-body-color'];
+			 					widget.iconColor = form['widget-header-icon-color'];
+			 					widget.titleColor = form['widget-header-title-color'];
+			 					widget.icon = form['widget-header-icon'];
+
+			 		
 
 			 					var customiser = $('.dashboard-widget-customizer');
-			 					$('.dashboard-widget-header',customiser).css('backgroundColor',widgetData.headerBackground+'!important');
-			 					$('.widget-header-title',customiser).css('color',widgetData.titleColor+'!important');
+			 					$('.dashboard-widget-header',customiser).css('backgroundColor',widget.headerBackground+'!important');
+			 					$('.widget-header-title',customiser).css('color',widget.titleColor+'!important');
 			 					$('.dashboard-widget-content',customiser).css({
-			 						backgroundColor : widgetData.bodyBackground+'!important',
-			 						color : widgetData.bodyColor+'!important'
+			 						backgroundColor : widget.bodyBackground+'!important',
+			 						color : widget.bodyColor+'!important'
 			 					});
-			 					$('.widget-header-icon i',customiser).css('color',widgetData.iconColor+'!important');
-			 					$('.widget-header-icon i',customiser).attr('class',widgetData.icon);
+			 					$('.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);

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

@@ -293,9 +293,10 @@ class Dashboard {
 		
 		var widget = this.widgets[id];
 		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);