linting and added filter states

This commit is contained in:
Rashid Khan
2013-07-17 21:57:19 -07:00
parent 254a553e5b
commit c03373c692
14 changed files with 383 additions and 348 deletions
+19 -20
View File
@@ -1,3 +1,5 @@
/*jshint globalstrict:true */
/*global angular:true */
/*
## Column
@@ -8,26 +10,23 @@
### Parameters
* panels :: an array of panel objects. All of their spans should be set to 12
### Group Events
#### Sends
* time :: Object Includes from, to and index
*/
'use strict';
angular.module('kibana.column', [])
.controller('column', function($scope, $rootScope) {
.controller('column', function($scope, $rootScope, $timeout) {
// Set and populate defaults
var _d = {
status: "Stable",
panels : [
]
}
panels : []
};
_.defaults($scope.panel,_d);
$scope.init = function(){
$scope.reset_panel();
}
};
$scope.toggle_row = function(panel) {
panel.collapse = panel.collapse ? false : true;
@@ -36,15 +35,15 @@ angular.module('kibana.column', [])
$scope.send_render();
});
}
}
};
$scope.send_render = function() {
$scope.$broadcast('render');
}
};
$scope.add_panel = function(panel) {
$scope.panel.panels.push(panel);
}
};
$scope.reset_panel = function(type) {
$scope.new_panel = {
@@ -76,17 +75,17 @@ angular.module('kibana.column', [])
$timeout(function() {
// Create a reference to the new_panel as panel so that the existing
// editors work with our isolate scope
scope.panel = scope.new_panel
var template = '<div ng-include src="\'panels/column/panelgeneral.html\'"></div>'
scope.panel = scope.new_panel;
var template = '<div ng-include src="\'panels/column/panelgeneral.html\'"></div>';
if(!(_.isUndefined(scope.type)) && scope.type != "")
if(!(_.isUndefined(scope.type)) && scope.type !== "") {
template = template+'<div ng-include src="\'panels/'+scope.type+'/editor.html\'"></div>';
//var new_elem = $compile(angular.element(template))(scope))
}
elem.html($compile(angular.element(template))(scope));
})
})
});
});
}
}
};
}).filter('withoutColumn', function() {
return function() {
return _.without(config.modules,'column');