Fixed display bug in player-seekhead

This commit is contained in:
=
2012-09-07 17:31:43 +01:00
parent 708fca3fd5
commit 1014d97f90
15 changed files with 52 additions and 21 deletions

0
_working/create Normal file → Executable file
View File

0
manage.py Normal file → Executable file
View File

View File

@@ -1,6 +1,8 @@
from django.core.exceptions import ObjectDoesNotExist
import humanize import humanize
from tastypie.authorization import Authorization from tastypie.authorization import Authorization
from spa.api.v1.BackboneCompatibleResource import BackboneCompatibleResource from spa.api.v1.BackboneCompatibleResource import BackboneCompatibleResource
from spa.models.Venue import Venue
from spa.models.Event import Event from spa.models.Event import Event
class EventResource(BackboneCompatibleResource): class EventResource(BackboneCompatibleResource):
@@ -18,4 +20,15 @@ class EventResource(BackboneCompatibleResource):
return bundle return bundle
def dehydrate_event_date(self, bundle): def dehydrate_event_date(self, bundle):
return humanize.naturalday(bundle.obj.event_date) return humanize.naturalday(bundle.obj.event_date)
def hydrate(self, bundle):
if 'event_venue' in bundle.data:
try:
venue = Venue.objects.get(venue_name__exact=bundle.data['event_venue'])
except ObjectDoesNotExist:
venue = Venue(venue_name=bundle.data['event_venue'], user=bundle.request.user)
venue.save()
bundle.obj.event_venue = venue
return bundle

View File

@@ -55,18 +55,25 @@ class LookupNode(template.Node):
@register.tag @register.tag
def bind_lookup(parser, token): def bind_lookup(parser, token):
try: try:
tag_name, lookup = token.split_contents() tag_name, args = token.split_contents()
model = get_model('spa', lookup) arg_list = [arg.strip() for arg in args.split(',')]
if model is not None: if len(arg_list) == 2:
results = model.get_lookup(lookup) lookup = arg_list[0]
if results is not None: referrer = arg_list[1]
select = "<select>\n"
for result in results: model = get_model('spa', lookup)
select += "\t<option>%s</option>\n" % result.description if model is not None:
select += "</select>\n" results = model.get_lookup(lookup)
return LookupNode(select) if results is not None:
select = "<select id='%s'>\n" % referrer
for result in results:
select += "\t<option value='%s'>%s</option>\n" % (result.id, result.description)
select += "</select>\n"
return LookupNode(select)
else:
raise template.TemplateSyntaxError("%r tag requires two arguments" % token.contents.split()[0])
except ValueError: except ValueError:
raise template.TemplateSyntaxError("%r tag requires a single argument" % token.contents.split()[0]) raise template.TemplateSyntaxError("%r tag requires two arguments" % token.contents.split()[0])
return "" return ""

0
static/bin/sm/soundmanager2.swf Normal file → Executable file
View File

0
static/bin/sm/soundmanager2_debug.swf Normal file → Executable file
View File

0
static/bin/sm/soundmanager2_flash9.swf Normal file → Executable file
View File

0
static/bin/sm/soundmanager2_flash9_debug.swf Normal file → Executable file
View File

0
static/bin/sm/soundmanager2_flash_xdomain.zip Normal file → Executable file
View File

View File

@@ -63,7 +63,7 @@ com.podnoms.utils = {
var day = currentTime.getDate(); var day = currentTime.getDate();
var month = currentTime.getMonth() + 1; var month = currentTime.getMonth() + 1;
var year = currentTime.getFullYear(); var year = currentTime.getFullYear();
return (self.tpad2(day) + "/" + self.pad2(month) + "/" + year); return (com.podnoms.utils.pad2(day) + "/" + com.podnoms.utils.pad2(month) + "/" + year);
}, },
isEmpty: function (val) { isEmpty: function (val) {
return (val === undefined || val == null || val.length <= 0) ? true : false; return (val === undefined || val == null || val.length <= 0) ? true : false;

View File

@@ -66,6 +66,7 @@ window.MixListItemView = Backbone.View.extend({
}, },
pauseMix:function () { pauseMix:function () {
com.podnoms.player.pause(); com.podnoms.player.pause();
_eventAggregator.trigger("track_playing");
}, },
resume:function () { resume:function () {
com.podnoms.player.resume(); com.podnoms.player.resume();
@@ -216,7 +217,7 @@ window.MixCreateView = DSSEditableView.extend({
alert(e); alert(e);
} }
}); });
}else{ } else {
parent.state++; parent.state++;
parent.checkRedirect(); parent.checkRedirect();
} }

