Browse Source

fixes

tags/0.1.0
Robin Thoni 8 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,7 +65,6 @@ angular.module('luticateUtils')
65 65
                     if ($scope.tableOptions.onItemChecked == null) {
66 66
                         $scope.tableOptions.onItemChecked = function(item, checked)
67 67
                         {
68
-                            return true;
69 68
                         }
70 69
                     }
71 70
                     if (!$scope.tableOptions.getItemId) {

+ 0
- 2
src/lubusy.js View File

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

+ 46
- 5
src/luedittable.js View File

@@ -3,8 +3,8 @@
3 3
  */
4 4
 
5 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 8
             return {
9 9
                 restrict: 'E',
10 10
                 scope: {
@@ -44,9 +44,50 @@ angular.module('luticateUtils')
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 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 92
                     $scope.deleteItems = function () {
52 93
                         if ($scope.tableOptions.checkedItems.length == 0) {
@@ -60,7 +101,7 @@ angular.module('luticateUtils')
60 101
                         var item = $scope.tableOptions.checkedItems[0];
61 102
                         $scope.tableOptions.getDelPromise(item, promiseDelItems)
62 103
                             .then(function (data) {
63
-                                $scope.tableOptions.onItemDeleted(item, $scope);
104
+                                $scope.tableOptions.onItemDeleted(item);
64 105
                                 $scope.tableOptions.checkedItems.splice(0, 1);
65 106
                                 $scope.deleteItems();
66 107
                             }, function (error) {
@@ -91,7 +132,7 @@ angular.module('luticateUtils').run(['$templateCache', function($templateCache)
91 132
 '        <lu-basic-table options="tableOptions"></lu-basic-table>' +
92 133
 '<div class="col-sm-12">' +
93 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 136
 '    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete' +
96 137
 '    </button>' +
97 138
 '    <button class="btn btn-default" type="button" ng-click="addItem()" ng-show="tableOptions.canAdd()">' +

Loading…
Cancel
Save