@@ -46,9 +38,9 @@
- {% if podcasts %}
+ {% if object.podcasts %}
{% endif %}
+
{% endblock %}
diff --git a/aircox/templates/aircox/widgets/episode_item.html b/aircox/templates/aircox/widgets/episode_item.html
index eea55d9..e89da25 100644
--- a/aircox/templates/aircox/widgets/episode_item.html
+++ b/aircox/templates/aircox/widgets/episode_item.html
@@ -41,3 +41,15 @@ Context variables:
{% endif %}
{% endblock %}
+
+{% block actions %}
+{% if object.sound_set.public.count %}
+
+{% endif %}
+{% endblock %}
+
diff --git a/aircox/templates/aircox/widgets/page_item.html b/aircox/templates/aircox/widgets/page_item.html
index d824d3c..6c15d79 100644
--- a/aircox/templates/aircox/widgets/page_item.html
+++ b/aircox/templates/aircox/widgets/page_item.html
@@ -30,7 +30,7 @@ Context variables:
{% if has_cover|default_if_none:True %}
{% endif %}
@@ -55,6 +55,8 @@ Context variables:
{% endif %}
+
+ {% block actions %}{% endblock %}
{% endif %}
diff --git a/aircox/views/episode.py b/aircox/views/episode.py
index 1c89cc7..fb23b0f 100644
--- a/aircox/views/episode.py
+++ b/aircox/views/episode.py
@@ -4,7 +4,6 @@ import datetime
from django.views.generic import ListView
from ..models import Diffusion, Episode, Program, StaticPage, Sound
-from ..serializers import PodcastSerializer
from .base import BaseView
from .program import ProgramPageDetailView
from .page import PageListView
@@ -20,8 +19,6 @@ class EpisodeDetailView(ProgramPageDetailView):
def get_context_data(self, **kwargs):
if not 'tracks' in kwargs:
kwargs['tracks'] = self.object.track_set.order_by('position')
- if not 'podcasts' in kwargs:
- kwargs['podcasts'] = [PodcastSerializer(s).data for s in self.object.sound_set.public() ]
return super().get_context_data(**kwargs)
diff --git a/assets/public/app.js b/assets/public/app.js
index 08b6e9f..07d8953 100644
--- a/assets/public/app.js
+++ b/assets/public/app.js
@@ -1,6 +1,5 @@
import Vue from 'vue';
-
export const defaultConfig = {
el: '#app',
delimiters: ['[[', ']]'],
@@ -12,12 +11,12 @@ export const defaultConfig = {
},
computed: {
- player() { return window.aircox.player; }
+ player() { return window.aircox.player; },
},
}
-export default function App(config) {
- return (new AppConfig(config)).load()
+export default function App(config, sync=false) {
+ return (new AppConfig(config)).load(sync)
}
/**
@@ -30,30 +29,36 @@ export class AppConfig {
get config() {
let config = this._config instanceof Function ? this._config() : this._config;
- return {...defaultConfig, ...config};
+ for(var k of new Set([...Object.keys(config || {}), ...Object.keys(defaultConfig)])) {
+ if(!config[k] && defaultConfig[k])
+ config[k] = defaultConfig[k]
+ else if(config[k] instanceof Object)
+ config[k] = {...defaultConfig[k], ...config[k]}
+ }
+ return config;
}
set config(value) {
this._config = value;
}
- load() {
+ load(sync=false) {
var self = this;
return new Promise(function(resolve, reject) {
- window.addEventListener('load', () => {
- try {
- let config = self.config;
- const el = document.querySelector(config.el)
- if(!el) {
- reject(`Error: missing element ${config.el}`);
- return;
- }
- resolve(new Vue(config))
- }
- catch(error) { reject(error) }
- })
+ let func = () => { try { resolve(self.build()) } catch(error) { reject(error) }};
+ sync ? func() : window.addEventListener('load', func);
});
}
+
+ build() {
+ let config = this.config;
+ const el = document.querySelector(config.el)
+ if(!el) {
+ reject(`Error: missing element ${config.el}`);
+ return;
+ }
+ return new Vue(config);
+ }
}
diff --git a/assets/public/episode.vue b/assets/public/episode.vue
new file mode 100644
index 0000000..459565c
--- /dev/null
+++ b/assets/public/episode.vue
@@ -0,0 +1,23 @@
+