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
from tastypie.authorization import Authorization
from spa.api.v1.BackboneCompatibleResource import BackboneCompatibleResource
from spa.models.Venue import Venue
from spa.models.Event import Event
class EventResource(BackboneCompatibleResource):
@@ -19,3 +21,14 @@ class EventResource(BackboneCompatibleResource):
def dehydrate_event_date(self, bundle):
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
def bind_lookup(parser, token):
try:
tag_name, lookup = token.split_contents()
model = get_model('spa', lookup)
if model is not None:
results = model.get_lookup(lookup)
if results is not None:
select = "<select>\n"
for result in results:
select += "\t<option>%s</option>\n" % result.description
select += "</select>\n"
return LookupNode(select)
tag_name, args = token.split_contents()
arg_list = [arg.strip() for arg in args.split(',')]
if len(arg_list) == 2:
lookup = arg_list[0]
referrer = arg_list[1]
model = get_model('spa', lookup)
if model is not None:
results = model.get_lookup(lookup)
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:
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 ""

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 month = currentTime.getMonth() + 1;
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) {
return (val === undefined || val == null || val.length <= 0) ? true : false;

View File

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

View File

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

View File

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

View File

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

View File

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