Browse Source

cameras ui

develop
Robin Thoni 8 years ago
parent
commit
414af8de88

+ 3
- 0
admin/controllers/modals/cameraedit.controller.js View File

@@ -50,6 +50,9 @@ angular.module('camotionAdmin')
50 50
 
51 51
             $scope.submitForm = function()
52 52
             {
53
+                if ($scope.camera.Data == null) {
54
+                    $scope.camera.Data = {};
55
+                }
53 56
                 if (luticateAuthCache.hasEffectivePermission($scope.permission)) {
54 57
                     $scope.camera.Data = JSON.stringify($scope.camera.Data);
55 58
                     if ($scope.camera.Id != null) {

+ 3
- 0
admin/controllers/modals/commandedit.controller.js View File

@@ -50,6 +50,9 @@ angular.module('camotionAdmin')
50 50
 
51 51
             $scope.submitForm = function()
52 52
             {
53
+                if ($scope.command.Data == null) {
54
+                    $scope.command.Data = {};
55
+                }
53 56
                 if (luticateAuthCache.hasEffectivePermission($scope.permission)) {
54 57
                     $scope.command.Data = JSON.stringify($scope.command.Data);
55 58
                     if ($scope.command.Id != null) {

+ 3
- 0
admin/controllers/modals/sensoredit.controller.js View File

@@ -50,6 +50,9 @@ angular.module('camotionAdmin')
50 50
 
51 51
             $scope.submitForm = function()
52 52
             {
53
+                if ($scope.sensor.Data == null) {
54
+                    $scope.sensor.Data = {};
55
+                }
53 56
                 if (luticateAuthCache.hasEffectivePermission($scope.permission)) {
54 57
                     $scope.sensor.Data = JSON.stringify($scope.sensor.Data);
55 58
                     if ($scope.sensor.Id != null) {

+ 26
- 2
camotion/controllers/cameras.controller.js View File

@@ -1,6 +1,30 @@
1 1
 angular.module('camotion')
2
-    .controller('CamerasController', ['$scope', '$state',
3
-        function($scope, $state) {
2
+    .controller('CamerasController', ['$scope', 'CamerasService',
3
+        function($scope, CamerasService) {
4 4
 
5
+            $scope.cameras = [];
6
+            $scope.rowCameras = [];
5 7
 
8
+            $scope.playingCameras = [];
9
+
10
+            $scope.playPause = function(camera)
11
+            {
12
+                var idx = $scope.playingCameras.indexOf(camera.Id);
13
+                if (idx > -1) {
14
+                    $scope.playingCameras.splice(idx, 1);
15
+                }
16
+                else {
17
+                    $scope.playingCameras.push(camera.Id);
18
+                }
19
+            };
20
+
21
+            $scope.isPlaying = function(camera)
22
+            {
23
+                return $scope.playingCameras.indexOf(camera.Id) > -1;
24
+            };
25
+
26
+            CamerasService.getAll({}).then(function(cameras)
27
+            {
28
+                $scope.cameras = cameras.Data;
29
+            });
6 30
     }]);

+ 48
- 0
camotion/css/app.less View File

@@ -10,6 +10,23 @@ footer {
10 10
   text-align: center;
11 11
 }
12 12
 
13
+.border-bottom-right-radius(@radius) {
14
+  -webkit-border-bottom-right-radius: @radius;
15
+  -moz-border-radius-bottomright: @radius;
16
+  border-bottom-right-radius: @radius;
17
+}
18
+
19
+.border-bottom-left-radius(@radius) {
20
+  -webkit-border-bottom-left-radius: @radius;
21
+  -moz-border-radius-bottomleft: @radius;
22
+  border-bottom-left-radius: @radius;
23
+}
24
+
25
+.border-bottom-radius(@radius) {
26
+  .border-bottom-right-radius(@radius);
27
+  .border-bottom-left-radius(@radius);
28
+}
29
+
13 30
 .border-radius(@radius) {
14 31
   -webkit-border-radius: @radius;
15 32
   -moz-border-radius: @radius;
@@ -28,3 +45,34 @@ footer {
28 45
 /**
29 46
 ========================================================
30 47
 **/
48
+
49
+@player-bg-color: #2f4154;
50
+@player-text-color: white;
51
+@player-border-radius: 8px;
52
+
53
+.player {
54
+  margin-bottom: 36px;
55
+}
56
+
57
+.player-image {
58
+  width: 100%;
59
+}
60
+
61
+.player-legend {
62
+  background-color: @player-bg-color;
63
+  color: @player-text-color;
64
+  padding-left: @player-border-radius;
65
+  .border-bottom-radius(@player-border-radius);
66
+}
67
+
68
+.player-button-play {
69
+  padding: 5px;
70
+  cursor: pointer;
71
+  .no-text-select();
72
+  &:hover {
73
+    color: #1abc9c;
74
+  }
75
+}
76
+
77
+.player-legend-name {
78
+}

+ 12
- 1
camotion/views/cameras.html View File

@@ -1,4 +1,15 @@
1 1
 <!-- Page Content -->
2 2
 <div class="container">
3
-
3
+    <div ng-repeat="c in cameras" class="col-md-6">
4
+        <figure class="player col-sm-12">
5
+            <img ng-click="playPause(c)" src="https://designmodo.github.io/Flat-UI/docs/assets/img/video/poster.jpg" class="player-image">
6
+            <figcaption class="player-legend" title="{{ c.Description }}">
7
+                <span class="player-button-play" ng-class="{
8
+                    'fui-play': !isPlaying(c),
9
+                    'fui-pause': isPlaying(c)
10
+                }" ng-click="playPause(c)"></span>
11
+                <span class="player-legend-name">{{ c.Name }}</span>
12
+            </figcaption>
13
+        </figure>
14
+    </div>
4 15
 </div>

Loading…
Cancel
Save