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
21
nodejs/public/javascripts/angularApp.js
vendored
21
nodejs/public/javascripts/angularApp.js
vendored
|
@ -163,13 +163,22 @@ app.controller('MainCtrl', [
|
|||
$scope.irTest = arduino.irTest;
|
||||
$scope.newrc = angular.copy(arduino.emptyrc);
|
||||
|
||||
$scope.modal={
|
||||
shown: false
|
||||
$scope.modal = {
|
||||
shown: false,
|
||||
delete: false
|
||||
};
|
||||
|
||||
$scope.toggleModal = function() {
|
||||
$scope.toggleModal = function(RC) {
|
||||
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.modal.shown = !$scope.modal.shown;
|
||||
$scope.newrc = angular.copy(arduino.emptyrc);
|
||||
};
|
||||
|
||||
$scope.addRC = function(){
|
||||
|
@ -179,9 +188,7 @@ app.controller('MainCtrl', [
|
|||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
.button-primary.red {
|
||||
border: #e9165c 1px solid;
|
||||
background-color: #e9165c;
|
||||
}
|
||||
|
||||
.button-primary.red:hover {
|
||||
border: #c4124d 1px solid;
|
||||
background-color: #c4124d;
|
||||
}
|
||||
|
||||
/* Modal */
|
||||
.ng-modal {
|
||||
width: 85% !important;
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
</div>
|
||||
<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="button" ng-click="deleteRC()" ng-show="modal.delete" class="button-primary red">Delete</button>
|
||||
<button type="button" ng-click="toggleModal()" class="button">Cancel</button>
|
||||
</form>
|
||||
</modal>
|
||||
|
@ -61,7 +62,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<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;">
|
||||
<button class="sign" ng-click="sendRC(RC)" ng-class="{'true':'button-primary','false':'button'}[RC.state]" type="submit" >⏻</button>
|
||||
</td>
|
||||
|
|
Reference in a new issue