E2E: select all permissions

This commit is contained in:
Maikel Linke
2015-06-10 15:28:53 +10:00
parent 795b2700b4
commit f2bc98e812
2 changed files with 14 additions and 0 deletions

View File

@@ -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

View File

@@ -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]"}