|
@@ -6,7 +6,6 @@ function init_components_dashboard(input){
|
|
|
onRemove: 'dashboard_widget_delete',
|
|
|
onResize: 'dashboard_widget_resize',
|
|
|
onConfigure: 'dashboard_widget_configure',
|
|
|
- onSelectModel: 'dashboard_widget_select_model',
|
|
|
onAdd: 'dashboard_widget_add'
|
|
|
},{
|
|
|
column: input.attr('data-column'),
|
|
@@ -60,7 +59,6 @@ function init_components_dashboard(input){
|
|
|
content : '<p>Wazup 2 ?</p>'
|
|
|
}]);*/
|
|
|
|
|
|
-
|
|
|
component.on('placeholder-click',function(placeholder){
|
|
|
$.action({
|
|
|
action : data.onAdd,
|
|
@@ -71,9 +69,7 @@ function init_components_dashboard(input){
|
|
|
},function(widget){
|
|
|
component.addWidgets([widget]);
|
|
|
});
|
|
|
- });
|
|
|
-
|
|
|
- component.on('move',function(widget){
|
|
|
+ }).on('move',function(widget){
|
|
|
console.log('Widget has moved', widget);
|
|
|
|
|
|
$.action({
|
|
@@ -99,43 +95,71 @@ function init_components_dashboard(input){
|
|
|
});
|
|
|
|
|
|
}).on('configure',function(id){
|
|
|
-
|
|
|
-
|
|
|
- var selectMenu = function(id,menu){
|
|
|
- $('#widget-types').fill({
|
|
|
- action : data.onConfigure,
|
|
|
- id : id,
|
|
|
- menu : menu
|
|
|
- },function(response){
|
|
|
-
|
|
|
- switch(menu){
|
|
|
- case 'type':
|
|
|
-
|
|
|
- $('#widget-types li').click(function(){
|
|
|
- $('#widget-types li').removeClass('active');
|
|
|
- $(this).addClass('active');
|
|
|
- $.action({
|
|
|
- action : data.onSelectModel,
|
|
|
- id : id,
|
|
|
- model : $(this).attr('data-model')
|
|
|
+
|
|
|
+ $.action({
|
|
|
+ action : 'dashboard_widget_by_id',
|
|
|
+ id : id
|
|
|
+ },function(response){
|
|
|
+ var widget = response.item;
|
|
|
+ $('#dashboard-configure-menu li').off().click(function(){
|
|
|
+
|
|
|
+ var li = $(this);
|
|
|
+ var menu = li.attr('data-menu');
|
|
|
+ li.addClass('active').parent().find('>li').removeClass('active');
|
|
|
+
|
|
|
+ switch(menu){
|
|
|
+ case "model":
|
|
|
+
|
|
|
+ $('#dashboard-configure-content').html($('#configure-model').html());
|
|
|
+
|
|
|
+ init_components('#dashboard-configure-content');
|
|
|
+ var modelList = $('#widget-models');
|
|
|
+ modelList.fill({
|
|
|
+ action : 'dashboard_model_search',
|
|
|
},function(response){
|
|
|
-
|
|
|
+ $('li',modelList).removeClass('active');
|
|
|
+ $('li[data-model="'+widget.model+'"]',modelList).addClass('active');
|
|
|
+ $('li',modelList).click(function(){
|
|
|
+ $('#widget-models li').removeClass('active');
|
|
|
+ $(this).addClass('active');
|
|
|
+ $.action({
|
|
|
+ action : data.onConfigure,
|
|
|
+ id : widget.id,
|
|
|
+ model : $(this).attr('data-model')
|
|
|
+ },function(response){
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
- break;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- selectMenu(id,"type");
|
|
|
+ break;
|
|
|
+ case "style":
|
|
|
+ $('#dashboard-configure-content').html($('#configure-style').html());
|
|
|
+ $.action({
|
|
|
+ action : 'dashboard_widget_by_id',
|
|
|
+ id : widget.id
|
|
|
+ },function(response){
|
|
|
+ $('#configure-style-table').fromJson(response.item).change(function(){
|
|
|
+ var data = {}
|
|
|
+ data.action = data.onConfigure;
|
|
|
+ data.id = widget.id;
|
|
|
+ var form = $('#configure-style-table').toJson();
|
|
|
+ data.headerBackground = form['widget-header-background'];
|
|
|
+ data.bodyBackground = form['widget-body-background'];
|
|
|
+ data.headerIcon = form['widget-header-icon'];
|
|
|
+
|
|
|
+ $.action(data);
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+ init_components('#dashboard-configure-content');
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#dashboard-configure-menu li[data-menu="model"]').click();
|
|
|
+ });
|
|
|
|
|
|
- $('#dashboard-configure-menu li').click(function(){
|
|
|
- var li = $(this);
|
|
|
- var menu = li.attr('data-menu');
|
|
|
- li.parent().find('>li').removeClass('active');
|
|
|
- li.addClass('active');
|
|
|
+
|
|
|
|
|
|
- selectMenu(id,menu);
|
|
|
- });
|
|
|
});
|
|
|
}
|