From 6f3b199e9a9f99e912a0125a629259d491da599f Mon Sep 17 00:00:00 2001 From: Fergal Moran Date: Mon, 15 Jul 2013 22:23:25 +0100 Subject: [PATCH] Implemented read for notifications --- spa/ajax.py | 99 ++++--------------- static/css/deepsouthsounds.css | 1 + static/js/app/lib/controller.js | 16 ++- static/js/app/lib/router.coffee | 2 +- static/js/app/lib/router.js | 11 +-- .../app/models/activity/activityCollection.js | 11 ++- static/js/app/site.js | 5 + .../js/app/views/activity/activityItemView.js | 9 +- .../views/activity/activityListView.coffee | 1 - .../js/app/views/activity/activityListView.js | 1 - static/js/app/views/mix/mixListView.js | 10 +- .../notifications/notificationsItemView.js | 9 +- .../notificationsListView.coffee | 11 ++- .../notifications/notificationsListView.js | 17 +++- static/js/app/views/sidebar/sidebarView.js | 10 +- static/js/app/views/widgets/headerView.js | 9 +- static/js/app/views/widgets/searchView.js | 11 ++- templates/views/NotificationsListView.html | 2 + 18 files changed, 112 insertions(+), 123 deletions(-) diff --git a/spa/ajax.py b/spa/ajax.py index 48e20b4..c0204d3 100755 --- a/spa/ajax.py +++ b/spa/ajax.py @@ -1,9 +1,9 @@ +from datetime import datetime import os import logging from django.conf.urls import url from django.contrib.auth.decorators import login_required -from django.core import serializers from django.core.exceptions import ObjectDoesNotExist from django.db.models import get_model from django.http import HttpResponse, HttpResponseNotFound @@ -14,13 +14,13 @@ from django.views.decorators.csrf import csrf_exempt from core.utils import live from dss import localsettings, settings -from spa import social -from spa.models import UserProfile, Release, Activity +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 logger = logging.getLogger(__name__) @@ -35,7 +35,6 @@ class AjaxHandler(object): @property def urls(self): pattern_list = [ - url(r'^mix-description/(?P\d+)/$', 'spa.ajax.get_mix_description', name='ajax_mix-description'), url(r'^mix/add_comment/$', 'spa.ajax.mix_add_comment', name='mix_add_comment'), url(r'^mix/comments/(?P\d+)/$', 'spa.ajax.mix_comments', name='ajax_mix_comments'), url(r'^header/$', 'spa.ajax.header', name='header'), @@ -43,9 +42,7 @@ class AjaxHandler(object): url(r'^mix_stream_url/(?P\d+)/$', 'spa.ajax.get_mix_stream_url'), url(r'^release_player/(?P\d+)/$', 'spa.ajax.release_player'), url(r'^live_now_playing/$', 'spa.ajax.live_now_playing'), - url(r'^like/$', 'spa.ajax.like', name='ajax_mix_like'), - url(r'^favourite/$', 'spa.ajax.favourite', name='ajax_mix_favourite'), - url(r'^toggle_follow/$', 'spa.ajax.toggle_follow', name='ajax_toggle_follow'), + url(r'^mark_read/$', 'spa.ajax.mark_read'), url(r'^facebook_post_likes_allowed/$', 'spa.ajax.facebook_post_likes_allowed', name='ajax_facebook_post_likes_allowed'), url(r'^upload_image/(?P\d+)/$', 'spa.ajax.upload_image', name='ajax_upload_image'), @@ -58,12 +55,6 @@ class AjaxHandler(object): ] return pattern_list - def wrap_view(self, view): - def wrapper(request, *args, **kwargs): - return getattr(self, view)(request, *args, **kwargs) - - return wrapper - def _get_json(payload, key='value'): data = { @@ -72,16 +63,17 @@ def _get_json(payload, key='value'): return simplejson.dumps(data) -def get_mix_description(request, mix_id): - return HttpResponse(_get_json('ArgleBargle'), mimetype="application/json") - - @render_to('inc/header.html') def header(request): return HttpResponse(render_to_response('inc/header.html')) def session_play_count(request): + """ + + :param request: + :return: Number of tracks played in this session + """ if not request.user.is_authenticated(): if 'play_count' in request.session: result = simplejson.dumps({ @@ -117,6 +109,7 @@ def get_mix_stream_url(request, mix_id): return HttpResponse(simplejson.dumps(data), mimetype="application/json") except Exception, e: logger.exception("Error getting mix stream url") + return HttpResponse("Error getting mix stream url", status=401) def live_now_playing(request): @@ -167,73 +160,20 @@ def mix_comments(request, mix_id): } -@login_required() -def like(request): - if request.is_ajax(): - if request.method == 'POST': - if request.POST['dataMode'] == 'mix': - mix = Mix.objects.get(pk=request.POST['dataId']) - if mix is not None: - if mix.likes.count() == 0: - uid = social.post_like(request, mix) - mix.likes.add(Activity(user=request.user)) - response = _get_json('Liked') - else: - for like in mix.likes.all(): - uid = like.uid - if uid is not None and uid <> '': - social.delete_like(request, uid) +@login_required +def mark_read(request): + profile = request.user.get_profile() + if profile is not None: + Notification.objects.filter(to_user=profile).update(accepted_date=datetime.now()) + return HttpResponse('Success', status=200) + pass - mix.likes.all().delete() - response = _get_json('Unliked') - mix.save() - return HttpResponse(response) - - -@login_required() -def toggle_follow(request): - response = _get_json('Invalid request') - try: - if request.is_ajax() and request.method == 'POST' and 'userId' in request.POST: - profile = request.user.get_profile() - following = UserProfile.objects.get(user__id=request.POST['userId']) - if following is not None: - if profile.followers is None or (following not in profile.followers.all()): - profile.add_follower(following) - response = _get_json('Followed') - else: - profile.followers.remove(following) - response = _get_json('Unfollowed') - profile.save() - except Exception, ex: - if settings.DEBUG: - response = _get_json(ex.message) - else: - response = _get_json('Error') - - return HttpResponse(response) - - -@login_required() -def favourite(request): - if request.is_ajax(): - if request.method == 'POST': - if request.POST['dataMode'] == 'mix': - mix = Mix.objects.get(pk=request.POST['dataId']) - if mix is not None: - if mix.favourites.count() == 0: - mix.favourites.add(Activity(mix=mix, user=request.user)) - response = _get_json('Favourited') - else: - mix.favourites.all().delete() - response = _get_json('Unfavourited') - mix.save() - return HttpResponse(response) + return HttpResponse('Unauthorized', status=401) @login_required() def facebook_post_likes_allowed(request): - profile = request.user.get_profile(); + profile = request.user.get_profile() if profile is not None: likes_allowed = profile.activity_sharing & UserProfile.ACTIVITY_SHARE_LIKES facebook_allowed = profile.activity_sharing_networks & UserProfile.ACTIVITY_SHARE_NETWORK_FACEBOOK @@ -327,6 +267,7 @@ def lookup_search(request): results = json.dumps(rows) return HttpResponse(results, mimetype='application/json') + @csrf_exempt def lookup(request, source): query = request.GET['query'] if 'query' in request.GET else request.GET['q'] if 'q' in request.GET else '' diff --git a/static/css/deepsouthsounds.css b/static/css/deepsouthsounds.css index 8f1bc2b..0cdcb94 100755 --- a/static/css/deepsouthsounds.css +++ b/static/css/deepsouthsounds.css @@ -637,3 +637,4 @@ img.flag { border-top-color: #ffffff; border-bottom-color: #ffffff; } +.dropdown-menu li > span > a:hover, .dropdown-menu li > span > a:focus, .dropdown-submenu:hover > a diff --git a/static/js/app/lib/controller.js b/static/js/app/lib/controller.js index b28d044..84d939b 100755 --- a/static/js/app/lib/controller.js +++ b/static/js/app/lib/controller.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(['app', 'marionette', 'vent', 'views/chat/chatView', 'models/mix/mixItem', 'views/mix/mixListView', 'views/mix/mixDetailView', 'views/mix/mixEditView', 'models/user/userItem', 'views/user/userListView', 'views/user/userEditView'], function(App, Marionette, vent, ChatView, MixItem, MixListView, MixDetailView, MixEditView, UserItem, UserListView, UserEditView) { - var DssController; - DssController = (function(_super) { + var DssController, _ref; + DssController = (function(_super) { __extends(DssController, _super); function DssController() { - return DssController.__super__.constructor.apply(this, arguments); + _ref = DssController.__super__.constructor.apply(this, arguments); + return _ref; } DssController.prototype.home = function() { @@ -21,6 +22,7 @@ DssController.prototype._showMixList = function(options) { var app; + app = require('app'); app.contentRegion.show(new MixListView(options)); return true; @@ -35,6 +37,7 @@ DssController.prototype.showMix = function(slug) { var app, mix; + console.log("Controller: showMix"); app = require('app'); mix = new MixItem({ @@ -53,6 +56,7 @@ DssController.prototype.uploadMix = function() { var app, mix; + console.log("Controller: mixUpload"); app = require('app'); mix = new MixItem({ @@ -69,6 +73,7 @@ DssController.prototype.editMix = function(slug) { var app, mix; + console.log("Controller: mixEdit"); app = require('app'); mix = new MixItem({ @@ -86,6 +91,7 @@ DssController.prototype.showChat = function() { var app; + console.log("Controller: showChat"); app = require('app'); return app.contentRegion.show(new ChatView()); @@ -93,6 +99,7 @@ DssController.prototype.showUserList = function(type) { var app; + console.log("Controller: showUserList"); app = require('app'); return app.contentRegion.show(new UserListView()); @@ -144,6 +151,7 @@ DssController.prototype.editUser = function() { var app, user; + console.log("Controller: editUser"); app = require('app'); user = new UserItem({ diff --git a/static/js/app/lib/router.coffee b/static/js/app/lib/router.coffee index 8d7752d..8e506e6 100755 --- a/static/js/app/lib/router.coffee +++ b/static/js/app/lib/router.coffee @@ -23,7 +23,7 @@ define ['marionette', 'vent', 'app.lib/controller'], "me": "editUser" initialize: -> - console.log "Router: initializing" + console.log "Router: initialize" @listenTo vent, "navigate:mix", (slug)-> @navigate 'mix/' + slug, true diff --git a/static/js/app/lib/router.js b/static/js/app/lib/router.js index 7d62816..00017b4 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; @@ -35,7 +34,7 @@ }; DssRouter.prototype.initialize = function() { - console.log("Router: initializing"); + console.log("Router: initialize"); return this.listenTo(vent, "navigate:mix", function(slug) { return this.navigate('mix/' + slug, true); }); diff --git a/static/js/app/models/activity/activityCollection.js b/static/js/app/models/activity/activityCollection.js index 73f911a..2ee3d85 100755 --- a/static/js/app/models/activity/activityCollection.js +++ b/static/js/app/models/activity/activityCollection.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', 'vent', 'models/activity/activityItem', 'app.lib/backbone.dss.model.collection'], function(Backbone, vent, ActivityItem, DssCollection) { - var ActivityCollection; - ActivityCollection = (function(_super) { + var ActivityCollection, _ref; + ActivityCollection = (function(_super) { __extends(ActivityCollection, _super); function ActivityCollection() { - return ActivityCollection.__super__.constructor.apply(this, arguments); + _ref = ActivityCollection.__super__.constructor.apply(this, arguments); + return _ref; } ActivityCollection.prototype.model = ActivityItem; @@ -19,8 +20,10 @@ ActivityCollection.prototype.initialize = function() { var _this = this; + return this.listenTo(vent, "model:activity:new", function(url) { var item; + console.log("ActivityCollection: activity:new"); item = new ActivityItem(); return item.fetch({ diff --git a/static/js/app/site.js b/static/js/app/site.js index 1cf8a5f..8d5ee2d 100755 --- a/static/js/app/site.js +++ b/static/js/app/site.js @@ -15,6 +15,11 @@ $(document).ready(function () { } }); +$(document).ajaxError( function(event, xhr, settings){ + //catch the 401's and don't log them, assume app is handling these + console.log("Site: ajaxError"); +}); + $(document).ajaxSend(function (event, xhr, settings) { function getCookie(name) { var cookieValue = null; diff --git a/static/js/app/views/activity/activityItemView.js b/static/js/app/views/activity/activityItemView.js index 03c5046..712af55 100755 --- a/static/js/app/views/activity/activityItemView.js +++ b/static/js/app/views/activity/activityItemView.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(['marionette', 'text!/tpl/ActivityListItemView'], function(Marionette, Template) { - var ActivityItemView; - return ActivityItemView = (function(_super) { + var ActivityItemView, _ref; + return ActivityItemView = (function(_super) { __extends(ActivityItemView, _super); function ActivityItemView() { - return ActivityItemView.__super__.constructor.apply(this, arguments); + _ref = ActivityItemView.__super__.constructor.apply(this, arguments); + return _ref; } ActivityItemView.prototype.template = _.template(Template); diff --git a/static/js/app/views/activity/activityListView.coffee b/static/js/app/views/activity/activityListView.coffee index 9d6193f..cba2e0c 100755 --- a/static/js/app/views/activity/activityListView.coffee +++ b/static/js/app/views/activity/activityListView.coffee @@ -10,7 +10,6 @@ define ['marionette', 'models/activity/activityCollection', 'views/activity/acti itemViewContainer: "#activity-list-container-ul" initialize: -> - console.log "ActivityListView: initialize" @collection = new ActivityCollection @collection.fetch() diff --git a/static/js/app/views/activity/activityListView.js b/static/js/app/views/activity/activityListView.js index 8fd5050..bea4740 100755 --- a/static/js/app/views/activity/activityListView.js +++ b/static/js/app/views/activity/activityListView.js @@ -24,7 +24,6 @@ ActivityListView.prototype.itemViewContainer = "#activity-list-container-ul"; ActivityListView.prototype.initialize = function() { - console.log("ActivityListView: initialize"); this.collection = new ActivityCollection; return this.collection.fetch(); }; diff --git a/static/js/app/views/mix/mixListView.js b/static/js/app/views/mix/mixListView.js index bdd047e..31871c4 100755 --- a/static/js/app/views/mix/mixListView.js +++ b/static/js/app/views/mix/mixListView.js @@ -1,19 +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(['marionette', 'vent', 'models/mix/mixCollection', 'views/mix/mixItemView', 'text!/tpl/MixListView'], function(Marionette, vent, MixCollection, MixItemView, Template) { - var MixListView; + var MixListView, _ref; + MixListView = (function(_super) { var currentMix; __extends(MixListView, _super); function MixListView() { - this.initialize = __bind(this.initialize, this); - return MixListView.__super__.constructor.apply(this, arguments); + this.initialize = __bind(this.initialize, this); _ref = MixListView.__super__.constructor.apply(this, arguments); + return _ref; } MixListView.prototype.template = _.template(Template); @@ -35,6 +36,7 @@ MixListView.prototype.mixPlay = function(model) { var v; + if (currentMix !== -1) { v = this.children.findByModelCid(currentMix); v.mixStop(v.model); diff --git a/static/js/app/views/notifications/notificationsItemView.js b/static/js/app/views/notifications/notificationsItemView.js index c450747..61bef18 100644 --- a/static/js/app/views/notifications/notificationsItemView.js +++ b/static/js/app/views/notifications/notificationsItemView.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(['marionette', 'text!/tpl/NotificationsItemView'], function(Marionette, Template) { - var NotificationsItemView; - return NotificationsItemView = (function(_super) { + var NotificationsItemView, _ref; + return NotificationsItemView = (function(_super) { __extends(NotificationsItemView, _super); function NotificationsItemView() { - return NotificationsItemView.__super__.constructor.apply(this, arguments); + _ref = NotificationsItemView.__super__.constructor.apply(this, arguments); + return _ref; } NotificationsItemView.prototype.template = _.template(Template); diff --git a/static/js/app/views/notifications/notificationsListView.coffee b/static/js/app/views/notifications/notificationsListView.coffee index 3bf3573..0fe85ba 100644 --- a/static/js/app/views/notifications/notificationsListView.coffee +++ b/static/js/app/views/notifications/notificationsListView.coffee @@ -17,13 +17,22 @@ define ['marionette', 'underscore', 'vent', notificationCount: "#notification-count" initialize: -> + #quick and dirty check to see if user is logged in @collection = new NotificationCollection @collection.fetch( success: => $(@ui.notificationCount).text(@collection.meta.is_new) + if @collection.meta.is_new == 0 + $(@ui.notificationSurround).hide() + error: => + $(@ui.notificationSurround).hide() ) showNotifications: -> - console.log("Marking read") + $.ajax + url: '/ajax/mark_read/' + type: 'post' + success: => + $(@ui.notificationSurround).hide() NotificationsListView diff --git a/static/js/app/views/notifications/notificationsListView.js b/static/js/app/views/notifications/notificationsListView.js index 52dae90..300cec8 100644 --- a/static/js/app/views/notifications/notificationsListView.js +++ b/static/js/app/views/notifications/notificationsListView.js @@ -37,13 +37,26 @@ this.collection = new NotificationCollection; return this.collection.fetch({ success: function() { - return $(_this.ui.notificationCount).text(_this.collection.meta.is_new); + $(_this.ui.notificationCount).text(_this.collection.meta.is_new); + if (_this.collection.meta.is_new === 0) { + return $(_this.ui.notificationSurround).hide(); + } + }, + error: function() { + return $(_this.ui.notificationSurround).hide(); } }); }; NotificationsListView.prototype.showNotifications = function() { - return console.log("Marking read"); + var _this = this; + return $.ajax({ + url: '/ajax/mark_read/', + type: 'post', + success: function() { + return $(_this.ui.notificationSurround).hide(); + } + }); }; return NotificationsListView; diff --git a/static/js/app/views/sidebar/sidebarView.js b/static/js/app/views/sidebar/sidebarView.js index a6b1938..402de95 100755 --- a/static/js/app/views/sidebar/sidebarView.js +++ b/static/js/app/views/sidebar/sidebarView.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(['underscore', 'backbone', 'marionette', 'vent', 'views/activity/activityListView', 'views/widgets/nowPlayingView', 'text!/tpl/SidebarView'], function(_, Backbone, Marionette, vent, ActivityListView, NowPlayingView, Template) { - var SidebarView; - SidebarView = (function(_super) { + var SidebarView, _ref; + SidebarView = (function(_super) { __extends(SidebarView, _super); function SidebarView() { - return SidebarView.__super__.constructor.apply(this, arguments); + _ref = SidebarView.__super__.constructor.apply(this, arguments); + return _ref; } SidebarView.prototype.template = _.template(Template); @@ -43,6 +44,7 @@ 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/widgets/headerView.js b/static/js/app/views/widgets/headerView.js index 0bb3969..5be6451 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,14 +14,16 @@ 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; + var HeaderView, _ref; + HeaderView = (function(_super) { var NowrapRegion; __extends(HeaderView, _super); function HeaderView() { - return HeaderView.__super__.constructor.apply(this, arguments); + _ref = HeaderView.__super__.constructor.apply(this, arguments); + return _ref; } NowrapRegion = Marionette.Region.extend({ diff --git a/static/js/app/views/widgets/searchView.js b/static/js/app/views/widgets/searchView.js index cd8d208..975a9a7 100644 --- a/static/js/app/views/widgets/searchView.js +++ b/static/js/app/views/widgets/searchView.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(['jquery', 'underscore', 'libs/bootstrap/bootstrap-typeahead', 'marionette', 'vent', 'text!/tpl/SearchView', 'text!/tpl/SearchResultView'], function($, _, Typeahead, Marionette, vent, Template, SearchResultView) { - var SearchView; - SearchView = (function(_super) { + var SearchView, _ref; + SearchView = (function(_super) { __extends(SearchView, _super); function SearchView() { - return SearchView.__super__.constructor.apply(this, arguments); + _ref = SearchView.__super__.constructor.apply(this, arguments); + return _ref; } SearchView.prototype.template = _.template(Template); @@ -22,6 +23,7 @@ SearchView.prototype.engine = { compile: function(template) { var compiled; + compiled = _.template(template); return { render: function(context) { @@ -33,6 +35,7 @@ SearchView.prototype.onShow = function() { var t; + t = $('#search-text', this.el).typeahead({ name: "search", engine: this.engine, diff --git a/templates/views/NotificationsListView.html b/templates/views/NotificationsListView.html index 496b1c7..8ccf857 100644 --- a/templates/views/NotificationsListView.html +++ b/templates/views/NotificationsListView.html @@ -1,9 +1,11 @@ + {% if user.is_authenticated %} + {% endif %}