Ver código fonte

permissions ui

develop
Robin Thoni 9 anos atrás
pai
commit
d447d58e6f

+ 3
- 1
luticate/controllers/modals/permissionedit.controller.js Ver arquivo

@@ -8,13 +8,15 @@ angular.module('luticate')
8 8
             if (data != null) {
9 9
                 $scope.permission = data;
10 10
                 $scope.permission.IsNew = false;
11
+                $scope.neededPermission = "LU_PERM_EDIT";
11 12
             }
12 13
             else {
13 14
                 $scope.permission = {
14 15
                     Name: "",
15 16
                     Value: false,
16 17
                     IsNew: true
17
-                }
18
+                };
19
+                $scope.neededPermission = "LU_PERM_ADD";
18 20
             }
19 21
 
20 22
             $scope.submitForm = function()

+ 35
- 30
luticate/controllers/permissions.controller.js Ver arquivo

@@ -1,39 +1,44 @@
1 1
 angular.module('luticate')
2 2
     .controller('PermissionsController', ['$scope', 'luticateAuthPermissions',
3 3
         function($scope, luticateAuthPermissions) {
4
-            $scope.columns = [
5
-                {
6
-                    name: "Name",
7
-                    width: 6,
8
-                    getValue: function(item) {
9
-                        return item.Name;
10
-                    }
11
-                }, {
12
-                    name: "Value",
13
-                    width: 5,
14
-                    getValue: function(item) {
15
-                        return item.Value ? "Allowed" : "Disallowed";
4
+
5
+            $scope.luTable = {
6
+                columns: [
7
+                    {
8
+                        name: "Name",
9
+                        width: 6,
10
+                        getValue: function (item) {
11
+                            return item.Name;
12
+                        }
13
+                    }, {
14
+                        name: "Value",
15
+                        width: 5,
16
+                        getValue: function (item) {
17
+                            return item.Value ? "Allowed" : "Disallowed";
18
+                        }
16 19
                     }
17
-                }
18
-            ];
20
+                ],
19 21
 
20
-            $scope.getLoadPagePromise = function(page, perPage, promise)
21
-            {
22
-                return luticateAuthPermissions.getAll({page: page, perPage: perPage}, promise);
23
-            };
22
+                permissions: {
23
+                    add: 'LU_PERM_ADD',
24
+                    del: 'LU_PERM_DEL',
25
+                    edit: 'LU_PERM_EDIT'
26
+                },
24 27
 
25
-            $scope.getDelPromise = function(id, promise)
26
-            {
27
-                return luticateAuthPermissions.del({permission_name: id}, promise);
28
-            };
28
+                getLoadPagePromise: function (page, perPage, promise) {
29
+                    return luticateAuthPermissions.getAll({page: page, perPage: perPage}, promise);
30
+                },
29 31
 
30
-            $scope.getEditController = function()
31
-            {
32
-                return "PermissionEdit";
33
-            };
32
+                getDelPromise: function (id, promise) {
33
+                    return luticateAuthPermissions.del({permission_name: id}, promise);
34
+                },
34 35
 
35
-            $scope.getItemId = function(item)
36
-            {
37
-                return item.Name;
38
-            };
36
+                getEditController: function () {
37
+                    return "PermissionEdit";
38
+                },
39
+
40
+                getItemId: function (item) {
41
+                    return item.Name;
42
+                }
43
+            }
39 44
     }]);

+ 3
- 1
luticate/views/modals/permissionedit.html Ver arquivo

@@ -9,7 +9,9 @@
9 9
         <label class="col-sm-2 control-label">Allowed</label>
10 10
         <div class="col-sm-9">
11 11
             <div class="btn-group">
12
-                <button class="btn btn-default dropdown-toggle btn-select" data-toggle="dropdown" href="">{{ permission.Value ? 'Yes' : 'No' }} <span class="caret"></span></button>
12
+                <button class="btn btn-default dropdown-toggle btn-select" data-toggle="dropdown" href="" lu-enable-permission="{{ neededPermission }}">
13
+                    {{ permission.Value ? 'Yes' : 'No' }} <span class="caret"></span>
14
+                </button>
13 15
                 <ul class="dropdown-menu">
14 16
                     <li><a href="" ng-click="permission.Value = false">No</a></li>
15 17
                     <li><a href="" ng-click="permission.Value = true">Yes</a></li>

+ 1
- 1
luticate/views/permissions.html Ver arquivo

@@ -1,4 +1,4 @@
1 1
 <!-- Page Content -->
2 2
 <div class="container">
3
-    <lu-table class="row col-sm-8 col-sm-offset-2" ></lu-table>
3
+    <lu-table options="luTable" class="row col-sm-8 col-sm-offset-2" ></lu-table>
4 4
 </div>

Carregando…
Cancelar
Salvar