Browse Source

ui fixes

tags/0.1.0
Robin Thoni 8 years ago
parent
commit
12f571c0bb
6 changed files with 54 additions and 30 deletions
  1. 7
    0
      src/lubasictable.css
  2. 5
    8
      src/lubasictable.js
  3. 21
    21
      src/luedittable.js
  4. 1
    1
      src/lupermissionsedit.js
  5. 6
    0
      src/lupickertable.css
  6. 14
    0
      src/lupickertable.js

+ 7
- 0
src/lubasictable.css View File

@@ -0,0 +1,7 @@
1
+.lu-basic-table-pagination-current {
2
+    font-weight: bold;
3
+}
4
+
5
+.lu-basic-table-pagination-not-current {
6
+
7
+}

+ 5
- 8
src/lubasictable.js View File

@@ -22,16 +22,12 @@ angular.module('luticateUtils')
22 22
                     }
23 23
                     if (typeof $scope.tableOptions.luBusy == 'string') {
24 24
                         $scope.tableOptions.luBusy = {
25
-                            group: $scope.tableOptions.luBusy,
26
-                            templateLoader: "luticate-loader.html",
27
-                            templateError: "luticate-error.html"
25
+                            group: $scope.tableOptions.luBusy
28 26
                         };
29 27
                     }
30 28
                     if ($scope.tableOptions.luBusy == null) {
31 29
                         $scope.tableOptions.luBusy = {
32
-                            group:  'luBasicTableItemList_' + $scope.$id,
33
-                            templateLoader: "luticate-loader.html",
34
-                            templateError: "luticate-error.html"
30
+                            group:  'luBasicTableItemList_' + $scope.$id
35 31
                         };
36 32
                     }
37 33
                     if ($scope.tableOptions.page == null) {
@@ -82,7 +78,7 @@ angular.module('luticateUtils')
82 78
                     $scope.loadPage = function (page) {
83 79
                         $scope.tableOptions.checkedItems = [];
84 80
                         var promiseLoadItems = {
85
-                            id: "promiseLoadItems",
81
+                            id: "promiseLoadItems_" + $scope.$id,
86 82
                             groups: [$scope.tableOptions.luBusy.group]
87 83
                         };
88 84
                         $scope.tableOptions.getLoadPagePromise(page, $scope.tableOptions.perPage, promiseLoadItems)
@@ -187,7 +183,8 @@ angular.module('luticateUtils').run(['$templateCache', function($templateCache)
187 183
 '</table>' +
188 184
 
189 185
 '<div class="col-sm-12 text-center">' +
190
-'    <a class="{{ p == tableOptions.page ? \'pagination-current\' : \'pagination-not-current\'}}" href="" ng-repeat="p in pages" ng-click="loadPage(p)">{{ p + 1 }}&nbsp;</a>' +
186
+'    <a class="{{ p == tableOptions.page ? \'lu-basic-table-pagination-current\' : \'lu-basic-table-pagination-not-current\'}}"' +
187
+        'href="" ng-repeat="p in pages" ng-click="loadPage(p)">{{ p + 1 }}&nbsp;</a>' +
191 188
 '</div>' +
192 189
 '    </div>');
193 190
 }]);

+ 21
- 21
src/luedittable.js View File

@@ -31,18 +31,27 @@ angular.module('luticateUtils')
31 31
                         {
32 32
                         }
33 33
                     }
