Browse Source

fixes

tags/0.1.0
Robin Thoni 9 years ago
parent
commit
f639ec4881
3 changed files with 46 additions and 8 deletions
  1. 0
    1
      src/lubasictable.js
  2. 0
    2
      src/lubusy.js
  3. 46
    5
      src/luedittable.js

+ 0
- 1
src/lubasictable.js View File

65
                     if ($scope.tableOptions.onItemChecked == null) {
65
                     if ($scope.tableOptions.onItemChecked == null) {
66
                         $scope.tableOptions.onItemChecked = function(item, checked)
66
                         $scope.tableOptions.onItemChecked = function(item, checked)
67
                         {
67
                         {
68
-                            return true;
69
                         }
68
                         }
70
                     }
69
                     }
71
                     if (!$scope.tableOptions.getItemId) {
70
                     if (!$scope.tableOptions.getItemId) {

+ 0
- 2
src/lubusy.js View File

17
                     element.css('position','relative');
17
                     element.css('position','relative');
18
                 }*/
18
                 }*/
19
 
19
 
20
-                console.log(element.css('z-index'));
21
-
22
                 $scope.isLoading = false;
20
                 $scope.isLoading = false;
23
                 $scope.hasError = false;
21
                 $scope.hasError = false;
24
 
22
 

+ 46
- 5
src/luedittable.js View File

3
  */
3
  */
4
 
4
 
5
 angular.module('luticateUtils')
5
 angular.module('luticateUtils')
6
-    .directive('luEditTable', ['dialogs', 'luticateDialogErrorHelper',
7
-        function(dialogs, luticateDialogErrorHelper) {
6
+    .directive('luEditTable', ['dialogs', 'luticateDialogErrorHelper', 'luticateAuthCache',
7
+        function(dialogs, luticateDialogErrorHelper, luticateAuthCache) {
8
             return {
8
             return {
9
                 restrict: 'E',
9
                 restrict: 'E',
10
                 scope: {
10
                 scope: {
44
                     };
44
                     };
45
 
45
 
46
 
46
 
47
-                    $scope.tableOptions.canCheck = $scope.tableOptions.canDelete;
47
+                    if ($scope.tableOptions.canDel == null) {
48
+                        $scope.tableOptions.canDel = function()
49
+                        {
50
+                            return false;
51
+                        }
52
+                    }
53
+                    if (typeof $scope.tableOptions.canDel == 'string') {
54
+                        var permDel = $scope.tableOptions.canDel;
55
+                        $scope.tableOptions.canDel = function()
56
+                        {
57
+                            return luticateAuthCache.hasEffectivePermission(permDel);
58
+                        }
59
+                    }
60
+                    $scope.tableOptions.canCheck = $scope.tableOptions.canDel;
61
+
62
+                    if ($scope.tableOptions.canEdit == null) {
63
+                        $scope.tableOptions.canEdit = function()
64
+                        {
65
+                            return false;
66
+                        }
67
+                    }
68
+                    if (typeof $scope.tableOptions.canEdit == 'string') {
69
+                        var permEdit = $scope.tableOptions.canEdit;
70
+                        $scope.tableOptions.canEdit = function()
71
+                        {
72
+                            return luticateAuthCache.hasEffectivePermission(permEdit);
73
+                        }
74
+                    }
48
                     $scope.tableOptions.canClick = $scope.tableOptions.canEdit;
75
                     $scope.tableOptions.canClick = $scope.tableOptions.canEdit;
49
 
76
 
77
+                    if ($scope.tableOptions.canAdd == null) {
78
+                        $scope.tableOptions.canAdd = function()
79
+                        {
80
+                            return false;
81
+                        }
82
+                    }
83
+                    if (typeof $scope.tableOptions.canAdd == 'string') {
84
+                        var permAdd = $scope.tableOptions.canAdd;
85
+                        $scope.tableOptions.canAdd = function()
86
+                        {
87
+                            return luticateAuthCache.hasEffectivePermission(permAdd);
88
+                        }
89
+                    }
90
+
50
 
91
 
51
                     $scope.deleteItems = function () {
92
                     $scope.deleteItems = function () {
52
                         if ($scope.tableOptions.checkedItems.length == 0) {
93
                         if ($scope.tableOptions.checkedItems.length == 0) {
60
                         var item = $scope.tableOptions.checkedItems[0];
101
                         var item = $scope.tableOptions.checkedItems[0];
61
                         $scope.tableOptions.getDelPromise(item, promiseDelItems)
102
                         $scope.tableOptions.getDelPromise(item, promiseDelItems)
62
                             .then(function (data) {
103
                             .then(function (data) {
63
-                                $scope.tableOptions.onItemDeleted(item, $scope);
104
+                                $scope.tableOptions.onItemDeleted(item);
64
                                 $scope.tableOptions.checkedItems.splice(0, 1);
105
                                 $scope.tableOptions.checkedItems.splice(0, 1);
65
                                 $scope.deleteItems();
106
                                 $scope.deleteItems();
66
                             }, function (error) {
107
                             }, function (error) {
91
 '        <lu-basic-table options="tableOptions"></lu-basic-table>' +
132
 '        <lu-basic-table options="tableOptions"></lu-basic-table>' +
92
 '<div class="col-sm-12">' +
133
 '<div class="col-sm-12">' +
93
 '    <button class="btn btn-default" type="button" ng-click="deleteItems()"' +
134
 '    <button class="btn btn-default" type="button" ng-click="deleteItems()"' +
94
-'ng-disabled="tableOptions.checkedItems.length == 0" ng-show="tableOptions.canDelete()">' +
135
+'ng-disabled="tableOptions.checkedItems.length == 0" ng-show="tableOptions.canDel()">' +
95
 '    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete' +
136
 '    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete' +
96
 '    </button>' +
137
 '    </button>' +
97
 '    <button class="btn btn-default" type="button" ng-click="addItem()" ng-show="tableOptions.canAdd()">' +
138
 '    <button class="btn btn-default" type="button" ng-click="addItem()" ng-show="tableOptions.canAdd()">' +

Loading…
Cancel
Save