mirror of
https://github.com/fergalmoran/dss.git
synced 2026-02-11 10:33:58 +00:00
Removed notifications for anonymous user
This commit is contained in:
@@ -1 +1 @@
|
||||
__author__ = 'fergalm'
|
||||
__author__ = 'fergalm'
|
||||
|
||||
@@ -4,67 +4,6 @@ define(['backbone'], function (Backbone) {
|
||||
this.meta = response.meta || {};
|
||||
this.page_count = Math.ceil(this.meta.total_count / this.meta.limit);
|
||||
return response.objects || response;
|
||||
},
|
||||
/*
|
||||
sync: function (method, model, options) {
|
||||
var headers = {};
|
||||
|
||||
if (Backbone.Tastypie.apiKey && Backbone.Tastypie.apiKey.username) {
|
||||
headers[ 'Authorization' ] = 'ApiKey ' + Backbone.Tastypie.apiKey.username + ':' + Backbone.Tastypie.apiKey.key;
|
||||
}
|
||||
|
||||
if (Backbone.Tastypie.csrfToken) {
|
||||
headers[ 'X-CSRFToken' ] = Backbone.Tastypie.csrfToken;
|
||||
}
|
||||
|
||||
// Keep `headers` for a potential second request
|
||||
headers = _.extend(headers, options.headers);
|
||||
options.headers = headers;
|
||||
|
||||
if (( method === 'create' && Backbone.Tastypie.doGetOnEmptyPostResponse ) ||
|
||||
( method === 'update' && Backbone.Tastypie.doGetOnEmptyPutResponse )) {
|
||||
var dfd = new $.Deferred();
|
||||
|
||||
// Set up 'success' handling
|
||||
var success = options.success;
|
||||
dfd.done(function (resp, textStatus, xhr) {
|
||||
_.isFunction(success) && success(resp);
|
||||
});
|
||||
|
||||
options.success = function (resp, textStatus, xhr) {
|
||||
// If create is successful but doesn't return a response, fire an extra GET.
|
||||
// Otherwise, resolve the deferred (which triggers the original 'success' callbacks).
|
||||
if (!resp && ( xhr.status === 201 || xhr.status === 202 || xhr.status === 204 )) { // 201 CREATED, 202 ACCEPTED or 204 NO CONTENT; response null or empty.
|
||||
var location = xhr.getResponseHeader('Location') || model.id;
|
||||
return Backbone.ajax({
|
||||
url: location,
|
||||
headers: headers,
|
||||
success: dfd.resolve,
|
||||
error: dfd.reject
|
||||
});
|
||||
}
|
||||
else {
|
||||
return dfd.resolveWith(options.context || options, [ resp, textStatus, xhr ]);
|
||||
}
|
||||
};
|
||||
|
||||
// Set up 'error' handling
|
||||
var error = options.error;
|
||||
dfd.fail(function (xhr, textStatus, errorThrown) {
|
||||
_.isFunction(error) && error(xhr.responseText);
|
||||
});
|
||||
|
||||
options.error = function (xhr, textStatus, errorText) {
|
||||
dfd.rejectWith(options.context || options, [ xhr, textStatus, xhr.responseText ]);
|
||||
};
|
||||
|
||||
// Create the request, and make it accessibly by assigning it to the 'request' property on the deferred
|
||||
dfd.request = Backbone.oldSync(method, model, options);
|
||||
return dfd;
|
||||
}
|
||||
|
||||
return Backbone.oldSync(method, model, options);
|
||||
}
|
||||
*/
|
||||
})
|
||||
});
|
||||
|
||||
@@ -36,7 +36,8 @@ define ["underscore", "marionette", "vent", "utils", "views/widgets/searchView",
|
||||
|
||||
onShow: ->
|
||||
@searchRegion.show(new SearchView())
|
||||
@notificationsRegion.show(new NotificationsListView())
|
||||
if com.podnoms.settings.currentUser != -1
|
||||
@notificationsRegion.show(new NotificationsListView())
|
||||
|
||||
login: ->
|
||||
vent.trigger('app:login')
|
||||
|
||||
@@ -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({
|
||||
@@ -60,7 +59,9 @@ Code provided under the BSD License:
|
||||
|
||||
HeaderView.prototype.onShow = function() {
|
||||
this.searchRegion.show(new SearchView());
|
||||
return this.notificationsRegion.show(new NotificationsListView());
|
||||
if (com.podnoms.settings.currentUser !== -1) {
|
||||
return this.notificationsRegion.show(new NotificationsListView());
|
||||
}
|
||||
};
|
||||
|
||||
HeaderView.prototype.login = function() {
|
||||
|
||||
Reference in New Issue
Block a user