34
-                    var onItemClicked = $scope.tableOptions.onItemClicked;
35
-                    $scope.tableOptions.onItemClicked = function (item) {
36
-                        if (onItemClicked != null) {
37
-                            onItemClicked(item);
34
+                    if ($scope.tableOptions.onItemClicked == null) {
35
+                        $scope.tableOptions.onItemClicked = function (item) {
36
+                            var ctrl = $scope.tableOptions.getEditController();
37
+                            dialogs.create('views/modals/' + ctrl.toLowerCase() + '.html', ctrl + 'Controller', item)
38
+                                .result.then(function (data) {
39
+                                    $scope.tableOptions.luBasicTableScope.loadPage($scope.tableOptions.page);
40
+                                    $scope.tableOptions.onItemEdited(data);
41
+                                });
42
+                        };
43
+                    }
44
+                    if ($scope.tableOptions.addItem == null) {
45
+                        $scope.tableOptions.addItem = function()
46
+                        {
47
+                            var ctrl = $scope.tableOptions.getEditController();
48
+                            dialogs.create('views/modals/' + ctrl.toLowerCase() + '.html', ctrl + 'Controller', $scope.tableOptions.editData)
49
+                                .result.then(function (data) {
50
+                                    $scope.tableOptions.luBasicTableScope.loadPage($scope.tableOptions.page);
51
+                                    $scope.tableOptions.onItemAdded(data);
52
+                                });
38 53
                         }
39
-                        var ctrl = $scope.tableOptions.getEditController();
40
-                        dialogs.create('views/modals/' + ctrl.toLowerCase() + '.html', ctrl + 'Controller', item)
41
-                            .result.then(function (data) {
42
-                                $scope.tableOptions.luBasicTableScope.loadPage($scope.tableOptions.page);
43
-                                $scope.tableOptions.onItemEdited(data);
44
-                            });
45
-                    };
54
+                    }
46 55
 
47 56
 
48 57
                     if ($scope.tableOptions.canDel == null) {
@@ -113,15 +122,6 @@ angular.module('luticateUtils')
113 122
                                     });
114 123
                             });
115 124
                     };
116
-
117
-                    $scope.addItem = function () {
118
-                        var ctrl = $scope.tableOptions.getEditController();
119
-                        dialogs.create('views/modals/' + ctrl.toLowerCase() + '.html', ctrl + 'Controller', null)
120
-                            .result.then(function (data) {
121
-                                $scope.tableOptions.luBasicTableScope.loadPage($scope.tableOptions.page);
122
-                                $scope.tableOptions.onItemAdded(data);
123
-                            });
124
-                    };
125 125
                 }
126 126
             };
127 127
         }
@@ -136,7 +136,7 @@ angular.module('luticateUtils').run(['$templateCache', function($templateCache)
136 136
 'ng-disabled="tableOptions.checkedItems.length == 0" ng-show="tableOptions.canDel()">' +
137 137
 '    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete' +
138 138
 '    </button>' +
139
-'    <button class="btn btn-default" type="button" ng-click="addItem()" ng-show="tableOptions.canAdd()">' +
139
+'    <button class="btn btn-default" type="button" ng-click="tableOptions.addItem()" ng-show="tableOptions.canAdd()">' +
140 140
 '    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add' +
141 141
 '    </button>' +
142 142
 '    </div>');

+ 1
- 1
src/lupermissionsedit.js View File

@@ -93,7 +93,7 @@ angular.module('luticateUtils')
93 93
 
94 94
                         var promiseLoadAllPermissions = {
95 95
                             id: "promiseLoadAllPermissions",
96
-                            groups: ['permission_add']
96
+                            groups: ['permissionList']
97 97
                         };
98 98
                         luticateAuthPermissions.getAll(null, promiseLoadAllPermissions)
99 99
                             .then(function (permissions) {

+ 6
- 0
src/lupickertable.css View File

@@ -0,0 +1,6 @@
1
+.lu-picker-table-picked-items {
2
+    background-color: rgba(47, 47, 47, 0.2);
3
+    border: solid rgb(47, 47, 47) 1px;
4
+    margin: 2px 2px 2px 2px;
5
+    cursor: pointer;
6
+}

+ 14
- 0
src/lupickertable.js View File

@@ -76,6 +76,20 @@ angular.module('luticateUtils')
76 76
                     {
77 77
                         return true;
78 78
                     };
79
+
80
+                    $scope.unPickItem = function(item)
81
+                    {
82
+                        var id = $scope.pickerOptions.getItemId(item);
83
+                        if ($scope.pickerOptions.checkedItems.find(function(it)
84
+                            {
85
+                                return it == id;
86
+                            }) != null) {
87
+                            $scope.pickerOptions.luBasicTableScope.toggleCheckedId(id, item);
88
+                        }
89
+                        else {
90
+                            $scope.pickerOptions.onItemChecked(item, false);
91
+                        }
92
+                    }
79 93
                 }
80 94
             };
81 95
         }

Loading…
Cancel
Save