mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
E2E: select all permissions
This commit is contained in:
@@ -9,3 +9,14 @@ angular.module("ofn.admin").controller "AdminEnterpriseRelationshipsCtrl", ($sco
|
||||
$scope.delete = (enterprise_relationship) ->
|
||||
if confirm("Are you sure?")
|
||||
$scope.EnterpriseRelationships.delete enterprise_relationship
|
||||
|
||||
$scope.allPermissionsChecked = ->
|
||||
for i in EnterpriseRelationships.all_permissions
|
||||
if !$scope.permissions[i]
|
||||
return false
|
||||
return true
|
||||
|
||||
$scope.checkAllPermissions = ->
|
||||
newValue = !$scope.allPermissionsChecked()
|
||||
EnterpriseRelationships.all_permissions.forEach (p) ->
|
||||
$scope.permissions[p] = newValue
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
%td
|
||||
%select{name: "enterprise_relationship_child_id", "ng-model" => "child_id", "ng-options" => "e.id as e.name for e in Enterprises.all_enterprises"}
|
||||
%td
|
||||
%label
|
||||
%input{type: "checkbox", ng: {checked: "allPermissionsChecked()", click: "checkAllPermissions()"}}
|
||||
Everything
|
||||
%div{"ng-repeat" => "permission in EnterpriseRelationships.all_permissions"}
|
||||
%label
|
||||
%input{type: "checkbox", "ng-model" => "permissions[permission]"}
|
||||
|
||||
Reference in New Issue
Block a user