From 89182f3c2039cb7154d478213ffeb13838af703a Mon Sep 17 00:00:00 2001 From: bkfox Date: Thu, 4 May 2017 16:58:54 +0200 Subject: [PATCH] fix issue #4; fix issue #5 --- aircox_cms/static/aircox_cms/css/theme.css | 9 +++++- aircox_cms/static/aircox_cms/js/player.js | 14 ++++++--- .../aircox_cms/sections/section_player.html | 2 +- aircox_cms/views.py | 31 +++++++++++++++++++ notes.md | 1 + 5 files changed, 51 insertions(+), 6 deletions(-) diff --git a/aircox_cms/static/aircox_cms/css/theme.css b/aircox_cms/static/aircox_cms/css/theme.css index c60603e..dffced3 100755 --- a/aircox_cms/static/aircox_cms/css/theme.css +++ b/aircox_cms/static/aircox_cms/css/theme.css @@ -76,7 +76,7 @@ a:hover > .small_icon { /** page **/ .page > nav { - width: 16em; + width: 20em; overflow: hidden; } @@ -215,3 +215,10 @@ main.detail { } + +/** section: playlist **/ +.playlist .title { + font-style: italic; + color: #616161; +} + diff --git a/aircox_cms/static/aircox_cms/js/player.js b/aircox_cms/static/aircox_cms/js/player.js index 556e885..36171f0 100755 --- a/aircox_cms/static/aircox_cms/js/player.js +++ b/aircox_cms/static/aircox_cms/js/player.js @@ -81,7 +81,6 @@ Sound.prototype = { }, false ); - item.addEventListener('click', function(event) { if(event.target.className.indexOf('action') != -1) return; @@ -119,7 +118,7 @@ Playlist.prototype = { }); }, - add: function(sound, container) { + add: function(sound, container, position) { var sound_ = this.find(sound.streams); if(sound_) return sound_; @@ -128,9 +127,16 @@ Playlist.prototype = { this.on_air = sound; sound.make_item(this, this.item_); - (container || this.playlist).appendChild(sound.item); - this.sounds.push(sound); + container = container || this.playlist; + if(position != undefined) { + container.insertBefore(sound.item, container.children[position]); + this.sounds.insert(position, 0, sound.item); + } + else { + container.appendChild(sound.item); + this.sounds.push(sound); + } this.save(); return sound; }, diff --git a/aircox_cms/templates/aircox_cms/sections/section_player.html b/aircox_cms/templates/aircox_cms/sections/section_player.html index bf0da40..729a518 100755 --- a/aircox_cms/templates/aircox_cms/sections/section_player.html +++ b/aircox_cms/templates/aircox_cms/sections/section_player.html @@ -15,7 +15,7 @@ var sound = player.playlist.add( streams=[ {% for stream in streams %}'{{ stream }}',{% endfor %} ], cover = undefined, on_air = true - ) + ), undefined, 0 ); sound.item.className += ' live'; player.playlist.select(sound, false); diff --git a/aircox_cms/views.py b/aircox_cms/views.py index 2800278..6b514dd 100755 --- a/aircox_cms/views.py +++ b/aircox_cms/views.py @@ -1,2 +1,33 @@ from django.shortcuts import render +import django.views.generic as generic + +import foxcms.views as Views + +import aircox.sections as sections + +class DynamicListView(Views.View, generic.list.ListView): + list_info = None + + def get_queryset(self): + self.list_info = {} + return sections.ListBase.from_request(request, context = self.list_info) + + #def get_ordering(self): + # order = self.request.GET.get('order_by') + # if order: + # field = order[1:] if order['-'] else order + # else: + # field = 'pk' + # if field not in self.model.ordering_fields: + # return super().get_ordering() + # TODO replace 'asc' in ListBase into sorting field + + def get_context_data(self, *args, **kwargs + context = super().get_context_data(*args, **kwargs) + if self.list_info: + context.update(self.list_info) + return context + + + diff --git a/notes.md b/notes.md index ecee3c6..1009e60 100755 --- a/notes.md +++ b/notes.md @@ -1,5 +1,6 @@ This file is used as a reminder, can be used as crappy documentation too. + # conventions ## coding style * name of classes relative to a class: