WIP: Adding basic UI for applying hard filtering to BPE

This commit is contained in:
Rob H
2014-01-04 19:21:10 +08:00
parent 7ef358a476
commit a6d7044dfd
5 changed files with 91 additions and 15 deletions

View File

@@ -138,10 +138,17 @@ productsApp.controller "AdminBulkProductsCtrl", [
["Items", "items"]
]
$scope.filterTypes = [
{ name: "Equals", ransack_predicate: "eq" }
$scope.filterableColumns = [
{ name: "Supplier", db_column: "supplier" },
{ name: "Name", db_column: "name" }
]
$scope.filterTypes = [
{ name: "Equals", predicate: "eq" },
{ name: "Contains", predicate: "eq" }
]
$scope.perPage = 25
$scope.currentPage = 1
$scope.products = []
@@ -231,8 +238,8 @@ productsApp.controller "AdminBulkProductsCtrl", [
$scope.addFilter = (filter) ->
if Object.keys($scope.columns).indexOf(filter.property) >= 0
if $scope.filterTypes.map( (filter_type) -> filter_type.ransack_predicate ).indexOf(filter.ransack_predicate) >= 0
if $scope.filterableColumns.indexOf(filter.property) >= 0
if $scope.filterTypes.indexOf(filter.predicate) >= 0
$scope.currentFilters.push filter