add delete button to rc modal view
This commit is contained in:
parent
d9881ecf65
commit
f2d9923504
3 changed files with 26 additions and 8 deletions
19
nodejs/public/javascripts/angularApp.js
vendored
19
nodejs/public/javascripts/angularApp.js
vendored
|
@ -164,12 +164,21 @@ app.controller('MainCtrl', [
|
||||||
$scope.newrc = angular.copy(arduino.emptyrc);
|
$scope.newrc = angular.copy(arduino.emptyrc);
|
||||||
|
|
||||||
$scope.modal = {
|
$scope.modal = {
|
||||||
shown: false
|
shown: false,
|
||||||
|
delete: false
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.toggleModal = function() {
|
$scope.toggleModal = function(RC) {
|
||||||
$scope.modal.shown = !$scope.modal.shown;
|
if(RC) {
|
||||||
|
$scope.newrc = RC;
|
||||||
|
$scope.newrc.tristate = RC.tristate > 0;
|
||||||
|
$scope.modal.delete = true;
|
||||||
|
} else {
|
||||||
|
$scope.modal.delete = false;
|
||||||
$scope.newrc = angular.copy(arduino.emptyrc);
|
$scope.newrc = angular.copy(arduino.emptyrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.modal.shown = !$scope.modal.shown;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.addRC = function(){
|
$scope.addRC = function(){
|
||||||
|
@ -179,9 +188,7 @@ app.controller('MainCtrl', [
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.deleteRC = function(RC) {
|
$scope.deleteRC = function(RC) {
|
||||||
$scope.newrc = RC;
|
|
||||||
$scope.modal.shown = !$scope.modal.shown;
|
|
||||||
console.log($scope.newrc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -74,6 +74,16 @@ nav li img {
|
||||||
color: #33C3F0;
|
color: #33C3F0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button-primary.red {
|
||||||
|
border: #e9165c 1px solid;
|
||||||
|
background-color: #e9165c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-primary.red:hover {
|
||||||
|
border: #c4124d 1px solid;
|
||||||
|
background-color: #c4124d;
|
||||||
|
}
|
||||||
|
|
||||||
/* Modal */
|
/* Modal */
|
||||||
.ng-modal {
|
.ng-modal {
|
||||||
width: 85% !important;
|
width: 85% !important;
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
</div>
|
</div>
|
||||||
<label>Is this a tristate switch? <input ng-model="newrc.tristate" type="checkbox" ></input></label>
|
<label>Is this a tristate switch? <input ng-model="newrc.tristate" type="checkbox" ></input></label>
|
||||||
<button type="submit" class="button-primary">Add</button>
|
<button type="submit" class="button-primary">Add</button>
|
||||||
|
<button type="button" ng-click="deleteRC()" ng-show="modal.delete" class="button-primary red">Delete</button>
|
||||||
<button type="button" ng-click="toggleModal()" class="button">Cancel</button>
|
<button type="button" ng-click="toggleModal()" class="button">Cancel</button>
|
||||||
</form>
|
</form>
|
||||||
</modal>
|
</modal>
|
||||||
|
@ -61,7 +62,7 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="RC in RCs | orderBy:'switch_id'">
|
<tr ng-repeat="RC in RCs | orderBy:'switch_id'">
|
||||||
<td><span ng-click="deleteRC(RC)" class="symbol">☰</span> {{RC.name}} </td>
|
<td><span ng-click="toggleModal(RC)" class="symbol">☰</span> {{RC.name}} </td>
|
||||||
<td style="text-align: right;">
|
<td style="text-align: right;">
|
||||||
<button class="sign" ng-click="sendRC(RC)" ng-class="{'true':'button-primary','false':'button'}[RC.state]" type="submit" >⏻</button>
|
<button class="sign" ng-click="sendRC(RC)" ng-class="{'true':'button-primary','false':'button'}[RC.state]" type="submit" >⏻</button>
|
||||||
</td>
|
</td>
|
||||||
|
|
Reference in a new issue