Przeglądaj źródła

group edit/add

develop
Robin Thoni 9 lat temu
rodzic
commit
a1646960fd

+ 31
- 0
luticate/controllers/modals/groupedit.controller.js Wyświetl plik

@@ -0,0 +1,31 @@
1
+/**
2
+ * Created by robin on 11/4/15.
3
+ */
4
+
5
+angular.module('luticate')
6
+    .controller('GroupEditController', ['$scope', 'luticateAuthGroups', 'data',
7
+        function($scope, luticateAuthGroups, data) {
8
+            if (data != null) {
9
+                $scope.group = data;
10
+            }
11
+            else {
12
+                $scope.group = {
13
+                    Name: ""
14
+                }
15
+            }
16
+
17
+            $scope.submitForm = function()
18
+            {
19
+                if ($scope.group.Id != null) {
20
+                    return luticateAuthGroups.edit({
21
+                        group_id: $scope.group.Id,
22
+                        group_name: $scope.group.Name
23
+                    });
24
+                }
25
+                else {
26
+                    return luticateAuthGroups.add({
27
+                        group_name: $scope.group.Name
28
+                    });
29
+                }
30
+            }
31
+        }]);

+ 1
- 0
luticate/index.html Wyświetl plik

@@ -49,6 +49,7 @@
49 49
 
50 50
     <!-- Modal Controller -->
51 51
     <script src="controllers/modals/useredit.controller.js"></script>
52
+    <script src="controllers/modals/groupedit.controller.js"></script>
52 53
 
53 54
     <!-- SDK -->
54 55
     <script src="../sdk/cache.js"></script>

+ 8
- 0
luticate/views/modals/groupedit.html Wyświetl plik

@@ -0,0 +1,8 @@
1
+<dialog-ok-cancel title="{{ group.Id == null ? 'Add' : 'Edit'}} group {{ group.Name }}">
2
+    <div class="form-group">
3
+        <label for="name" class="col-sm-2 control-label">Name</label>
4
+        <div class="col-sm-9">
5
+            <input id="name" class="form-control" ng-model="group.Name" required/>
6
+        </div>
7
+    </div>
8
+</dialog-ok-cancel>

Ładowanie…
Anuluj
Zapisz