View File

@@ -111,6 +111,7 @@ com.podnoms.player = {
} }
}); });
ref.play(); ref.play();
options.success();
}); });
}, },

View File

@@ -59,22 +59,31 @@ window.DSSModel = window.TastypieModel.extend({
window.DSSEditableView = Backbone.View.extend({ window.DSSEditableView = Backbone.View.extend({
events:{ events:{
"change input":"changed", "change input":"changed",
"change textarea":"changed" "change textarea":"changed",
"change":"changedSelect"
},
changedSelect: function(evt){
console.log("Changed select");
var changed = evt.currentTarget;
var value = $(evt.currentTarget).val();
var obj = "{\"" + changed.id + "\":\"" + value.replace(/\n/g, '<br />') + "\"}";
var objInst = JSON.parse(obj);
this.model.set(objInst);
}, },
changed:function (evt) { changed:function (evt) {
console.log("Changed something else");
var changed = evt.currentTarget; var changed = evt.currentTarget;
var value = $("#" + changed.id).val(); var value = $("#" + changed.id).val();
var obj = "{\"" + changed.id + "\":\"" + value.replace(/\n/g, '<br />') + "\"}"; var obj = "{\"" + changed.id + "\":\"" + value.replace(/\n/g, '<br />') + "\"}";
var objInst = JSON.parse(obj); var objInst = JSON.parse(obj);
this.model.set(objInst); this.model.set(objInst);
}, },
_bakeForm:function (el, lookups) { _bakeForm:function (el, lookups) {
//TODO extend lookups to be a list //TODO extend lookups to be a list
//TODO this way we can initialise more than one lookup per page //TODO this way we can initialise more than one lookup per page
var model = this.model; var model = this.model;
var labels, mapped; var labels, mapped;
_.bindAll(this, "changedSelect");
$('.typeahead', el).typeahead({ $('.typeahead', el).typeahead({
source:function (query, process) { source:function (query, process) {
$.get( $.get(
@@ -91,8 +100,8 @@ window.DSSEditableView = Backbone.View.extend({
}, 'json'); }, 'json');
}, },
updater:function (item) { updater:function (item) {
$('#release_label_id', el).val(mapped[item][0]); this.$element.val(mapped[item][0]);
model.set('release_label_id', mapped[item][0]); model.set(this.$element.attr('id'), mapped[item][0]);
return item; return item;
} }
}); });

View File

@@ -8,7 +8,7 @@
<div class="title-bar"> <div class="title-bar">
<h4><a href="#/<%= item.item_url %>"><%= item.title %></a></h4> <h4><a href="#/<%= item.item_url %>"><%= item.title %></a></h4>
</div> </div>
<div class="player-seekhead" id="player-seekhead"> <div class="player-seekhead" id="player-seekhead" style="display: none;">
<span class="player-seekhead-time"></span> <span class="player-seekhead-time"></span>
</div> </div>
<div class="player-progress"> <div class="player-progress">

View File

@@ -44,7 +44,7 @@
<div class="control-group" id="group-event_recurrence"> <div class="control-group" id="group-event_recurrence">
<label class="control-label">Recurrence</label> <label class="control-label">Recurrence</label>
<div class="controls"> <div class="controls">
{% bind_lookup Recurrence %} {% bind_lookup Recurrence,event_recurrence_id %}
</div> </div>
</div> </div>
</div> </div>