This repository has been archived on 2024-01-30. You can view files and clone it, but cannot push or open issues or pull requests.
trev/nodejs/views/index.ejs

146 lines
4.7 KiB
Plaintext

<!DOCTYPE html>
<html>
<head>
<title>Trev</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="stylesheet" href="/stylesheets/normalize.css">
<link rel="stylesheet" href="/stylesheets/skeleton.css">
<link rel="stylesheet" href="/stylesheets/style.css">
<script src="/javascripts/angular.min.js"></script>
<script src="/javascripts/angular-ui-router.min.js"></script>
<script src="/javascripts/angularApp.js"></script>
</head>
<body ng-app="autome">
<div class="container">
<div class="row">
<div class="twelve columns">
<nav ng-controller="NavCtrl">
<a href="/#/home"><h4>Trev</h4></a>
<ul>
<li ng-hide="isLoggedIn()"><a href="/#/login">Log in</a></li>
<li ng-show="isLoggedIn()"><a href="/#/register">Add user</a></li>
<li ng-show="isLoggedIn()"><a href="/#/login" ng-click="logOut()">Log out</a></li>
<li ng-show="isLoggedIn()" class="user" >{{ currentUser() }}</li>
</ul>
</nav>
<ui-view></ui-view>
</div>
</div>
</div>
<script type="text/ng-template" id="/home.html" >
<modal show="modal.shown" >
<h2>Add new RC Switch</h2>
<form ng-submit="addRC()" ng-model="newrc">
<input class="u-full-width" ng-model="newrc.name" placeholder="Name" type="text">
<div class="row">
<div class="six columns">
<input class="u-full-width" ng-model="newrc.on_value" placeholder="On Value" type="text">
</div>
<div class="six columns">
<input class="u-full-width" ng-model="newrc.off_value" placeholder="Off Value" type="text">
</div>
</div>
<label>Is this a tristate switch? <input ng-model="newrc.tristate" type="checkbox" ></input></label>
<button type="submit" ng-hide="modal.delete" class="button-primary">Add</button>
<button type="button" ng-click="changeRC()" ng-show="modal.delete" class="button-primary">Change</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>
<table class="u-full-width">
<thead>
<th>RC Switches</th>
<th style="text-align: right;">
<span class="symbol" ng-click='toggleModal()' >+</span>
</th>
</thead>
<tbody>
<tr ng-repeat="RC in RCs | orderBy:'switch_id'">
<td><span ng-click="toggleModal(RC)" class="symbol">&#9776;</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" >&#x23FB;</button>
</td>
</tr>
</tbody>
</table>
<form ng-submit="irTest()" style="margin-top:30px;">
<button type="submit" class="button-primary">IR</button>
</form>
</script>
<script type="text/ng-template" id="/modal.html">
<div class="ng-modal" ng-show="show" >
<div class="ng-modal-overlay" ng-click="hideModal()"></div>
<div class="ng-modal-dialog" ng-style="dialogStyle">
<div class="ng-modal-dialog-content" ng-transclude></div>
</div>
</div>
</script>
<script type="text/ng-template" id="/register.html">
<div ng-show="error">
<span class="errorm">{{ error.message }}</span>
</div>
<form ng-submit="register()" style="margin-top:30px;">
<h3>Register</h3>
<div class="row">
<div class="six columns">
<label>Username</label>
<input type="text"
class="u-full-width"
placeholder="Username"
ng-model="user.username"></input>
</div>
<div class="six columns">
<label>Password</label>
<input type="password"
class="u-full-width"
placeholder="Password"
ng-model="user.password"></input>
</div>
</div>
<button type="submit" class="button-primary">Register</button>
</form>
</script>
<script type="text/ng-template" id="/login.html">
<div ng-show="error">
<span class="errorm">{{ error.message }}</span>
</div>
<form ng-submit="logIn()"
style="margin-top:30px;">
<h3>Log in</h3>
<div class="row">
<div class="six columns">
<label>Username</label>
<input type="text"
class="u-full-width"
placeholder="Username"
ng-model="user.username"></input>
</div>
<div class="six columns">
<label>Password</label>
<input type="password"
class="u-full-width"
placeholder="Password"
ng-model="user.password"></input>
</div>
</div>
<button type="submit" class="button-primary">Log in</button>
</form>
</script>
</body>
</html>