Skip to content

Commit d3dd908

Browse files
committed
Add status indicators in the footer on the home page
1 parent 41e02cd commit d3dd908

9 files changed

Lines changed: 29 additions & 6 deletions

File tree

src/js/app.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ angular.module( "opengarage", [ "ionic", "opengarage.controllers", "opengarage.u
4040
}, 500 );
4141
} );
4242

43+
// Define connected state of current controller
44+
$rootScope.connected = false;
45+
4346
// Define version, build number and debug state
4447
$rootScope.version = window.appVersion;
4548

@@ -53,7 +56,7 @@ angular.module( "opengarage", [ "ionic", "opengarage.controllers", "opengarage.u
5356
$rootScope.$on( "loading:show", function( e, data ) {
5457

5558
$rootScope.loadingCount++;
56-
$rootScope.canceller = data.canceller.resolve;
59+
$rootScope.canceller = data ? data.canceller.resolve : angular.noop;
5760
$ionicLoading.show( {
5861
template: "<ion-spinner></ion-spinner><br>One moment please<br><button class='button white icon-left ion-ios-close-outline button-clear' ng-click='$root.canceller()'>Cancel</button>"
5962
} );
@@ -99,6 +102,8 @@ angular.module( "opengarage", [ "ionic", "opengarage.controllers", "opengarage.u
99102

100103
// If a user object is cached, proceed to load the app while updating user object in the background
101104
$state.go( "app.home" );
105+
106+
Utils.updateController();
102107
} else {
103108
$state.go( "app.controllerSelect" );
104109
}
@@ -164,6 +169,7 @@ angular.module( "opengarage", [ "ionic", "opengarage.controllers", "opengarage.u
164169

165170
if ( !$rootScope.activeController && total === 1 ) {
166171
$rootScope.activeController = $rootScope.controllers[ 0 ];
172+
Utils.updateController();
167173
Utils.storage.set( { activeController: JSON.stringify( $rootScope.activeController ) } );
168174
return;
169175
}

src/js/controllers.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ angular.module( "opengarage.controllers", [ "opengarage.utils" ] )
99

1010
$scope.setController = function( index ) {
1111
$rootScope.activeController = $rootScope.controllers[ index ];
12+
$rootScope.connected = false;
13+
Utils.updateController();
1214
Utils.storage.set( { activeController: JSON.stringify( $rootScope.activeController ) } );
1315

1416
$ionicHistory.nextViewOptions( {

src/js/utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ angular.module( "opengarage.utils", [] )
144144
$rootScope.controllers.splice( index, 0, controller );
145145
$rootScope.activeController = controller;
146146

147+
$rootScope.connected = true;
148+
147149
$rootScope.$broadcast( "controllerUpdated" );
148150

149151
storage.set( { "controllers": JSON.stringify( $rootScope.controllers ), "activeController": JSON.stringify( $rootScope.activeController ) } );

src/scss/ionic.app.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ textarea {
8484
display: block
8585
}
8686

87+
.round-button {
88+
border-radius: 100px;
89+
height: 31px;
90+
width: 31px;
91+
}
92+
8793
.history {
8894
table {
8995
font-size:12px;

www/cache.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ index.html
2929
NETWORK:
3030
*
3131

32-
# hash: bfb07b911187da1769e582a6d854f3b05ec17f57a3bef76fe4d7a1b40596f646
32+
# hash: 3b7a82b4ad90826531faad542d50a9428f1d27f2c3190b1e515e580da19c8772

www/css/ionic.app.min.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,6 +2026,7 @@ to{transform:scale(1);opacity:1}
20262026
.ui-disabled{opacity:.3;zoom:1;cursor:default!important;pointer-events:none}
20272027
.white{color:#fff!important}
20282028
.door-button{background-color:#444;color:#fff;border-radius:100px;font-size:3em;font-weight:100;height:200px;line-height:200px;margin:auto;position:relative;text-align:center;width:200px;display:block}
2029+
.round-button{border-radius:100px;height:31px;width:31px}
20292030
.history table{font-size:12px;background:#eaebec;border:1px solid #ccc;border-radius:3px;box-shadow:0 1px 2px #d1d1d1;width:80%;margin:0 auto}
20302031
.history table th{padding:21px 25px 22px;border-top:1px solid #fafafa;border-bottom:1px solid #e0e0e0;background:#ededed;background:linear-gradient(#ededed,#ebebeb)}
20312032
.history table th:first-child{text-align:left;padding-left:20px}

www/js/app.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

www/js/app.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

www/templates/home.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<ion-view view-title="{{$root.activeController.name}}">
2-
<ion-content has-bouncing="false" class="vertical-center">
3-
<button class="door-button" ng-click="toggleDoor()"">{{ $root.activeController.door ? "Close" : "Open" }}</button>
2+
<ion-content has-bouncing="false" class="vertical-center has-footer">
3+
<button class="door-button" ng-click="toggleDoor()">{{ $root.activeController.door ? "Close" : "Open" }}</button>
44
</ion-content>
5+
<ion-footer-bar class="bar bar-footer center">
6+
<button class="button round-button" ng-class="{'button-assertive': !$root.connected, 'button-balanced': $root.connected}"></button>
7+
<h5 class="padding-left padding-right">{{ $root.connected ? "connected" : "disconnected" }}</h5>
8+
<button class="button round-button" ng-class="{'button-assertive': !$root.activeController.door, 'button-balanced': $root.activeController.door}"></button>
9+
<h5 class="padding-left">{{ $root.activeController.door ? "opened" : "closed" }}</h5>
10+
</ion-footer-bar>
511
</ion-view>

0 commit comments

Comments
 (0)