diff --git a/_working/create b/_working/create old mode 100644 new mode 100755 diff --git a/manage.py b/manage.py old mode 100644 new mode 100755 diff --git a/spa/api/v1/EventResource.py b/spa/api/v1/EventResource.py index f629287..4b35c04 100644 --- a/spa/api/v1/EventResource.py +++ b/spa/api/v1/EventResource.py @@ -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): @@ -18,4 +20,15 @@ class EventResource(BackboneCompatibleResource): return bundle def dehydrate_event_date(self, bundle): - return humanize.naturalday(bundle.obj.event_date) \ No newline at end of file + 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 \ No newline at end of file diff --git a/spa/templatetags/spa_extras.py b/spa/templatetags/spa_extras.py index 360eeb1..2349dc4 100644 --- a/spa/templatetags/spa_extras.py +++ b/spa/templatetags/spa_extras.py @@ -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 = "\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 = "\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 "" diff --git a/static/bin/sm/soundmanager2.swf b/static/bin/sm/soundmanager2.swf old mode 100644 new mode 100755 diff --git a/static/bin/sm/soundmanager2_debug.swf b/static/bin/sm/soundmanager2_debug.swf old mode 100644 new mode 100755 diff --git a/static/bin/sm/soundmanager2_flash9.swf b/static/bin/sm/soundmanager2_flash9.swf old mode 100644 new mode 100755 diff --git a/static/bin/sm/soundmanager2_flash9_debug.swf b/static/bin/sm/soundmanager2_flash9_debug.swf old mode 100644 new mode 100755 diff --git a/static/bin/sm/soundmanager2_flash_xdomain.zip b/static/bin/sm/soundmanager2_flash_xdomain.zip old mode 100644 new mode 100755 diff --git a/static/js/app/utils.js b/static/js/app/utils.js index 8cc5aac..5c6de15 100644 --- a/static/js/app/utils.js +++ b/static/js/app/utils.js @@ -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; diff --git a/static/js/app/views/mix.js b/static/js/app/views/mix.js index 2aebc1a..079b3fd 100644 --- a/static/js/app/views/mix.js +++ b/static/js/app/views/mix.js @@ -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(); } diff --git a/static/js/com.podnoms.player.js b/static/js/com.podnoms.player.js index 2e16af6..6ee381e 100644 --- a/static/js/com.podnoms.player.js +++ b/static/js/com.podnoms.player.js @@ -111,6 +111,7 @@ com.podnoms.player = { } }); ref.play(); + options.success(); }); }, diff --git a/static/js/libs/backbone/backbone.mine.js b/static/js/libs/backbone/backbone.mine.js index d51ea0c..9458db0 100644 --- a/static/js/libs/backbone/backbone.mine.js +++ b/static/js/libs/backbone/backbone.mine.js @@ -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, '
') + "\"}"; + 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, '
') + "\"}"; 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; } }); diff --git a/templates/inc/_MixItemInsert.html b/templates/inc/_MixItemInsert.html index a3ae3fe..6abf823 100644 --- a/templates/inc/_MixItemInsert.html +++ b/templates/inc/_MixItemInsert.html @@ -8,7 +8,7 @@

<%= item.title %>

-
+
diff --git a/templates/views/EventCreateView.html b/templates/views/EventCreateView.html index 40ff9a6..7ccec29 100644 --- a/templates/views/EventCreateView.html +++ b/templates/views/EventCreateView.html @@ -44,7 +44,7 @@
- {% bind_lookup Recurrence %} + {% bind_lookup Recurrence,event_recurrence_id %}