From 1acf06e85e96d5f46505c3ffeb039047c03994de Mon Sep 17 00:00:00 2001 From: Fergal Moran Date: Tue, 24 Sep 2013 20:55:12 +0100 Subject: [PATCH] Completed ACE update --- core/tasks.py | 22 +++++++++++++++ spa/ajax.py | 8 +++--- spa/api/v1/UserResource.py | 15 +++-------- spa/signals.py | 6 +---- static/js/app/lib/dssView.coffee | 4 +++ static/js/app/lib/dssView.js | 3 +++ static/js/app/lib/router.js | 9 +++---- static/js/app/lib/social.js | 4 +-- static/js/app/lib/utils.js | 6 ++--- .../notifications/notificationCollection.js | 11 +++----- .../js/app/views/activity/activityItemView.js | 9 +++---- .../js/app/views/activity/activityListView.js | 10 +++---- .../js/app/views/comment/commentListView.js | 10 +++---- static/js/app/views/mix/mixDetailView.js | 10 +++---- static/js/app/views/mix/mixEditView.coffee | 3 ++- static/js/app/views/mix/mixEditView.js | 1 + static/js/app/views/mix/mixItemView.js | 20 +++++++------- .../notifications/notificationsListView.js | 12 ++++----- static/js/app/views/sidebar/sidebarView.js | 10 +++---- static/js/app/views/user/userItemView.coffee | 10 ++----- static/js/app/views/user/userItemView.js | 27 ++++++++----------- static/js/app/views/user/userListView.js | 14 +++++----- static/js/app/views/widgets/headerView.js | 9 +++---- templates/base.html | 8 ------ templates/views/UserListItemView.html | 22 +++++++++------ templates/views/UserProfileView.html | 26 +++++++++++++----- 26 files changed, 142 insertions(+), 147 deletions(-) diff --git a/core/tasks.py b/core/tasks.py index decc041..745f7e7 100755 --- a/core/tasks.py +++ b/core/tasks.py @@ -1,9 +1,11 @@ import shutil from celery.task import task import os +from django.contrib.gis.geoip import GeoIP from core.utils.waveform import generate_waveform from dss import settings from spa.signals import waveform_generated +from spa.models.userprofile import UserProfile @task(time_limit=3600) def create_waveform_task(in_file, uid): @@ -20,3 +22,23 @@ def create_waveform_task(in_file, uid): waveform_generated.send(sender=None, uid=uid) else: print "Outfile is missing" + +@task +def update_geo_info_task(ip_address, profile_id): + try: + ip = '188.141.70.110' if ip_address == '127.0.0.1' else ip_address + if ip: + g = GeoIP() + city = g.city(ip) + country = g.country(ip) + try: + user = UserProfile.objects.get(pk=profile_id) + user.city = city['city'] + user.country = country['country_name'] + user.save() + except ObjectDoesNotExist: + pass + print "Updated user location" + except Exception, e: + print e.message + pass diff --git a/spa/ajax.py b/spa/ajax.py index db8e3e4..297968a 100755 --- a/spa/ajax.py +++ b/spa/ajax.py @@ -4,9 +4,8 @@ import logging from django.conf.urls import url from django.contrib.auth.decorators import login_required -from django.core.exceptions import ObjectDoesNotExist from django.core.files.base import ContentFile -from django.core.files.storage import default_storage, FileSystemStorage +from django.core.files.storage import FileSystemStorage from django.db.models import get_model from django.http import HttpResponse, HttpResponseNotFound from annoying.decorators import render_to @@ -14,18 +13,17 @@ from django.shortcuts import render_to_response from django.utils import simplejson from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_POST +from jfu.http import upload_receive, UploadResponse from core.utils import live -from core.utils.audio import Mp3FileNotFoundException from dss import localsettings, settings from spa.models import UserProfile, Release from spa.models.mix import Mix from spa.models.comment import Comment from core.serialisers import json from core.tasks import create_waveform_task -from core.utils.audio.mp3 import mp3_length from spa.models.notification import Notification -from jfu.http import upload_receive, UploadResponse, JFUResponse + logger = logging.getLogger(__name__) diff --git a/spa/api/v1/UserResource.py b/spa/api/v1/UserResource.py index d57bf23..719c004 100755 --- a/spa/api/v1/UserResource.py +++ b/spa/api/v1/UserResource.py @@ -15,6 +15,7 @@ from spa.models.userprofile import UserProfile from spa.models.mix import Mix from tastypie_msgpack import Serializer from django.contrib.gis.utils import GeoIP +from core.tasks import update_geo_info_task class UserResource(BackboneCompatibleResource): @@ -94,18 +95,8 @@ class UserResource(BackboneCompatibleResource): if 'activity_sharing_comments' in kwargs: del kwargs['activity_sharing_comments'] ret = super(UserResource, self).obj_update(bundle, skip_errors, **kwargs) - - try: - ip = '188.141.70.110' if bundle.request.META['REMOTE_ADDR'] == '127.0.0.1' else bundle.request.META['REMOTE_ADDR'] - if ip: - g = GeoIP() - city = g.city(ip) - country = g.country(ip) - logger.info("Updated user location") - except Exception, e: - logger.error(e.message) - pass - + update_geo_info_task.delay(ip_address=bundle.request.META['REMOTE_ADDR'], + profile_id=bundle.request.user.get_profile().id) return ret def dehydrate_description(self, bundle): diff --git a/spa/signals.py b/spa/signals.py index fa213dc..28553f6 100755 --- a/spa/signals.py +++ b/spa/signals.py @@ -1,13 +1,9 @@ -import threading -from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured -from django.db.models import get_app +from django.core.exceptions import ObjectDoesNotExist from django.db.models.signals import post_save from django.dispatch import Signal from django.contrib.auth.models import User -from south import signals from core.utils.audio.mp3 import mp3_length -from dss import settings from spa.models.userprofile import UserProfile from spa.models.mix import Mix diff --git a/static/js/app/lib/dssView.coffee b/static/js/app/lib/dssView.coffee index 2aebdaa..c413b0a 100644 --- a/static/js/app/lib/dssView.coffee +++ b/static/js/app/lib/dssView.coffee @@ -5,7 +5,11 @@ define ['marionette', 'utils'], renderCheckbox: (value) -> return (if value then "checked" else "") + isMe: (id) -> + return utils.isMe(id) + humanise: (date)-> moment(date).fromNow() + DssView \ No newline at end of file diff --git a/static/js/app/lib/dssView.js b/static/js/app/lib/dssView.js index 184606c..ea2ac54 100644 --- a/static/js/app/lib/dssView.js +++ b/static/js/app/lib/dssView.js @@ -17,6 +17,9 @@ renderCheckbox: function(value) { return (value ? "checked" : ""); }, + isMe: function(id) { + return utils.isMe(id); + }, humanise: function(date) { return moment(date).fromNow(); } diff --git a/static/js/app/lib/router.js b/static/js/app/lib/router.js index cab145c..8db89e9 100755 --- a/static/js/app/lib/router.js +++ b/static/js/app/lib/router.js @@ -1,17 +1,16 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 (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(['marionette', 'vent', 'app.lib/controller'], function(Marionette, vent, Controller) { - var DssRouter, _ref; - + var DssRouter; return DssRouter = (function(_super) { + __extends(DssRouter, _super); function DssRouter() { - _ref = DssRouter.__super__.constructor.apply(this, arguments); - return _ref; + return DssRouter.__super__.constructor.apply(this, arguments); } DssRouter.prototype.controller = new Controller; diff --git a/static/js/app/lib/social.js b/static/js/app/lib/social.js index 7aa2151..f5039b2 100644 --- a/static/js/app/lib/social.js +++ b/static/js/app/lib/social.js @@ -1,5 +1,6 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 (function() { + define(['jquery', 'utils'], function($, utils) { return { postFacebookLike: function(mixId) { @@ -13,7 +14,6 @@ }, sharePageToTwitter: function(model) { var loc, title; - loc = $(this).attr("href"); title = $(this).attr("title"); return window.open("http://twitter.com/share?url=" + "http://" + window.location.host + "/" + model.get("item_url") + "&text=" + model.get("title"), "twitterwindow", "height=450, width=550, top=" + ($(window).height() / 2 - 225) + ", left=" + $(window).width() / 2 + ", toolbar=0, location=0, menubar=0, directories=0, scrollbars=0"); diff --git a/static/js/app/lib/utils.js b/static/js/app/lib/utils.js index 5b2e648..9f9aabf 100755 --- a/static/js/app/lib/utils.js +++ b/static/js/app/lib/utils.js @@ -1,5 +1,6 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 (function() { + define(['jquery', 'bootstrap', 'toastr'], function($, bootstrap, toastr) { return { modal: function(url) { @@ -22,7 +23,6 @@ }, checkPlayCount: function() { var _this = this; - if (document.cookie.indexOf("sessionId")) { $.getJSON("/ajax/session_play_count", function(data) { console.log("utils: got playcount"); @@ -48,7 +48,6 @@ generateGuid: function() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) { var r, v; - r = Math.random() * 16 | 0; v = (c === "x" ? r : r & 0x3 | 0x8); return v.toString(16); @@ -56,7 +55,6 @@ }, downloadURL: function(url) { var iframe; - iframe = document.getElementById("hiddenDownloader"); if (iframe === null) { iframe = document.createElement("iframe"); diff --git a/static/js/app/models/notifications/notificationCollection.js b/static/js/app/models/notifications/notificationCollection.js index ad394cc..38a9d17 100644 --- a/static/js/app/models/notifications/notificationCollection.js +++ b/static/js/app/models/notifications/notificationCollection.js @@ -1,17 +1,16 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 (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', 'vent', 'models/notifications/notificationItem', 'app.lib/backbone.dss.model.collection'], function(Backbone, vent, NotificationItem, DssCollection) { - var NotificationCollection, _ref; - + var NotificationCollection; NotificationCollection = (function(_super) { + __extends(NotificationCollection, _super); function NotificationCollection() { - _ref = NotificationCollection.__super__.constructor.apply(this, arguments); - return _ref; + return NotificationCollection.__super__.constructor.apply(this, arguments); } NotificationCollection.prototype.page = 0; @@ -26,10 +25,8 @@ NotificationCollection.prototype.initialize = function() { var _this = this; - return this.listenTo(vent, "model:notification:new", function(url) { var item; - console.log("NotificationCollection: notification:new"); item = new NotificationItem(); return item.fetch({ diff --git a/static/js/app/views/activity/activityItemView.js b/static/js/app/views/activity/activityItemView.js index 482626d..ac6af07 100755 --- a/static/js/app/views/activity/activityItemView.js +++ b/static/js/app/views/activity/activityItemView.js @@ -1,17 +1,16 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 (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(['marionette', 'text!/tpl/ActivityListItemView'], function(Marionette, Template) { - var ActivityItemView, _ref; - + var ActivityItemView; return ActivityItemView = (function(_super) { + __extends(ActivityItemView, _super); function ActivityItemView() { - _ref = ActivityItemView.__super__.constructor.apply(this, arguments); - return _ref; + return ActivityItemView.__super__.constructor.apply(this, arguments); } ActivityItemView.prototype.template = _.template(Template); diff --git a/static/js/app/views/activity/activityListView.js b/static/js/app/views/activity/activityListView.js index 2573ed5..10057ba 100755 --- a/static/js/app/views/activity/activityListView.js +++ b/static/js/app/views/activity/activityListView.js @@ -1,17 +1,16 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 (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(['marionette', 'models/activity/activityCollection', 'views/activity/activityItemView', 'text!/tpl/ActivityListView'], function(Marionette, ActivityCollection, ActivityItemView, Template) { - var ActivityListView, _ref; - + var ActivityListView; ActivityListView = (function(_super) { + __extends(ActivityListView, _super); function ActivityListView() { - _ref = ActivityListView.__super__.constructor.apply(this, arguments); - return _ref; + return ActivityListView.__super__.constructor.apply(this, arguments); } ActivityListView.prototype.template = _.template(Template); @@ -31,7 +30,6 @@ ActivityListView.prototype.appendHtml = function(collectionView, itemView, index) { var children, childrenContainer; - childrenContainer = (collectionView.itemViewContainer ? collectionView.$(collectionView.itemViewContainer) : collectionView.$el); children = childrenContainer.children(); if (children.size() <= index) { diff --git a/static/js/app/views/comment/commentListView.js b/static/js/app/views/comment/commentListView.js index d3bd942..8aba1ae 100755 --- a/static/js/app/views/comment/commentListView.js +++ b/static/js/app/views/comment/commentListView.js @@ -1,17 +1,16 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 (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(['marionette', 'models/comment/commentItem', 'views/comment/commentItemView', 'text!/tpl/CommentListView'], function(Marionette, CommentItem, CommentItemView, Template) { - var CommentListView, _ref; - + var CommentListView; CommentListView = (function(_super) { + __extends(CommentListView, _super); function CommentListView() { - _ref = CommentListView.__super__.constructor.apply(this, arguments); - return _ref; + return CommentListView.__super__.constructor.apply(this, arguments); } CommentListView.prototype.template = _.template(Template); @@ -34,7 +33,6 @@ CommentListView.prototype.addComment = function() { var _this = this; - console.log("CommentListView: addComment"); this.collection.create({ mix_id: this.collection.mix.get("id"), diff --git a/static/js/app/views/mix/mixDetailView.js b/static/js/app/views/mix/mixDetailView.js index 56aa935..c5ba62b 100644 --- a/static/js/app/views/mix/mixDetailView.js +++ b/static/js/app/views/mix/mixDetailView.js @@ -1,17 +1,16 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 (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(['marionette', 'models/mix/mixItem', 'views/mix/mixItemView', 'text!/tpl/MixDetailView'], function(Marionette, MixItem, MixItemView, Template) { - var MixDetailView, _ref; - + var MixDetailView; MixDetailView = (function(_super) { + __extends(MixDetailView, _super); function MixDetailView() { - _ref = MixDetailView.__super__.constructor.apply(this, arguments); - return _ref; + return MixDetailView.__super__.constructor.apply(this, arguments); } MixDetailView.prototype.template = _.template(Template); @@ -23,7 +22,6 @@ MixDetailView.prototype.onRender = function() { var view; - view = new MixItemView({ tagName: "div", className: "mix-listing audio-listing-single", diff --git a/static/js/app/views/mix/mixEditView.coffee b/static/js/app/views/mix/mixEditView.coffee index 02e3664..273498b 100755 --- a/static/js/app/views/mix/mixEditView.coffee +++ b/static/js/app/views/mix/mixEditView.coffee @@ -32,6 +32,7 @@ define ['app.lib/editableView', 'moment', 'utils', 'libs/backbone/backbone.sypho @state++; $("#div-upload-mix", @el).hide() @checkRedirect() + @setupImageEditable el: @ui.image showbuttons: false @@ -45,7 +46,7 @@ define ['app.lib/editableView', 'moment', 'utils', 'libs/backbone/backbone.sypho @sendImage = false parent = this if not @model.id - #$("#mix-details", @el).hide() + $("#mix-details", @el).hide() $("#upload-hash", @el).val @guid else $("#div-upload-mix", @el).hide() diff --git a/static/js/app/views/mix/mixEditView.js b/static/js/app/views/mix/mixEditView.js index 4fca735..43351ee 100755 --- a/static/js/app/views/mix/mixEditView.js +++ b/static/js/app/views/mix/mixEditView.js @@ -74,6 +74,7 @@ this.sendImage = false; parent = this; if (!this.model.id) { + $("#mix-details", this.el).hide(); $("#upload-hash", this.el).val(this.guid); } else { $("#div-upload-mix", this.el).hide(); diff --git a/static/js/app/views/mix/mixItemView.js b/static/js/app/views/mix/mixItemView.js index a4fd4c8..4e602db 100755 --- a/static/js/app/views/mix/mixItemView.js +++ b/static/js/app/views/mix/mixItemView.js @@ -1,22 +1,26 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 (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(['moment', 'app', 'vent', 'marionette', 'utils', 'models/comment/commentCollection', 'views/comment/commentListView', 'text!/tpl/MixListItemView'], function(moment, App, vent, Marionette, utils, CommentsCollection, CommentsListView, Template) { - var MixItemView, _ref; - + var MixItemView; MixItemView = (function(_super) { + __extends(MixItemView, _super); function MixItemView() { this.doStart = __bind(this.doStart, this); + this.renderComments = __bind(this.renderComments, this); + this.renderGenres = __bind(this.renderGenres, this); + this.onRender = __bind(this.onRender, this); - this.initialize = __bind(this.initialize, this); _ref = MixItemView.__super__.constructor.apply(this, arguments); - return _ref; + + this.initialize = __bind(this.initialize, this); + return MixItemView.__super__.constructor.apply(this, arguments); } MixItemView.prototype.template = _.template(Template); @@ -50,7 +54,6 @@ MixItemView.prototype.onRender = function() { var id, totalDuration, totalDurationText; - id = this.model.get('id'); if (this.model.get('duration')) { totalDuration = moment.duration(this.model.get('duration'), "seconds"); @@ -71,7 +74,6 @@ MixItemView.prototype.renderGenres = function() { var el; - el = this.el; $.each(this.model.get("genre-list"), function(data) { $("#genre-list", el).append('' + this.text + ''); @@ -82,7 +84,6 @@ MixItemView.prototype.renderComments = function() { var comments; - comments = new CommentsCollection(); comments.url = this.model.get("resource_uri") + "comments/"; comments.mix_id = this.model.id; @@ -90,7 +91,6 @@ comments.fetch({ success: function(data) { var content; - content = new CommentsListView({ collection: comments }).render(); @@ -139,7 +139,6 @@ MixItemView.prototype.mixFavourite = function() { var app; - console.log("MixItemView: favouriteMix"); app = require('app'); vent.trigger("mix:favourite", this.model); @@ -154,7 +153,6 @@ MixItemView.prototype.mixShare = function(e) { var mode; - console.log("MixItemView: shareMix"); mode = $(e.currentTarget).data("mode"); console.log("MixItemView: " + mode); diff --git a/static/js/app/views/notifications/notificationsListView.js b/static/js/app/views/notifications/notificationsListView.js index b793b03..03e4b96 100644 --- a/static/js/app/views/notifications/notificationsListView.js +++ b/static/js/app/views/notifications/notificationsListView.js @@ -1,18 +1,18 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 (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(['marionette', 'underscore', 'vent', 'utils', 'models/notifications/notificationCollection', 'views/notifications/notificationsItemView', 'text!/tpl/NotificationsListView'], function(Marionette, _, vent, utils, NotificationCollection, NotificationsItemView, Template) { - var NotificationsListView, _ref; - + var NotificationsListView; NotificationsListView = (function(_super) { + __extends(NotificationsListView, _super); function NotificationsListView() { - this.initialize = __bind(this.initialize, this); _ref = NotificationsListView.__super__.constructor.apply(this, arguments); - return _ref; + this.initialize = __bind(this.initialize, this); + return NotificationsListView.__super__.constructor.apply(this, arguments); } NotificationsListView.prototype.template = _.template(Template); @@ -34,7 +34,6 @@ NotificationsListView.prototype.initialize = function() { var _this = this; - this.collection = new NotificationCollection; return this.collection.fetch({ success: function() { @@ -67,7 +66,6 @@ NotificationsListView.prototype.showNotifications = function() { var _this = this; - return $.ajax({ url: '/ajax/mark_read/', type: 'post', diff --git a/static/js/app/views/sidebar/sidebarView.js b/static/js/app/views/sidebar/sidebarView.js index 992c56e..6b567ce 100755 --- a/static/js/app/views/sidebar/sidebarView.js +++ b/static/js/app/views/sidebar/sidebarView.js @@ -1,17 +1,16 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 (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(['underscore', 'backbone', 'marionette', 'vent', 'views/activity/activityListView', 'views/widgets/nowPlayingView', 'text!/tpl/SidebarView'], function(_, Backbone, Marionette, vent, ActivityListView, NowPlayingView, Template) { - var SidebarView, _ref; - + var SidebarView; SidebarView = (function(_super) { + __extends(SidebarView, _super); function SidebarView() { - _ref = SidebarView.__super__.constructor.apply(this, arguments); - return _ref; + return SidebarView.__super__.constructor.apply(this, arguments); } SidebarView.prototype.template = _.template(Template); @@ -44,7 +43,6 @@ SidebarView.prototype.liveStarted = function() { var _this = this; - console.log("SidebarView: livePlay"); $.getJSON("ajax/live_now_playing/", function(data) { $(_this.topRegion.el).show(); diff --git a/static/js/app/views/user/userItemView.coffee b/static/js/app/views/user/userItemView.coffee index 64b79f9..08fca2c 100755 --- a/static/js/app/views/user/userItemView.coffee +++ b/static/js/app/views/user/userItemView.coffee @@ -5,17 +5,11 @@ define ['app', 'moment', 'app.lib/dssView', 'vent', 'text!/tpl/UserListItemView' className: "row" events: - "click #follow-button": "followUser" - "click #follow-button-login": "promptLogin" + "click #follow-button": -> vent.trigger("user:follow", @model) + "click #follow-button-login": -> vent.trigger("app:login", @model) initialize: => @listenTo(@model, 'change:is_following', @render) - followUser: -> - console.log("UserItemView: followUser") - vent.trigger("user:follow", @model) - - promptLogin:-> - vent.trigger("app:login", @model) UserItemView diff --git a/static/js/app/views/user/userItemView.js b/static/js/app/views/user/userItemView.js index 033ae23..466b6d0 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.6.2 +// Generated by CoffeeScript 1.3.3 (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', 'app.lib/dssView', 'vent', 'text!/tpl/UserListItemView'], function(App, moment, DssView, vent, Template) { - var UserItemView, _ref; - + var UserItemView; UserItemView = (function(_super) { + __extends(UserItemView, _super); function UserItemView() { - this.initialize = __bind(this.initialize, this); _ref = UserItemView.__super__.constructor.apply(this, arguments); - return _ref; + this.initialize = __bind(this.initialize, this); + return UserItemView.__super__.constructor.apply(this, arguments); } UserItemView.prototype.template = _.template(Template); @@ -20,23 +20,18 @@ UserItemView.prototype.className = "row"; UserItemView.prototype.events = { - "click #follow-button": "followUser", - "click #follow-button-login": "promptLogin" + "click #follow-button": function() { + return vent.trigger("user:follow", this.model); + }, + "click #follow-button-login": function() { + return vent.trigger("app:login", this.model); + } }; UserItemView.prototype.initialize = function() { return this.listenTo(this.model, 'change:is_following', this.render); }; - UserItemView.prototype.followUser = function() { - console.log("UserItemView: followUser"); - return vent.trigger("user:follow", this.model); - }; - - UserItemView.prototype.promptLogin = function() { - return vent.trigger("app:login", this.model); - }; - return UserItemView; })(DssView); diff --git a/static/js/app/views/user/userListView.js b/static/js/app/views/user/userListView.js index 701a8c2..a4d1c2a 100755 --- a/static/js/app/views/user/userListView.js +++ b/static/js/app/views/user/userListView.js @@ -1,20 +1,22 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 (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', 'bootpag'], function($, Marionette, UserCollection, UserItemView, Template) { - var UserListView, _ref; - + var UserListView; 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); _ref = UserListView.__super__.constructor.apply(this, arguments); - return _ref; + + this.initialize = __bind(this.initialize, this); + return UserListView.__super__.constructor.apply(this, arguments); } UserListView.prototype.template = _.template(Template); @@ -41,7 +43,6 @@ UserListView.prototype._fetchCollection = function(options) { var _this = this; - return this.collection.fetch({ data: options, success: function() { @@ -52,7 +53,6 @@ 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 378a608..dc7053b 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.3.3 + /* @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({ diff --git a/templates/base.html b/templates/base.html index 7b21a8a..8e8615b 100755 --- a/templates/base.html +++ b/templates/base.html @@ -8,14 +8,6 @@ {% load static %} {% compress css %} - {% comment %} - - - - - - {% endcomment %} - diff --git a/templates/views/UserListItemView.html b/templates/views/UserListItemView.html index aa4a4e4..17155cc 100755 --- a/templates/views/UserListItemView.html +++ b/templates/views/UserListItemView.html @@ -33,20 +33,20 @@
- Avatar Image + Avatar Image
+ + + <% if (isMe(id)) { %>   <%= display_name %> - - <% if (isMe(id)) { %> + <% } else { %> + <% } %>
@@ -89,13 +95,13 @@  Last Seen: <%= humanise(last_login) %>
{% if user.is_authenticated %} - {% else %} {% endif %} diff --git a/templates/views/UserProfileView.html b/templates/views/UserProfileView.html index 2892ade..1b95fd0 100644 --- a/templates/views/UserProfileView.html +++ b/templates/views/UserProfileView.html @@ -10,6 +10,7 @@ alt="Avatar Image" src="<%= avatar_image %>"> +
@@ -48,22 +49,32 @@
- + {% comment %} + {% endcomment %}
@@ -114,8 +126,8 @@
Location
- Cork - Ireland + <%= city %> + <%= country %>