diff --git a/spa/api/v1/UserResource.py b/spa/api/v1/UserResource.py index 743cb20..47cb471 100755 --- a/spa/api/v1/UserResource.py +++ b/spa/api/v1/UserResource.py @@ -74,6 +74,10 @@ class UserResource(BackboneCompatibleResource): if 'activity_sharing_comments' in kwargs: del kwargs['activity_sharing_comments'] ret = super(UserResource, self).obj_update(bundle, skip_errors, **kwargs) + + bundle.obj.update_follower(bundle.request.user, + bundle.data['favourited']) + update_geo_info_task.delay(ip_address=bundle.request.META['REMOTE_ADDR'], profile_id=bundle.request.user.get_profile().id) return ret diff --git a/spa/management/commands/deleteorphanmp3.py b/spa/management/commands/deleteorphanmp3.py index 9d469fd..6f9bd64 100755 --- a/spa/management/commands/deleteorphanmp3.py +++ b/spa/management/commands/deleteorphanmp3.py @@ -5,6 +5,7 @@ from os.path import isfile, join from dss import settings from spa.models import Mix + class Command(NoArgsCommand): def handle(self, *args, **options): try: @@ -22,6 +23,9 @@ class Command(NoArgsCommand): new_file = os.path.join(expired_path, f) os.rename(os.path.join(mixes_path, f), new_file) print "Moved %s to %s" % (f, new_file) + except Exception, ex: + print "Error in file: %s" % ex.message + except Exception, ex: print "Error: %s" % ex.message diff --git a/spa/models/activity.py b/spa/models/activity.py index 3bbbba0..ca0558f 100755 --- a/spa/models/activity.py +++ b/spa/models/activity.py @@ -14,6 +14,7 @@ ACTIVITYTYPES = ( ('d', 'downloaded'), ('l', 'liked'), ('f', 'favourited'), + ('l', 'followed') ) class Activity(_BaseModel): diff --git a/static/js/app/models/user/userItem.coffee b/static/js/app/models/user/userItem.coffee index df26bde..877774c 100755 --- a/static/js/app/models/user/userItem.coffee +++ b/static/js/app/models/user/userItem.coffee @@ -1,6 +1,5 @@ -define ['app.lib/backbone.dss.model'], \ - (DssModel) -> - class UserItem extends DssModel - urlRoot: com.podnoms.settings.urlRoot + "user/" - - UserItem \ No newline at end of file +define ['models/user/userCollection', 'app.lib/backbone.dss.model'], +(UserCollection, DssModel) -> + class UserItem extends DssModel + urlRoot: com.podnoms.settings.urlRoot + "user/" + UserItem \ No newline at end of file diff --git a/static/js/app/models/user/userItem.js b/static/js/app/models/user/userItem.js index 392390d..f29bd89 100755 --- a/static/js/app/models/user/userItem.js +++ b/static/js/app/models/user/userItem.js @@ -3,7 +3,7 @@ var __hasProp = {}.hasOwnProperty, __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(['app.lib/backbone.dss.model'], function(DssModel) { + define(['models/user/userCollection', 'app.lib/backbone.dss.model'], function(UserCollection, DssModel) { var UserItem; UserItem = (function(_super) { diff --git a/static/js/app/views/mix/mixEditView.coffee b/static/js/app/views/mix/mixEditView.coffee index 7b73bc2..1845c47 100755 --- a/static/js/app/views/mix/mixEditView.coffee +++ b/static/js/app/views/mix/mixEditView.coffee @@ -4,6 +4,8 @@ define ['app.lib/editableView', 'ace', 'dropzone', 'wizard', 'ajaxfileupload','jquery.fileupload', 'lib/ace/uncompressed/select2'], (EditableView, vent, moment, utils, Syphon, Template, GenreCollection, jDataView) -> class MixEditView extends EditableView + @func = null + template: _.template(Template) events: "click #login": "login" @@ -15,7 +17,7 @@ define ['app.lib/editableView', initialize: -> @guid = utils.generateGuid() - @uploadState = 0 + @uploadState = -1 @detailsEntered = false @patch = false @@ -41,49 +43,39 @@ define ['app.lib/editableView', wizard = $("#fuelux-wizard", @el).ace_wizard().on("change",(e, info) => if info.step is 1 and @uploadState is 0 console.log "MixEditView: No mix uploaded" + @ui.uploadError.text("Please add a mix") @ui.uploadError.fadeIn() + false + else if @uploadState > 0 + true + else $('#step1').addClass("alert-danger") false - else - true ).on("finished", (e) => console.log("Finished") @saveChanges() ) $("#mix-upload-form", @el).dropzone - previewTemplate: '
\n -
\n -
\n -
\n - \n -
\n -
-
-
\n -
\n -
\n -
\n -
' + addRemoveLinks: true - dictDefaultMessage : ' Drop files to upload - (or click)
- ' + dictDefaultMessage: " Drop files to upload \t\t\t\t(or click)
\t\t\t\t" maxFilesize: 512 - drop: -> + sending: => $('.progress', @el).show() + @uploadState = 1 uploadprogress: (e, progress, bytesSent) => $('.progress', @el).show() - @uploadState = 1 percentage = Math.round(progress) @ui.progress.css("width", percentage + "%").parent().attr "data-percent", percentage + "%" - complete: => - @uploadState = 2 - @checkRedirect() + complete: (file)=> + if file.status != "error" + @uploadState = 2 + @checkRedirect() $("#genres", @el).select2 placeholder: "Start typing and choose from list or create your own." diff --git a/static/js/app/views/mix/mixEditView.js b/static/js/app/views/mix/mixEditView.js index 365ea9e..13096ba 100644 --- a/static/js/app/views/mix/mixEditView.js +++ b/static/js/app/views/mix/mixEditView.js @@ -15,6 +15,8 @@ return MixEditView.__super__.constructor.apply(this, arguments); } + MixEditView.func = null; + MixEditView.prototype.template = _.template(Template); MixEditView.prototype.events = { @@ -30,7 +32,7 @@ MixEditView.prototype.initialize = function() { this.guid = utils.generateGuid(); - this.uploadState = 0; + this.uploadState = -1; this.detailsEntered = false; return this.patch = false; }; @@ -55,47 +57,38 @@ wizard = $("#fuelux-wizard", this.el).ace_wizard().on("change", function(e, info) { if (info.step === 1 && _this.uploadState === 0) { console.log("MixEditView: No mix uploaded"); + _this.ui.uploadError.text("Please add a mix"); _this.ui.uploadError.fadeIn(); + return false; + } else if (_this.uploadState > 0) { + return true; + } else { $('#step1').addClass("alert-danger"); return false; - } else { - return true; } }).on("finished", function(e) { console.log("Finished"); return _this.saveChanges(); }); $("#mix-upload-form", this.el).dropzone({ - previewTemplate: '
\n\ -
\n\ -
\n\ -
\n\ - \n\ -
\n\ -
\ -
\ -
\n\ -
\n\ -
\n\ -
\n\ -
', - dictDefaultMessage: ' Drop files to upload\ - (or click)
\ - ', + addRemoveLinks: true, + dictDefaultMessage: " Drop files to upload \t\t\t\t(or click)
\t\t\t\t", maxFilesize: 512, - drop: function() { - return $('.progress', this.el).show(); + sending: function() { + $('.progress', _this.el).show(); + return _this.uploadState = 1; }, uploadprogress: function(e, progress, bytesSent) { var percentage; $('.progress', _this.el).show(); - _this.uploadState = 1; percentage = Math.round(progress); return _this.ui.progress.css("width", percentage + "%").parent().attr("data-percent", percentage + "%"); }, - complete: function() { - _this.uploadState = 2; - return _this.checkRedirect(); + complete: function(file) { + if (file.status !== "error") { + _this.uploadState = 2; + return _this.checkRedirect(); + } } }); $("#genres", this.el).select2({ diff --git a/static/js/app/views/mix/mixItemView.coffee b/static/js/app/views/mix/mixItemView.coffee index dc3f796..3ebb9c1 100755 --- a/static/js/app/views/mix/mixItemView.coffee +++ b/static/js/app/views/mix/mixItemView.coffee @@ -81,13 +81,13 @@ define ['underscore', 'moment', 'app', 'vent', 'app.lib/dssView', 'utils', _setupStateUI: -> if @app.audioController.isPlayingId @model.id @ui.playButton.removeClass("play").removeClass("resume").removeClass("pause") - @ui.playButtonIcon.removeClass("icon-play").removeClass("icon-pause") + @ui.playButtonIcon.removeClass("fa-play").removeClass("fa-pause") if @mixState is 1 #playing @ui.playButton.addClass("pause") - @ui.playButtonIcon.removeClass("icon-play").addClass("icon-pause") + @ui.playButtonIcon.removeClass("fa-play").addClass("fa-pause") else if @mixState is 2 #paused @ui.playButton.addClass("resume") - @ui.playButtonIcon.removeClass("icon-pause").addClass("icon-play") + @ui.playButtonIcon.removeClass("fa-pause").addClass("fa-play") mixPlay: (button) -> vent.trigger('mix:init', @model, $(@el)) diff --git a/static/js/app/views/mix/mixItemView.js b/static/js/app/views/mix/mixItemView.js index 466f467..7d9e982 100755 --- a/static/js/app/views/mix/mixItemView.js +++ b/static/js/app/views/mix/mixItemView.js @@ -93,13 +93,13 @@ MixItemView.prototype._setupStateUI = function() { if (this.app.audioController.isPlayingId(this.model.id)) { this.ui.playButton.removeClass("play").removeClass("resume").removeClass("pause"); - this.ui.playButtonIcon.removeClass("icon-play").removeClass("icon-pause"); + this.ui.playButtonIcon.removeClass("fa-play").removeClass("fa-pause"); if (this.mixState === 1) { this.ui.playButton.addClass("pause"); - return this.ui.playButtonIcon.removeClass("icon-play").addClass("icon-pause"); + return this.ui.playButtonIcon.removeClass("fa-play").addClass("fa-pause"); } else if (this.mixState === 2) { this.ui.playButton.addClass("resume"); - return this.ui.playButtonIcon.removeClass("icon-pause").addClass("icon-play"); + return this.ui.playButtonIcon.removeClass("fa-pause").addClass("fa-play"); } } }; diff --git a/static/js/app/views/widgets/headerView.coffee b/static/js/app/views/widgets/headerView.coffee index 7d79018..8b2d6c5 100755 --- a/static/js/app/views/widgets/headerView.coffee +++ b/static/js/app/views/widgets/headerView.coffee @@ -59,12 +59,12 @@ define ["underscore", "marionette", "vent", "utils", "views/widgets/searchView", $(@el).find("#track-description").attr "href", "#" + data.item_url trackPlaying: (data) -> - $(@el).find("#header-play-button-icon").removeClass "icon-play" - $(@el).find("#header-play-button-icon").addClass "icon-pause" + $(@el).find("#header-play-button-icon").removeClass "fa-play" + $(@el).find("#header-play-button-icon").addClass "fa-pause" trackPaused: (data) -> - $(@el).find("#header-play-button-icon").removeClass "icon-pause" - $(@el).find("#header-play-button-icon").addClass "icon-play" + $(@el).find("#header-play-button-icon").removeClass "fa-pause" + $(@el).find("#header-play-button-icon").addClass "fa-play" render: -> $(@el).html @template() diff --git a/static/js/app/views/widgets/headerView.js b/static/js/app/views/widgets/headerView.js index 6bb2cee..00d08bf 100644 --- a/static/js/app/views/widgets/headerView.js +++ b/static/js/app/views/widgets/headerView.js @@ -91,13 +91,13 @@ Code provided under the BSD License: }; HeaderView.prototype.trackPlaying = function(data) { - $(this.el).find("#header-play-button-icon").removeClass("icon-play"); - return $(this.el).find("#header-play-button-icon").addClass("icon-pause"); + $(this.el).find("#header-play-button-icon").removeClass("fa-play"); + return $(this.el).find("#header-play-button-icon").addClass("fa-pause"); }; HeaderView.prototype.trackPaused = function(data) { - $(this.el).find("#header-play-button-icon").removeClass("icon-pause"); - return $(this.el).find("#header-play-button-icon").addClass("icon-play"); + $(this.el).find("#header-play-button-icon").removeClass("fa-pause"); + return $(this.el).find("#header-play-button-icon").addClass("fa-play"); }; HeaderView.prototype.render = function() { diff --git a/templates/views/MixEditView.html b/templates/views/MixEditView.html index 565f54b..296cf93 100755 --- a/templates/views/MixEditView.html +++ b/templates/views/MixEditView.html @@ -46,6 +46,15 @@ + +
{% include "views/_MixEditView_Step_Mix.html" %} @@ -59,14 +68,6 @@
-