diff --git a/.gitignore b/.gitignore
index 27aa007..467e24f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,5 @@ venv
__pycache__
db.sqlite3
www/
+*.swp
+venv
diff --git a/app/static/css/partials/_film.scss b/app/static/css/partials/_film.scss
index a098201..972f2ef 100644
--- a/app/static/css/partials/_film.scss
+++ b/app/static/css/partials/_film.scss
@@ -2,8 +2,10 @@
.films {
width: 100vw;
+ margin: 8px;
.film {
width: 100vw;
+ margin-bottom: 16px;
display: flex;
flex-direction: row;
.left, .right {
@@ -34,3 +36,15 @@
}
}
+
+.film {
+ .info {
+ margin: 8px;
+ }
+ .play {
+ text-align: center;
+ margin: 8px;
+ margin-top: 16px;
+ margin-bottom: 16px;
+ }
+}
diff --git a/app/static/css/partials/_text.scss b/app/static/css/partials/_text.scss
new file mode 100644
index 0000000..369ce44
--- /dev/null
+++ b/app/static/css/partials/_text.scss
@@ -0,0 +1,8 @@
+
+
+.texts {
+ .text {
+ margin: 8px;
+ }
+
+}
diff --git a/app/static/css/style.scss b/app/static/css/style.scss
index d5fb348..6ebb911 100644
--- a/app/static/css/style.scss
+++ b/app/static/css/style.scss
@@ -2,4 +2,5 @@
@import "partials/layout";
@import "partials/burger";
@import "partials/film";
+@import "partials/text";
@import "partials/ascroll";
diff --git a/app/static/js/ascroll.js b/app/static/js/ascroll.js
index f4b123c..8226e20 100644
--- a/app/static/js/ascroll.js
+++ b/app/static/js/ascroll.js
@@ -31,12 +31,15 @@ function updatePlayerPosition(video, lastKnownScrollPosition) {
video.style.display = 'block';
}
-function updatePlayer(video, frame, currentTime) {
+function updatePlayer(video, frame, currentTime, src) {
var rect = frame.getBoundingClientRect();
video.style.opacity = 0
console.log('update player', rect)
video.style.top = (rect.top + window.scrollY) + 'px'
video.style.display = 'block';
+ if (src) {
+ video.src = src
+ }
//video.poster = frame.querySelector('img').src
video.currentTime = currentTime
video.controls = true
@@ -67,55 +70,132 @@ function onVisibilityChange(el, callback) {
}
}
+function loadItem(config) {
+ pandoraAPI('get', {id: config.item, keys: ['id', 'title', 'layers']}).then(response => {
+ var ascroll = document.querySelector('#ascroll')
+ var loaded = false
-pandoraAPI('get', {id: film.id, keys: ['id', 'title', 'layers']}).then(response => {
- var ascroll = document.querySelector('#ascroll')
- var loaded = false
+ var video = document.createElement('video')
+ video.classList.add('player')
+ video.muted = true
+ video.src = `${baseURL}/${config.item}/480p.webm`
+ ascroll.appendChild(video)
- var video = document.createElement('video')
- video.classList.add('player')
- video.muted = true
- video.src = `${baseURL}/${film.id}/480p.webm`
- ascroll.appendChild(video)
+ var h1 = document.createElement('h1')
+ h1.innerHTML = response.data.title
+ ascroll.appendChild(h1)
- var h1 = document.createElement('h1')
- h1.innerHTML = response.data.title
- ascroll.appendChild(h1)
+ response.data.layers[layer].forEach(annotation => {
+ if (config.user && annotation.user != config.user) {
+ return
+ }
+ var div = document.createElement('div')
+ div.classList.add('annotation')
+ div.innerHTML = `
+
+ {% for text in texts %}
+
+ {% endfor %}
+{% endblock %}
diff --git a/app/text/admin.py b/app/text/admin.py
index 8c38f3f..f9f28e5 100644
--- a/app/text/admin.py
+++ b/app/text/admin.py
@@ -1,3 +1,12 @@
from django.contrib import admin
-# Register your models here.
+from . import models
+
+
+@admin.decorators.register(models.Text)
+class TextAdmin(admin.ModelAdmin):
+ pass
+
+@admin.decorators.register(models.Page)
+class PageAdmin(admin.ModelAdmin):
+ pass
diff --git a/app/text/migrations/0002_rename_essay_text.py b/app/text/migrations/0002_rename_essay_text.py
new file mode 100644
index 0000000..4241c2e
--- /dev/null
+++ b/app/text/migrations/0002_rename_essay_text.py
@@ -0,0 +1,17 @@
+# Generated by Django 3.2.7 on 2021-10-10 14:25
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('text', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.RenameModel(
+ old_name='Essay',
+ new_name='Text',
+ ),
+ ]
diff --git a/app/text/models.py b/app/text/models.py
index 94058f7..0ef0c35 100644
--- a/app/text/models.py
+++ b/app/text/models.py
@@ -1,5 +1,7 @@
import logging
+import json
+from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import models
@@ -19,15 +21,27 @@ class Page(models.Model):
teaser = models.TextField()
body = models.TextField()
-class Essay(models.Model):
+class Text(models.Model):
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
slug = models.SlugField()
public = models.BooleanField(default=False)
+ title = models.TextField()
+ teaser = models.TextField(default="", blank=True)
+ body = models.TextField(default="", blank=True)
+
data = models.JSONField(default=dict)
- title = models.TextField()
- teaser = models.TextField()
- body = models.TextField()
+ def __str__(self):
+ return self.title
+
+ def get_absolute_url(self):
+ return '/' + settings.URL_PREFIX + 'assemblies/' + self.slug
+
+ def json(self):
+ data = {}
+ data['title'] = self.title
+ data.update(self.data)
+ return json.dumps(data)
diff --git a/app/text/views.py b/app/text/views.py
index 0f6eb92..6fdfc24 100644
--- a/app/text/views.py
+++ b/app/text/views.py
@@ -2,6 +2,10 @@ from django.shortcuts import render, redirect, get_object_or_404
from . import models
+def fallback(request):
+ context = {}
+ return render(request, 'fallback.html', context)
+
def index(request):
context = {}
return render(request, 'index.html', context)
@@ -10,12 +14,12 @@ def about(request):
context = {}
return render(request, 'about.html', context)
-def essays(request):
+def texts(request):
context = {}
- context['essays'] = models.Essay.objects.filter(public=True).order_by('created')
- return render(request, 'essays.html', context)
+ context['texts'] = models.Text.objects.filter(public=True).order_by('created')
+ return render(request, 'texts.html', context)
-def essay(request, slug, lang):
+def text(request, slug):
context = {}
- context['essay'] = get_object_or_404(models.Essay, slug=slug)
- return render(request, 'essay.html', context)
+ context['text'] = get_object_or_404(models.Text, slug=slug)
+ return render(request, 'text.html', context)
diff --git a/app/urls.py b/app/urls.py
index 96d308a..4497acc 100644
--- a/app/urls.py
+++ b/app/urls.py
@@ -30,9 +30,10 @@ urlpatterns = [
path(settings.URL_PREFIX + 'edit/
/play/', video.edit_play, name='edit_play'),
path(settings.URL_PREFIX + 'edit//', video.edit, name='edit'),
path(settings.URL_PREFIX + 'tv/', video.tv, name='tv'),
- path(settings.URL_PREFIX + 'essays/', text.essays, name='essays'),
- path(settings.URL_PREFIX + 'essay//', text.essay, name='essay'),
+ path(settings.URL_PREFIX + 'assemblies/', text.texts, name='texts'),
+ path(settings.URL_PREFIX + 'assemblies/', text.text, name='text'),
path(settings.URL_PREFIX + 'about/', text.about, name='about'),
path(settings.URL_PREFIX[:-1], text.index, name='index'),
+ path('', text.fallback, name='fallback'),
]
diff --git a/app/video/models.py b/app/video/models.py
index 8c0ab91..c42c323 100644
--- a/app/video/models.py
+++ b/app/video/models.py
@@ -22,6 +22,13 @@ class Film(models.Model):
def __str__(self):
return self.data.get('title', self.slug)
+ def get_absolute_url(self):
+ return '/' + settings.URL_PREFIX + 'film/' + self.slug
+
+ def related_texts(self):
+ from ..text.models import Text
+ return Text.objects.filter(data__item=self.padma_id)
+
class Edit(models.Model):
created = models.DateTimeField(auto_now_add=True)