This repository was archived by the owner on Jun 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +49
-17
lines changed Expand file tree Collapse file tree 6 files changed +49
-17
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ angular.module('dashkiosk.controllers')
3
3
'use strict' ;
4
4
5
5
} )
6
- . controller ( 'EditDisplayCtrl' , function ( $scope ) {
6
+ . controller ( 'EditDisplayCtrl' , function ( $scope , $q ) {
7
7
'use strict' ;
8
8
9
9
var realDisplay = $scope . $parent . display ,
@@ -18,17 +18,33 @@ angular.module('dashkiosk.controllers')
18
18
}
19
19
return false ;
20
20
} ) ;
21
- realDisplay
22
- . $update ( modified )
23
- . then ( function ( ) {
24
- $scope . $hide ( ) ;
21
+
22
+ var deferred = $q . defer ( ) ,
23
+ promise = deferred . promise ;
24
+ if ( ! _ . isEmpty ( _ . omit ( modified , 'group' ) ) ) {
25
+ promise . then ( function ( ) {
26
+ return realDisplay . $update ( _ . omit ( modified , 'group' ) ) ;
27
+ } ) ;
28
+ }
29
+ if ( _ . has ( modified , 'group' ) ) {
30
+ promise . then ( function ( ) {
31
+ return $scope . groups [ modified . group ] . $attach ( realDisplay . name ) ;
25
32
} ) ;
33
+ }
34
+ promise . then ( function ( ) {
35
+ $scope . $hide ( ) ;
36
+ } ) ;
37
+ deferred . resolve ( true ) ;
38
+ return promise ;
26
39
} ;
27
40
28
41
// Destroy the display
29
42
$scope . delete = function ( ) {
30
- realDisplay . $delete ( ) ;
31
- $scope . $hide ( ) ;
43
+ realDisplay
44
+ . $delete ( )
45
+ . then ( function ( ) {
46
+ $scope . $hide ( ) ;
47
+ } ) ;
32
48
} ;
33
49
34
50
} ) ;
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ angular.module('dashkiosk.directives')
6
6
restrict : 'E' ,
7
7
replace : true ,
8
8
scope : {
9
- display : '='
9
+ display : '=' ,
10
+ groups : '='
10
11
} ,
11
12
templateUrl : 'display.html' ,
12
13
controller : 'DisplayCtrl'
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ angular.module('dashkiosk.directives')
6
6
restrict : 'E' ,
7
7
replace : true ,
8
8
scope : {
9
- group : '='
9
+ group : '=' ,
10
+ groups : '='
10
11
} ,
11
12
templateUrl : 'group.html' ,
12
13
controller : 'GroupCtrl'
Original file line number Diff line number Diff line change @@ -23,12 +23,26 @@ <h4 class="modal-title" ng-bind="display.name"></h4>
23
23
placeholder ="Description " name ="description "
24
24
ng-model ="display.description ">
25
25
</ div >
26
- < div class ="input-group " ng-class ="{'has-error': displayForm.viewport.$invalid} ">
27
- < span class ="input-group-addon "> < span title ="Viewport " class ="glyphicon glyphicon-fullscreen "> </ span > </ span >
28
- < input type ="text " class ="form-control " viewport
29
- autocapitalize ="off " autocorrect ="off "
30
- placeholder ="Viewport size (height × width) " name ="viewport "
31
- ng-model ="display.viewport ">
26
+ < div class ="row ">
27
+ < div class ="col-md-6 ">
28
+ < div class ="input-group " ng-class ="{'has-error': displayForm.viewport.$invalid} ">
29
+ < span class ="input-group-addon "> < span title ="Viewport " class ="glyphicon glyphicon-tag "> </ span > </ span >
30
+ < select class ="form-control "
31
+ name ="group " required
32
+ ng-options ="g.id as g.name for (k, g) in groups "
33
+ ng-model ="display.group ">
34
+ </ select >
35
+ </ div >
36
+ </ div >
37
+ < div class ="col-md-6 ">
38
+ < div class ="input-group " ng-class ="{'has-error': displayForm.viewport.$invalid} ">
39
+ < span class ="input-group-addon "> < span title ="Viewport " class ="glyphicon glyphicon-fullscreen "> </ span > </ span >
40
+ < input type ="text " class ="form-control " viewport
41
+ autocapitalize ="off " autocorrect ="off "
42
+ placeholder ="Viewport size (height × width) " name ="viewport "
43
+ ng-model ="display.viewport ">
44
+ </ div >
45
+ </ div >
32
46
</ div >
33
47
</ div >
34
48
< div class ="modal-footer ">
Original file line number Diff line number Diff line change 22
22
< div class ="displays ">
23
23
< dk-display
24
24
ng-repeat ="display in group.displays | orderBy:['-connected','name'] "
25
- display ="display ">
25
+ display ="display " groups =" groups " >
26
26
</ dk-display >
27
27
</ div >
28
28
</ div >
Original file line number Diff line number Diff line change 1
1
< ul data-ui-element ="dk-group-list ">
2
2
< li ng-repeat ="group in groups " class ="col-md-6 ">
3
- < dk-group group ="group ">
3
+ < dk-group group ="group " groups =" groups " >
4
4
</ dk-group >
5
5
</ li >
6
6
< li class ="col-md-2 ">
You can’t perform that action at this time.
0 commit comments