Merge branch 'template-overhaul' into develop

This commit is contained in:
Jan Tuomi
2017-02-10 18:54:23 +02:00
38 changed files with 1217 additions and 542 deletions
@@ -1,55 +0,0 @@
<div class="row" ng-controller="infoadmin_ctrl">
<div class="col-xs-12 col-md-6">
<h2>Info items</h2>
<div>Infoitems available for rotations:</div>
<table class="table table-striped">
<tr><th>Item</th><th>Set duration</th><th>Add to rotation</th><th>Delete</th></tr>
<tr ng-repeat="i in infoitems">
<td>{{i.name}}</td>
<td><input type="text" class="form-control" ng-model="i.duration"></input></td>
<td><input type="button" class="btn btn-success" ng-click="createInstance(selected_rot.id, i.id, i.item_type, i.duration);" value="add"></input></td>
<td><input type="button" class="btn btn-danger" ng-click="deleteItem(i.item_type, i.id);" value="delete"></input></td>
</tr>
</table>
<h2>Create new item</h2>
<table class="table table-striped">
<tr><td>Item type</td>
<td><select class="form-control form-control-sm" ng-model="createtype", ng-options="t.name for t in infotypes">
<option value=""></option>
</select></td>
</tr>
</table>
<div ng-include="createtype.create_template_url"></div>
</div>
<div class="col-xs-12 col-md-6">
<h2>Rotations</h2>
<div>
Select rotation to edit:
</div>
<table class="table table-striped">
<tr><th>Rotation</th>
<th>Select</th>
<th>Delete</th></tr>
<tr ng-repeat="r in rotations">
<td>{{r.name}}</td>
<td><input type="button" class="btn btn-info" ng-click="selectRotation(r.id)" value="select"></td>
<td><input type="button" class="btn btn-danger" ng-click="deleteRotation(r.id)" value="delete"></input></td>
</tr>
<tr>
<td><input type="text" class="form-control" ng-model="r.name" placeholder="Name"></input></td>
<td><input type="button" class="btn btn-success" ng-click="createRotation(r.name)" value="create new"></input></td>
<td></td>
</tr>
</table>
<h2>Rotation: {{selected_rot.name}}</h2>
<div>Instances in currently selected rotation:</div>
<table class="table table-striped">
<tr><th>Instance</th><th>Duration</th><th>Delete</th></tr>
<tr ng-repeat="i in selected_rot.instances">
<td>{{i.item.name}}</td><td>{{i.duration}}s</td>
<td><input type="button" ng-click="deleteInstance(i.id);" value="delete" class="btn btn-danger"></input></td>
</tr>
</div>
</div
@@ -1,8 +1,15 @@
var app = angular.module('infoAdmin',['ngFileUpload']);
app.config(['$httpProvider', function ($httpProvider) {
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
}]);
app.config(function($interpolateProvider) {
$interpolateProvider.startSymbol('{$');
$interpolateProvider.endSymbol('$}');
});
app.service("InstanceList", ["$http", function($http){
var self = this;
this.selected_rot = {}
+85 -6
View File
@@ -1,3 +1,5 @@
{% load i18n %}
{% load static %}
<!DOCTYPE html>
<html ng-app="infoAdmin">
<head>
@@ -13,13 +15,90 @@
</head>
<body>
<div id="header" class="row">
<div class="col-xs-1 col-xs-offset-11 col-sm-1 col-lg-1">
<form action="/logout" method="post"> {% csrf_token %}
<input type="Submit" value="Logout" name="Logout" class="btn btn-danger"/>
</form>
</div>
<div class="col-xs-1 col-xs-offset-11 col-sm-1 col-lg-1">
<form action="/logout" method="post"> {% csrf_token %}
<input type="Submit" value="{% trans "Log out" %}" name="Logout" class="btn btn-danger"/>
</form>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>{% trans "Infoscreen Admin Pane" %}</h1>
</div>
</div>
<div class="row" ng-controller="infoadmin_ctrl">
<div class="col-xs-12 col-md-6">
<h2>{% trans "Info items" %}</h2>
<div>{% trans "Infoitems available for rotations" %}</div>
<table class="table table-striped">
<tr>
<th>{% trans "Item" %}</th>
<th>{% trans "Set duration" %}</th>
<th>{% trans "Add to rotation" %}</th>
<th>{% trans "Delete" %}</th>
</tr>
<tr ng-repeat="i in infoitems">
<td>{$ i.name $}</td>
<td><input type="text" class="form-control" ng-model="i.duration"></input></td>
<td><input type="button" class="btn btn-success" ng-click="createInstance(selected_rot.id, i.id, i.item_type, i.duration);" value="add"></input></td>
<td><input type="button" class="btn btn-danger" ng-click="deleteItem(i.item_type, i.id);" value="delete"></input></td>
</tr>
</table>
<h2>{% trans "Create new item" %}</h2>
<table class="table table-striped">
<tr>
<td>{% trans "Item type" %}</td>
<td>
<select class="form-control form-control-sm" ng-model="createtype", ng-options="t.name for t in infotypes">
<option value=""></option>
</select>
</td>
</tr>
</table>
<div ng-include="createtype.create_template_url"></div>
</div>
<div class="col-xs-12 col-md-6">
<h2>{% trans "Rotations" %}</h2>
<div>
{% trans "Select rotation to edit" %}:
</div>
<table class="table table-striped">
<tr>
<th>{% trans "Rotation" %}</th>
<th>{% trans "Select" %}</th>
<th>{% trans "Delete" %}</th>
</tr>
<tr ng-repeat="r in rotations">
<td>{$ r.name $}</td>
<td><input type="button" class="btn btn-info" ng-click="selectRotation(r.id)" value="{% trans "Select" %}"></td>
<td><input type="button" class="btn btn-danger" ng-click="deleteRotation(r.id)" value="{% trans "Delete" %}"></input></td>
</tr>
<tr>
<td><input type="text" class="form-control" ng-model="r.name" placeholder="{% trans "Name" %}"></input></td>
<td><input type="button" class="btn btn-success" ng-click="createRotation(r.name)" value="{% trans "Create new" %}"></input></td>
<td></td>
</tr>
</table>
<div class="container" ng-include="'/static/html/infoscreen_admin.html'"></div>
<h2>{% trans "Rotation" %}: {$ selected_rot.name $}</h2>
<div>{% trans "Instances in currently selected rotation" %}:</div>
<table class="table table-striped">
<tr>
<th>{% trans "Instance" %}</th>
<th>{% trans "Duration" %}</th>
<th>{% trans "Delete" %}</th>
</tr>
<tr ng-repeat="i in selected_rot.instances">
<td>{$ i.item.name $}</td><td>{$ i.duration $} s</td>
<td><input type="button" ng-click="deleteInstance(i.id);" value="{% trans "Delete" %}" class="btn btn-danger"></input></td>
</tr>
</table>
</div>
</div>
<div style="margin-top: 100px;">
{% include "footer.html" %}
</div>
</div>
</body>
</html>