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
2016-02-23 18:44:17 +01:00

116 lines
No EOL
3.1 KiB
Text

<!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">
<table class="u-full-width">
<thead>
<th>RC Switches</th>
<th>Function</th>
</thead>
<tbody>
<tr ng-repeat="RC in RCs | orderBy:'switch_id'">
<td> {{RC.name}} </td>
<td>
<button ng-click="sendRC(RC)" ng-class="{'true':'button-primary','false':'button'}[RC.state]" type="submit" >Toggle RC</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="/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>