diff --git a/spa/audio.py b/spa/audio.py index 2ac60db..6343567 100755 --- a/spa/audio.py +++ b/spa/audio.py @@ -3,7 +3,7 @@ import os import logging from django.conf.urls import url -from django.http import Http404, HttpResponse +from django.http import Http404, HttpResponse, HttpResponseForbidden, HttpResponseNotFound from django.core.servers.basehttp import FileWrapper from sendfile import sendfile @@ -28,6 +28,9 @@ class AudioHandler(object): def download(request, mix_id): try: + if not request.user.is_authenticated(): + return HttpResponseForbidden("Get tae fuck!!!") + mix = Mix.objects.get(pk=mix_id) if mix is not None: if mix.download_allowed: diff --git a/static/img/donate-button.png b/static/img/donate-button.png new file mode 100644 index 0000000..1ae7f2c Binary files /dev/null and b/static/img/donate-button.png differ diff --git a/static/js/app/appv2.coffee b/static/js/app/appv2.coffee index 1aca800..eb747fa 100755 --- a/static/js/app/appv2.coffee +++ b/static/js/app/appv2.coffee @@ -50,6 +50,11 @@ define ['backbone', 'marionette', 'vent', 'utils', utils.modal "/dlg/LoginView" true + @listenTo vent, "app:donate", -> + console.log("App: donate") + utils.modal "/dlg/Donate" + true + @listenTo vent, "mix:favourite", (model) -> console.log "App(vent): mix:favourite" model.save 'favourited', !model.get('favourited'), patch: true diff --git a/static/js/app/appv2.js b/static/js/app/appv2.js index dec1cc7..ad07045 100755 --- a/static/js/app/appv2.js +++ b/static/js/app/appv2.js @@ -52,6 +52,11 @@ utils.modal("/dlg/LoginView"); return true; }); + this.listenTo(vent, "app:donate", function() { + console.log("App: donate"); + utils.modal("/dlg/Donate"); + return true; + }); this.listenTo(vent, "mix:favourite", function(model) { console.log("App(vent): mix:favourite"); model.save('favourited', !model.get('favourited'), { diff --git a/static/js/app/views/widgets/headerView.coffee b/static/js/app/views/widgets/headerView.coffee index 2453888..104e183 100755 --- a/static/js/app/views/widgets/headerView.coffee +++ b/static/js/app/views/widgets/headerView.coffee @@ -18,6 +18,7 @@ define ["underscore", "marionette", "vent", "utils", "views/widgets/searchView", events: "click #header-play-pause-button": "togglePlayState" "click #header-login-button": "login" + "click #header-donate-button": "donate" "click #header-live-button.btn-success": "playLive" "click #header-live-button.btn-danger": "pauseLive" ui: @@ -42,6 +43,10 @@ define ["underscore", "marionette", "vent", "utils", "views/widgets/searchView", login: -> vent.trigger('app:login') + donate: -> + console.log("headerView: donate") + vent.trigger('app:donate') + logout: -> utils.showAlert "Success", "You are now logged out" diff --git a/static/js/app/views/widgets/headerView.js b/static/js/app/views/widgets/headerView.js index 378a608..8922cb3 100644 --- a/static/js/app/views/widgets/headerView.js +++ b/static/js/app/views/widgets/headerView.js @@ -1,4 +1,5 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.4.0 + /* @license @@ -14,16 +15,14 @@ Code provided under the BSD License: __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; define(["underscore", "marionette", "vent", "utils", "views/widgets/searchView", "views/notifications/notificationsListView", "text!/tpl/HeaderView"], function(_, Marionette, vent, utils, SearchView, NotificationsListView, Template) { - var HeaderView, _ref; - + var HeaderView; HeaderView = (function(_super) { var NowrapRegion; __extends(HeaderView, _super); function HeaderView() { - _ref = HeaderView.__super__.constructor.apply(this, arguments); - return _ref; + return HeaderView.__super__.constructor.apply(this, arguments); } NowrapRegion = Marionette.Region.extend({ @@ -39,6 +38,7 @@ Code provided under the BSD License: HeaderView.prototype.events = { "click #header-play-pause-button": "togglePlayState", "click #header-login-button": "login", + "click #header-donate-button": "donate", "click #header-live-button.btn-success": "playLive", "click #header-live-button.btn-danger": "pauseLive" }; @@ -71,6 +71,11 @@ Code provided under the BSD License: return vent.trigger('app:login'); }; + HeaderView.prototype.donate = function() { + console.log("headerView: donate"); + return vent.trigger('app:donate'); + }; + HeaderView.prototype.logout = function() { return utils.showAlert("Success", "You are now logged out"); }; diff --git a/templates/inc/paypal_donate.html b/templates/inc/paypal_donate.html new file mode 100644 index 0000000..e69de29 diff --git a/templates/views/HeaderView.html b/templates/views/HeaderView.html index 5922134..608eac4 100755 --- a/templates/views/HeaderView.html +++ b/templates/views/HeaderView.html @@ -11,6 +11,7 @@