Add coffeeinfoitem

Serve ka.dy.fi in iframe as infoitem. Resolves #29.
This commit is contained in:
Tatoma
2017-02-01 19:19:56 +02:00
parent 54148fdfb3
commit e5e284b80d
8 changed files with 43 additions and 0 deletions
+2
View File
@@ -1,5 +1,6 @@
from django.contrib import admin
from infoscreen.models import Rotation, InfoItem, InfoInstance, ImageInfoItem, ExternalImageInfoItem, ABBInfoItem
from infoscreen.models import CoffeeInfoItem
# Register your models here.
admin.site.register(Rotation)
@@ -8,3 +9,4 @@ admin.site.register(ImageInfoItem)
admin.site.register(ExternalImageInfoItem)
admin.site.register(ABBInfoItem)
admin.site.register(InfoInstance)
admin.site.register(CoffeeInfoItem)
+7
View File
@@ -75,7 +75,14 @@ class ABBInfoItem(InfoItem):
@staticmethod
def get_create_template_url():
return "/static/html/abb_create.html"
class CoffeeInfoItem(InfoItem):
def get_template_url(self):
return "/static/html/coffee.html"
@staticmethod
def get_create_template_url():
return "/static/html/coffee_create.html"
class SossoInfoItem(InfoItem):
def get_template_url(self):
+10
View File
@@ -0,0 +1,10 @@
body{
margin: 0;
}
iframe {
display: block;
background: #000;
border: none;
height: 100vh;
width: 100vw;
}
+4
View File
@@ -0,0 +1,4 @@
<link rel="stylesheet" href="/static/css/coffee.css">
<iframe src="http://ka.dy.fi" allowfullscreen=true sandbox="allow-scripts allow-pointer-lock allow-same-origin">
<p>Your browser does not support iframes.</p>
</iframe>
+10
View File
@@ -0,0 +1,10 @@
<div ng-controller="infoadmin_coffeeitem_create" style="margin-top:20px;">
<div>
Create new item to show coffee website. Name is used only as identifier
</div>
<div class="form-group">
<label>Name:</label>
<input type="text" ng-model="item.name"></input>
</div>
<input type="button" class="btn btn-success" ng-click="send()" value="create"></input>
</div>
@@ -140,6 +140,12 @@ app.controller('infoadmin_hslitem_create', function($scope, $http,ItemList){
$http.post("/infoscreen/create_hslitem", $scope.item).then(ItemList.loadItems)
}
});
app.controller('infoadmin_coffeeitem_create', function($scope, $http,ItemList){
$scope.item = {}
$scope.send = function(){
$http.post("/infoscreen/create_coffeeitem", $scope.item).then(ItemList.loadItems)
}
});
app.controller('infoadmin_image_create', ['$scope', 'Upload', '$timeout',"ItemList", function ($scope, Upload, $timeout,ItemList) {
$scope.send = function(file) {
+2
View File
@@ -7,6 +7,7 @@ from django.contrib.auth.decorators import permission_required
from infoscreen.models import Rotation, InfoItem, InfoInstance
from infoscreen.models import ABBInfoItem, ExternalImageInfoItem, ImageInfoItem, SossoInfoItem, HslInfoItem
from infoscreen.models import CoffeeInfoItem
from infoscreen.models import ImageUploadForm
from infoscreen.models import HSLDataModel
from infoscreen.hsl_fetcher import HSLFetcher
@@ -211,3 +212,4 @@ createABBItem = create_item_generator(ABBInfoItem)
createSossoItem = create_item_generator(SossoInfoItem)
createHslItem = create_item_generator(HslInfoItem)
createExternalImageInfoItem = create_item_generator(ExternalImageInfoItem)
createCoffeeItem = create_item_generator(CoffeeInfoItem)