From 94c5bf8e0ed9360bf45a29bb465044a170625534 Mon Sep 17 00:00:00 2001 From: Fergal Moran Date: Thu, 4 Jul 2013 19:29:17 +0100 Subject: [PATCH] Pre-branch --- spa/api/v1/UserResource.py | 1 + spa/models/userprofile.py | 17 +++++++++-------- static/js/app/appv2.js | 6 ++++-- static/js/app/models/user/userCollection.js | 9 +++++---- static/js/app/views/user/userItemView.js | 10 +++++----- static/js/app/views/user/userListView.js | 15 ++++++++------- static/js/app/views/widgets/headerView.js | 10 +++++----- 7 files changed, 37 insertions(+), 31 deletions(-) diff --git a/spa/api/v1/UserResource.py b/spa/api/v1/UserResource.py index fe94448..c6d0323 100755 --- a/spa/api/v1/UserResource.py +++ b/spa/api/v1/UserResource.py @@ -105,6 +105,7 @@ class UserResource(BackboneCompatibleResource): queryset = User.objects.all() resource_name = 'user' excludes = ['is_active', 'is_staff', 'is_superuser', 'password'] + ordering = ['mix_count'] authorization = DjangoAuthorization() authentication = Authentication() favourites = fields.ToManyField(MixResource, 'favourites') diff --git a/spa/models/userprofile.py b/spa/models/userprofile.py index 13d0e35..7dddf6f 100755 --- a/spa/models/userprofile.py +++ b/spa/models/userprofile.py @@ -105,14 +105,15 @@ class UserProfile(_BaseModel): def add_follower(self, user): self.followers.add(user) - try: - send_templated_email([user.user], "notification/new_follower", {"profile": self.user}) - except Exception, ex: - self.logger.warning("Unable to send email for new follower") - self.logger.warning("Exception: %s" % ex.message) - self.logger.warning("Host: %s" % settings.EMAIL_HOST) - self.logger.warning("Port: %s" % settings.EMAIL_PORT) - self.logger.warning("Backend: %s" % settings.EMAIL_BACKEND) + if not settings.DEBUG: + try: + send_templated_email([user.user], "notification/new_follower", {"profile": self.user}) + except Exception, ex: + self.logger.warning("Unable to send email for new follower") + self.logger.warning("Exception: %s" % ex.message) + self.logger.warning("Host: %s" % settings.EMAIL_HOST) + self.logger.warning("Port: %s" % settings.EMAIL_PORT) + self.logger.warning("Backend: %s" % settings.EMAIL_BACKEND) def remove_follower(self, user): self.followers.remove(user) diff --git a/static/js/app/appv2.js b/static/js/app/appv2.js index 358fd33..b0b6807 100755 --- a/static/js/app/appv2.js +++ b/static/js/app/appv2.js @@ -1,14 +1,15 @@ -// Generated by CoffeeScript 1.3.3 +// Generated by CoffeeScript 1.6.2 (function() { - define(['backbone', 'marionette', 'vent', 'utils', 'app.lib/router', 'app.lib/panningRegion', 'app.lib/realtimeController', 'app.lib/audioController', 'views/widgets/headerView', 'views/sidebar/sidebarView', 'models/mix/mixCollection'], function(Backbone, Marionette, vent, utils, DssRouter, PanningRegion, RealtimeController, AudioController, HeaderView, SidebarView, MixCollection) { var App, sidebarView; + App = new Marionette.Application(); App.audioController = new AudioController(); App.realtimeController = new RealtimeController(); App.realtimeController.startSocketIO(); App.vent.on("routing:started", function() { var enablePushState, pushState; + console.log("App(vent): routing:started"); enablePushState = true; pushState = !!(enablePushState && window.history && window.history.pushState); @@ -34,6 +35,7 @@ App.addInitializer(function() { $(document).on("click", "a[href]:not([data-bypass])", function(evt) { var href, root; + href = { prop: $(this).prop("href"), attr: $(this).attr("href") diff --git a/static/js/app/models/user/userCollection.js b/static/js/app/models/user/userCollection.js index 3959873..c5f7728 100755 --- a/static/js/app/models/user/userCollection.js +++ b/static/js/app/models/user/userCollection.js @@ -1,16 +1,17 @@ -// Generated by CoffeeScript 1.3.3 +// Generated by CoffeeScript 1.6.2 (function() { 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(['backbone', 'models/user/userItem', 'app.lib/backbone.dss.model.collection'], function(Backbone, UserItem, DssCollection) { - var UserCollection; - UserCollection = (function(_super) { + var UserCollection, _ref; + UserCollection = (function(_super) { __extends(UserCollection, _super); function UserCollection() { - return UserCollection.__super__.constructor.apply(this, arguments); + _ref = UserCollection.__super__.constructor.apply(this, arguments); + return _ref; } UserCollection.prototype.page = 0; diff --git a/static/js/app/views/user/userItemView.js b/static/js/app/views/user/userItemView.js index 1d11633..ffb4988 100755 --- a/static/js/app/views/user/userItemView.js +++ b/static/js/app/views/user/userItemView.js @@ -1,18 +1,18 @@ -// Generated by CoffeeScript 1.3.3 +// Generated by CoffeeScript 1.6.2 (function() { var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __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', 'moment', 'marionette', 'vent', 'text!/tpl/UserListItemView'], function(App, moment, Marionette, vent, Template) { - var UserItemView; - UserItemView = (function(_super) { + var UserItemView, _ref; + UserItemView = (function(_super) { __extends(UserItemView, _super); function UserItemView() { - this.intialize = __bind(this.intialize, this); - return UserItemView.__super__.constructor.apply(this, arguments); + this.intialize = __bind(this.intialize, this); _ref = UserItemView.__super__.constructor.apply(this, arguments); + return _ref; } UserItemView.prototype.template = _.template(Template); diff --git a/static/js/app/views/user/userListView.js b/static/js/app/views/user/userListView.js index c2d61ba..909e6c2 100755 --- a/static/js/app/views/user/userListView.js +++ b/static/js/app/views/user/userListView.js @@ -1,22 +1,20 @@ -// Generated by CoffeeScript 1.3.3 +// Generated by CoffeeScript 1.6.2 (function() { var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __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(['jquery', 'marionette', 'models/user/userCollection', 'views/user/userItemView', 'text!/tpl/UserListView', 'libs/bootstrap/bootpag'], function($, Marionette, UserCollection, UserItemView, Template) { - var UserListView; - UserListView = (function(_super) { + var UserListView, _ref; + UserListView = (function(_super) { __extends(UserListView, _super); function UserListView() { this.doSearch = __bind(this.doSearch, this); - this._fetchCollection = __bind(this._fetchCollection, this); - - this.initialize = __bind(this.initialize, this); - return UserListView.__super__.constructor.apply(this, arguments); + this.initialize = __bind(this.initialize, this); _ref = UserListView.__super__.constructor.apply(this, arguments); + return _ref; } UserListView.prototype.template = _.template(Template); @@ -41,10 +39,12 @@ UserListView.prototype._fetchCollection = function(options) { var _this = this; + this.collection.fetch({ data: options, success: function() { var pag; + console.log("UserListView: Collection fetched"); console.log(_this.collection); pag = $("#page-selection").bootpag({ @@ -64,6 +64,7 @@ UserListView.prototype.doSearch = function() { var query; + console.log("UserListView: doSearch"); query = this.ui.searchText.val(); if (query) { diff --git a/static/js/app/views/widgets/headerView.js b/static/js/app/views/widgets/headerView.js index 0830032..721ea1d 100644 --- a/static/js/app/views/widgets/headerView.js +++ b/static/js/app/views/widgets/headerView.js @@ -1,5 +1,4 @@ -// Generated by CoffeeScript 1.3.3 - +// Generated by CoffeeScript 1.6.2 /* @license @@ -15,13 +14,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", "text!/tpl/HeaderView"], function(_, Marionette, vent, utils, SearchView, Template) { - var HeaderView; - HeaderView = (function(_super) { + var HeaderView, _ref; + HeaderView = (function(_super) { __extends(HeaderView, _super); function HeaderView() { - return HeaderView.__super__.constructor.apply(this, arguments); + _ref = HeaderView.__super__.constructor.apply(this, arguments); + return _ref; } HeaderView.prototype.template = _.template(Template);