浏览代码

begin lu edit/basic table changes

develop
Robin Thoni 9 年前
父节点
当前提交
93b067a825

+ 6
- 0
luticate/app.js 查看文件

@@ -46,6 +46,12 @@ luticate.config(['$stateProvider', '$urlRouterProvider', '$httpProvider',
46 46
             controller:'PermissionsController'
47 47
         });
48 48
 
49
+        $stateProvider.state('test',{
50
+            url:'/test',
51
+            templateUrl:'views/test.html',
52
+            controller:'TestController'
53
+        });
54
+
49 55
         $urlRouterProvider.otherwise('/');
50 56
 
51 57
         $httpProvider.interceptors.push(['luticateAuthCache', '$injector', '$q',

+ 10
- 2
luticate/controllers/modals/groupusers.controller.js 查看文件

@@ -8,7 +8,7 @@ angular.module('luticate')
8 8
 
9 9
             $scope.group = data;
10 10
 
11
-            $scope.luTable = {
11
+            $scope.itemPicker = {
12 12
                 columns: [
13 13
                     {
14 14
                         name: "Username",
@@ -58,7 +58,15 @@ angular.module('luticate')
58 58
                 },
59 59
 
60 60
                 getEditController: function () {
61
-                    return null;
61
+                    return "UserPicker";
62
+                },
63
+
64
+                onEdited: function(item) {
65
+
66
+                },
67
+
68
+                onItemSelectionChanged: function(item, selected) {
69
+
62 70
                 },
63 71
 
64 72
                 displayItem: function(item, scope)

+ 56
- 0
luticate/controllers/modals/userpicker.controller.js 查看文件

@@ -0,0 +1,56 @@
1
+/**
2
+ * Created by robin on 11/6/15.
3
+ */
4
+
5
+angular.module('luticate')
6
+    .controller('UserPickerController', ['$scope', 'luticateAuthUsers', 'data', '$q', 'dialogs', 'luticateAuthCache',
7
+        function($scope, luticateAuthUsers, data, $q, dialogs, luticateAuthCache) {
8
+            $scope.selectedUsers = [];
9
+            $scope.userPicker = {
10
+                columns: [
11
+                    {
12
+                        name: "Username",
13
+                        width: 3,
14
+                        getValue: function (item) {
15
+                            return item.Username;
16
+                        }
17
+                    }, {
18
+                        name: "Email",
19
+                        width: 3,
20
+                        getValue: function (item) {
21
+                            return item.Email;
22
+                        }
23
+                    }, {
24
+                        name: "Firstname",
25
+                        width: 3,
26
+                        getValue: function (item) {
27
+                            return item.Firstname;
28
+                        }
29
+                    }, {
30
+                        name: "Lastname",
31
+                        width: 3,
32
+                        getValue: function (item) {
33
+                            return item.Lastname;
34
+                        }
35
+                    }
36
+                ],
37
+
38
+                permissions: {
39
+                    add: 'LU_USER_ADD',
40
+                    del: 'LU_USER_DEL',
41
+                    edit: 'LU_USER_EDIT'
42
+                },
43
+
44
+                getLoadPagePromise: function (page, perPage, promise) {
45
+                    return luticateAuthUsers.getAll({page: page, perPage: perPage}, promise);
46
+                },
47
+
48
+                getDelPromise: function (id, promise) {
49
+                    return luticateAuthUsers.del({user_id: id}, promise);
50
+                },
51
+
52
+                getEditController: function () {
53
+                    return "UserEdit";
54
+                }
55
+            };
56
+        }]);

+ 153
- 0
luticate/controllers/test.controller.js 查看文件

@@ -0,0 +1,153 @@
1
+angular.module('luticate')
2
+    .controller('TestController', ['$scope', 'luticateAuthUsers',
3
+        function($scope, luticateAuthUsers) {
4
+
5
+            $scope.luBasicTable = {
6
+                columns: [
7
+                    {
8
+                        name: "Username",
9
+                        width: 3,
10
+                        getValue: function (item) {
11
+                            return item.Username;
12
+                        }
13
+                    }, {
14
+                        name: "Email",
15
+                        width: 3,
16
+                        getValue: function (item) {
17
+                            return item.Email;
18
+                        }
19
+                    }, {
20
+                        name: "Firstname",
21
+                        width: 3,
22
+                        getValue: function (item) {
23
+                            return item.Firstname;
24
+                        }
25
+                    }, {
26
+                        name: "Lastname",
27
+                        width: 3,
28
+                        getValue: function (item) {
29
+                            return item.Lastname;
30
+                        }
31
+                    }
32
+                ],
33
+
34
+                canCheck: function()
35
+                {
36
+                    return true;
37
+                },
38
+
39
+                canClick: function()
40
+                {
41
+                    return false;
42
+                },
43
+
44
+                onItemClicked: function(item, scope)
45
+                {
46
+                    console.log(item);
47
+                    scope.toggleCheckedItem(item);
48
+                    return false;
49
+                },
50
+
51
+                onItemChecked: function(item, checked, scope)
52
+                {
53
+                    console.log(item, checked);
54
+                    return false;
55
+                },
56
+
57
+                getLoadPagePromise: function (page, perPage, promise) {
58
+                    return luticateAuthUsers.getAll({page: page, perPage: perPage}, promise);
59
+                },
60
+
61
+                luBusy: "luBasicTable"
62
+            };
63
+
64
+
65
+            $scope.luEditTable = {
66
+                columns: [
67
+                    {
68
+                        name: "Username",
69
+                        width: 3,
70
+                        getValue: function (item) {
71
+                            return item.Username;
72
+                        }
73
+                    }, {
74
+                        name: "Email",
75
+                        width: 3,
76
+                        getValue: function (item) {
77
+                            return item.Email;
78
+                        }
79
+                    }, {
80
+                        name: "Firstname",
81
+                        width: 3,
82
+                        getValue: function (item) {
83
+                            return item.Firstname;
84
+                        }
85
+                    }, {
86
+                        name: "Lastname",
87
+                        width: 3,
88
+                        getValue: function (item) {
89
+                            return item.Lastname;
90
+                        }
91
+                    }
92
+                ],
93
+
94
+                onItemClicked: function(item, scope)
95
+                {
96
+                    console.log("edit clicked", item);
97
+                    return false;
98
+                },
99
+
100
+                onItemChecked: function(item, checked, scope)
101
+                {
102
+                    console.log("edit checked", item, checked);
103
+                    return false;
104
+                },
105
+
106
+                getLoadPagePromise: function (page, perPage, promise) {
107
+                    return luticateAuthUsers.getAll({page: page, perPage: perPage}, promise);
108
+                },
109
+
110
+                luBusy: "luEditTable",
111
+
112
+
113
+
114
+                getDelPromise: function (id, promise) {
115
+                    console.log(promise);
116
+                    return luticateAuthUsers.del({user_id: id}, promise);
117
+                },
118
+
119
+                getEditController: function () {
120
+                    return "UserEdit";
121
+                },
122
+
123
+                onItemDeleted: function(item, scope)
124
+                {
125
+                    console.log("edit removed", item);
126
+                },
127
+
128
+                onItemEdited: function(item, scope)
129
+                {
130
+                    console.log("edit edited", item);
131
+                },
132
+
133
+                onItemAdded: function(item, scope)
134
+                {
135
+                    console.log("edit added", item);
136
+                },
137
+
138
+                canDelete: function()
139
+                {
140
+                    return true;
141
+                },
142
+
143
+                canEdit: function()
144
+                {
145
+                    return true;
146
+                },
147
+
148
+                canAdd: function()
149
+                {
150
+                    return true;
151
+                }
152
+            };
153
+    }]);

+ 5
- 1
luticate/index.html 查看文件

@@ -27,7 +27,9 @@
27 27
     <script src="../bower_components/luticate-utils/src/promises.js"></script>
28 28
     <script src="../bower_components/luticate-utils/src/request.js"></script>
29 29
     <script src="../bower_components/luticate-utils/src/lubusy.js"></script>
30
-    <script src="../bower_components/luticate-utils/src/lutable.js"></script>
30
+    <script src="../bower_components/luticate-utils/src/lubasictable.js"></script>
31
+    <script src="../bower_components/luticate-utils/src/luedittable.js"></script>
32
+    <script src="../bower_components/luticate-utils/src/luitempicker.js"></script>
31 33
     <script src="../bower_components/luticate-utils/src/lupermissionsedit.js"></script>
32 34
     <script src="../bower_components/luticate-utils/src/luhaspermission.js"></script>
33 35
     <script src="../bower_components/luticate-utils/src/modals/dialogerror.js"></script>
@@ -52,6 +54,7 @@
52 54
     <script src="controllers/users.controller.js"></script>
53 55
     <script src="controllers/groups.controller.js"></script>
54 56
     <script src="controllers/permissions.controller.js"></script>
57
+    <script src="controllers/test.controller.js"></script>
55 58
 
56 59
     <!-- Modal Controller -->
57 60
     <script src="controllers/modals/useredit.controller.js"></script>
@@ -59,6 +62,7 @@
59 62
     <script src="controllers/modals/permissionedit.controller.js"></script>
60 63
     <script src="controllers/modals/userpermissions.controller.js"></script>
61 64
     <script src="controllers/modals/usereffectivepermissions.controller.js"></script>
65
+    <script src="controllers/modals/userpicker.controller.js"></script>
62 66
     <script src="controllers/modals/grouppermissions.controller.js"></script>
63 67
     <script src="controllers/modals/groupusers.controller.js"></script>
64 68
 

+ 1
- 0
luticate/views/itempicker.html 查看文件

@@ -0,0 +1 @@
1
+<lu-basic-table options="pickerOptions"></lu-basic-table>

+ 1
- 1
luticate/views/modals/groupusers.html 查看文件

@@ -1,4 +1,4 @@
1 1
 <!-- Page Content -->
2 2
 <dialog-close title="Edit {{ group.Name }} users">
3
-    <lu-table options="luTable" class="row col-sm-8 col-sm-offset-2" ></lu-table>
3
+    <lu-table options="itemPicker" class="row col-sm-8 col-sm-offset-2" ></lu-table>
4 4
 </dialog-close>

+ 3
- 0
luticate/views/modals/userpicker.html 查看文件

@@ -0,0 +1,3 @@
1
+<dialog-close title="Select users">
2
+    <lu-item-picker options="userPicker" lu-model="selectedUsers"></lu-item-picker>
3
+</dialog-close>

+ 1
- 0
luticate/views/navbar.html 查看文件

@@ -18,6 +18,7 @@
18 18
                 <li><a href="#/users" lu-show-permission="LU_USER_GET">Users</a></li>
19 19
                 <li><a href="#/groups" lu-show-permission="LU_GROUP_GET">Groups</a></li>
20 20
                 <li><a href="#/permissions" lu-show-permission="LU_PERM_GET">Permissions</a></li>
21
+                <li><a href="#/test" >Test</a></li>
21 22
             </ul>
22 23
             <ul class="nav navbar-nav navbar-right">
23 24
                 <li><a href="" ng-click="logout()">Logout</a></li>

+ 4
- 0
luticate/views/test.html 查看文件

@@ -0,0 +1,4 @@
1
+<div class="container">
2
+    <!--<lu-basic-table options="luBasicTable" class="row col-sm-8 col-sm-offset-2" ></lu-basic-table>-->
3
+    <lu-edit-table options="luEditTable" class="row col-sm-8 col-sm-offset-2" ></lu-edit-table>
4
+</div>

正在加载...
取消
保存