fix issue #4; fix issue #5

This commit is contained in:
bkfox 2017-05-04 16:58:54 +02:00
parent aff3476088
commit 89182f3c20
5 changed files with 51 additions and 6 deletions

View File

@ -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;
}

View File

@ -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;
},

View File

@ -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);

View File

@ -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

View File

@ -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: