mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Filter relationships by permission
This commit is contained in:
@@ -10,6 +10,18 @@ angular.module("ofn.admin").controller "AdminEnterpriseRelationshipsCtrl", ($sco
|
||||
if confirm("Are you sure?")
|
||||
$scope.EnterpriseRelationships.delete enterprise_relationship
|
||||
|
||||
$scope.toggleKeyword = (string, key) ->
|
||||
string = '' unless string
|
||||
words = string.split ' '
|
||||
words = words.filter (s) ->
|
||||
s
|
||||
index = words.indexOf key
|
||||
if index > -1
|
||||
words.splice index, 1
|
||||
else
|
||||
words.push key
|
||||
words.join ' '
|
||||
|
||||
$scope.allPermissionsChecked = ->
|
||||
for i in EnterpriseRelationships.all_permissions
|
||||
if !$scope.permissions[i]
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
angular.module("ofn.admin").filter "keywords", ($filter) ->
|
||||
return (array, query) ->
|
||||
return array unless query
|
||||
keywords = query.split ' '
|
||||
keywords.forEach (key) ->
|
||||
array = $filter('filter')(array, key)
|
||||
array
|
||||
@@ -26,7 +26,7 @@ angular.module("ofn.admin").factory 'EnterpriseRelationships', ($http, enterpris
|
||||
|
||||
permission_presentation: (permission) ->
|
||||
switch permission
|
||||
when "add_to_order_cycle" then "to add to order cycle"
|
||||
when "manage_products" then "to manage products"
|
||||
when "edit_profile" then "to edit profile"
|
||||
when "create_variant_overrides" then "to override variant details"
|
||||
when "add_to_order_cycle" then "add to order cycle"
|
||||
when "manage_products" then "manage products"
|
||||
when "edit_profile" then "edit profile"
|
||||
when "create_variant_overrides" then "override variant details"
|
||||
|
||||
Reference in New Issue
Block a user