BPUR: toggle visbility of columns

This commit is contained in:
Rob H
2013-06-21 15:36:25 +05:30
committed by Rohan Mitchell
parent f750251cb8
commit 23a56ff4f1
4 changed files with 123 additions and 23 deletions

View File

@@ -88,12 +88,51 @@ productsApp.directive('ngToggleVariants',function(){
};
});
productsApp.directive('ngToggleColumn',function(){
return {
link: function(scope,element,attrs){
if (!scope.column.visible) { element.addClass("unselected"); }
element.click('click', function(){
scope.$apply(function(){
if (scope.column.visible) { scope.column.visible = false; element.addClass("unselected"); }
else { scope.column.visible = true; element.removeClass("unselected"); }
});
});
}
};
});
productsApp.directive('ngToggleColumnList', function($compile){
return {
link: function(scope,element,attrs){
var dialogDiv = element.next();
element.on('click',function(){
var pos = element.position();
var height = element.outerHeight();
dialogDiv.css({
position: "absolute",
top: (pos.top + height) + "px",
left: pos.left + "px",
}).toggle();
});
}
}
});
productsApp.controller('AdminBulkProductsCtrl', function($scope, $timeout, $http, dataFetcher) {
$scope.updateStatusMessage = {
text: "",
style: {}
}
$scope.columns = {
name: { name: 'Name', visible: true },
supplier: { name: 'Supplier', visible: true },
price: { name: 'Price', visible: true },
on_hand: { name: 'On Hand', visible: true },
available_on: { name: 'Available On', visible: true }
}
$scope.refreshSuppliers = function(){
dataFetcher('/enterprises/suppliers.json').then(function(data){
$scope.suppliers = data;