mirror of
https://github.com/fergalmoran/dss.git
synced 2026-02-05 23:54:31 +00:00
Added notification for comments
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import models
|
||||
from spa.models._basemodel import _BaseModel
|
||||
from spa.models import _BaseModel, UserProfile
|
||||
from spa.models.notification import Notification
|
||||
from spa.models.mix import Mix
|
||||
|
||||
|
||||
class Comment(_BaseModel):
|
||||
class Meta:
|
||||
app_label = 'spa'
|
||||
@@ -17,3 +17,21 @@ class Comment(_BaseModel):
|
||||
def get_absolute_url(self):
|
||||
return '/comment/%i' % self.id
|
||||
|
||||
def create_notification(self):
|
||||
notification = Notification()
|
||||
notification.to_user = self.mix.user.user
|
||||
notification.notification_url = self.mix.get_absolute_url()
|
||||
notification.verb = "Commented on"
|
||||
notification.target = self.mix.title
|
||||
|
||||
if self.user is not None:
|
||||
notification.from_user = self.user.get_profile()
|
||||
notification.notification_text = "%s %s %s" % (
|
||||
self.user.get_profile().get_nice_name(), notification.verb, self.mix.title
|
||||
)
|
||||
else:
|
||||
notification.notification_text = "%s %s %s" % (
|
||||
"Anonymouse", notification.verb, self.mix.title
|
||||
)
|
||||
|
||||
notification.save()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from django.contrib.auth.models import User
|
||||
import threading
|
||||
from django.db import models
|
||||
from core.realtime.notification import post_notification
|
||||
@@ -17,7 +18,7 @@ class NotificationThread(threading.Thread):
|
||||
|
||||
|
||||
class Notification(_BaseModel):
|
||||
to_user = models.ForeignKey(UserProfile, related_name='to_notications')
|
||||
to_user = models.ForeignKey(User, related_name='to_notications')
|
||||
from_user = models.ForeignKey(UserProfile, related_name='notifications', null=True, blank=True)
|
||||
date = models.DateTimeField(auto_now=True)
|
||||
|
||||
|
||||
@@ -1,137 +1,140 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
(function() {
|
||||
|
||||
define(['backbone', 'marionette', 'vent', 'utils', 'app.lib/social', 'app.lib/router', 'app.lib/panningRegion', 'app.lib/realtimeController', 'app.lib/audioController', 'models/user/userItem', 'models/mix/mixCollection', 'views/widgets/headerView', 'views/sidebar/sidebarView'], function(Backbone, Marionette, vent, utils, social, DssRouter, PanningRegion, RealtimeController, AudioController, UserItem, MixCollection, HeaderView, SidebarView) {
|
||||
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);
|
||||
Backbone.history.start({
|
||||
pushState: pushState,
|
||||
hashChange: true
|
||||
define(['backbone', 'marionette', 'vent', 'utils', 'app.lib/social', 'app.lib/router', 'app.lib/panningRegion', 'app.lib/realtimeController', 'app.lib/audioController', 'models/user/userItem', 'models/mix/mixCollection', 'views/widgets/headerView', 'views/sidebar/sidebarView'], function(Backbone, Marionette, vent, utils, social, DssRouter, PanningRegion, RealtimeController, AudioController, UserItem, MixCollection, HeaderView, SidebarView) {
|
||||
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);
|
||||
Backbone.history.start({
|
||||
pushState: pushState,
|
||||
hashChange: true
|
||||
});
|
||||
return true;
|
||||
});
|
||||
return true;
|
||||
});
|
||||
App.addRegions({
|
||||
headerRegion: "#header",
|
||||
contentRegion: {
|
||||
selector: "#content"
|
||||
},
|
||||
footerRegion: "#footer",
|
||||
sidebarRegion: "#sidebar"
|
||||
});
|
||||
App.addInitializer(function() {
|
||||
console.log("App: routing starting");
|
||||
App.Router = new DssRouter();
|
||||
return App.vent.trigger("routing:started");
|
||||
});
|
||||
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")
|
||||
};
|
||||
root = location.protocol + "//" + location.host + (App.root || '/');
|
||||
if (href.prop.slice(0, root.length) === root) {
|
||||
evt.preventDefault();
|
||||
App.Router.navigate(href.attr, true);
|
||||
App.addRegions({
|
||||
headerRegion: "#header",
|
||||
contentRegion: {
|
||||
selector: "#content"
|
||||
},
|
||||
footerRegion: "#footer",
|
||||
sidebarRegion: "#sidebar"
|
||||
});
|
||||
App.addInitializer(function() {
|
||||
console.log("App: routing starting");
|
||||
App.Router = new DssRouter();
|
||||
return App.vent.trigger("routing:started");
|
||||
});
|
||||
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")
|
||||
};
|
||||
root = location.protocol + "//" + location.host + (App.root || '/');
|
||||
if (href.prop.slice(0, root.length) === root) {
|
||||
evt.preventDefault();
|
||||
App.Router.navigate(href.attr, true);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
});
|
||||
App.addInitializer(function() {
|
||||
this.listenTo(vent, "app:login", function() {
|
||||
utils.modal("/dlg/LoginView");
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
});
|
||||
App.addInitializer(function() {
|
||||
this.listenTo(vent, "app:login", function() {
|
||||
utils.modal("/dlg/LoginView");
|
||||
return true;
|
||||
});
|
||||
this.listenTo(vent, "app:donate", function() {
|
||||
console.log("App: donate");
|
||||
utils.modal("/dlg/Donate");
|
||||
return true;
|
||||
});
|
||||
this.listenTo(vent, "mix:favourite", function(model) {
|
||||
console.log("App(vent): mix:favourite");
|
||||
model.save('favourited', !model.get('favourited'), {
|
||||
patch: true
|
||||
});
|
||||
return true;
|
||||
});
|
||||
this.listenTo(vent, "mix:like", function(model, id, success, favourite) {
|
||||
console.log("App(vent): mix:like");
|
||||
model.save('liked', !model.get('liked'), {
|
||||
patch: true
|
||||
this.listenTo(vent, "app:donate", function() {
|
||||
console.log("App: donate");
|
||||
utils.modal("/dlg/Donate");
|
||||
return true;
|
||||
});
|
||||
return true;
|
||||
});
|
||||
this.listenTo(vent, "mix:delete", function(model) {
|
||||
console.log("App(vent): mix:like");
|
||||
return utils.messageBox("/dlg/DeleteMixConfirm", {
|
||||
yes: function() {
|
||||
console.log("Controller: mixDeleteYES!!");
|
||||
mix.destroy();
|
||||
return Backbone.history.navigate("/", {
|
||||
trigger: true
|
||||
});
|
||||
},
|
||||
no: function() {
|
||||
return console.log("Controller: mixDeleteNO!!");
|
||||
}
|
||||
this.listenTo(vent, "mix:favourite", function(model) {
|
||||
console.log("App(vent): mix:favourite");
|
||||
model.save('favourited', !model.get('favourited'), {
|
||||
patch: true
|
||||
});
|
||||
return true;
|
||||
});
|
||||
});
|
||||
this.listenTo(vent, "user:follow", function(model) {
|
||||
var target, user,
|
||||
_this = this;
|
||||
console.log("App(vent): user:follow");
|
||||
user = new UserItem({
|
||||
id: com.podnoms.settings.currentUser
|
||||
this.listenTo(vent, "mix:like", function(model, id, success, favourite) {
|
||||
console.log("App(vent): mix:like");
|
||||
model.save('liked', !model.get('liked'), {
|
||||
patch: true
|
||||
});
|
||||
return true;
|
||||
});
|
||||
target = com.podnoms.settings.urlRoot + "user/" + model.get("id") + "/";
|
||||
user.fetch({
|
||||
success: function() {
|
||||
var f, newFollowers;
|
||||
if (!model.get("is_following")) {
|
||||
newFollowers = user.get("following").concat([target]);
|
||||
user.save({
|
||||
"following": newFollowers,
|
||||
"is_following": true,
|
||||
patch: true
|
||||
this.listenTo(vent, "mix:delete", function(model) {
|
||||
console.log("App(vent): mix:like");
|
||||
return utils.messageBox("/dlg/DeleteMixConfirm", {
|
||||
yes: function() {
|
||||
console.log("Controller: mixDeleteYES!!");
|
||||
mix.destroy();
|
||||
return Backbone.history.navigate("/", {
|
||||
trigger: true
|
||||
});
|
||||
model.set("is_following", true);
|
||||
} else {
|
||||
f = user.get("following");
|
||||
f.splice(f.indexOf(target), 1);
|
||||
user.save({
|
||||
"following": f,
|
||||
"is_following": false,
|
||||
patch: true
|
||||
});
|
||||
model.set("is_following", false);
|
||||
},
|
||||
no: function() {
|
||||
return console.log("Controller: mixDeleteNO!!");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
this.listenTo(vent, "user:follow", function(model) {
|
||||
var target, user,
|
||||
_this = this;
|
||||
console.log("App(vent): user:follow");
|
||||
user = new UserItem({
|
||||
id: com.podnoms.settings.currentUser
|
||||
});
|
||||
target = com.podnoms.settings.urlRoot + "user/" + model.get("id") + "/";
|
||||
user.fetch({
|
||||
success: function() {
|
||||
var f, newFollowers;
|
||||
if (!model.get("is_following")) {
|
||||
newFollowers = user.get("following").concat([target]);
|
||||
user.save({
|
||||
"following": newFollowers,
|
||||
"is_following": true,
|
||||
patch: true
|
||||
});
|
||||
model.set("is_following", true);
|
||||
} else {
|
||||
f = user.get("following");
|
||||
f.splice(f.indexOf(target), 1);
|
||||
user.save({
|
||||
"following": f,
|
||||
"is_following": false,
|
||||
patch: true
|
||||
});
|
||||
model.set("is_following", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
});
|
||||
return this.listenTo(vent, "mix:share", function(mode, model) {
|
||||
console.log("App(vent): mix:share (" + mode + ")");
|
||||
if (mode === "facebook") {
|
||||
social.sharePageToFacebook(model);
|
||||
} else if (mode === "twitter") {
|
||||
social.sharePageToTwitter(model);
|
||||
} else if (mode === "embed") {
|
||||
social.generateEmbedCode(model);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return true;
|
||||
});
|
||||
return this.listenTo(vent, "mix:share", function(mode, model) {
|
||||
console.log("App(vent): mix:share (" + mode + ")");
|
||||
if (mode === "facebook") {
|
||||
social.sharePageToFacebook(model);
|
||||
} else if (mode === "twitter") {
|
||||
social.sharePageToTwitter(model);
|
||||
} else if (mode === "embed") {
|
||||
social.generateEmbedCode(model);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
App.headerRegion.show(new HeaderView());
|
||||
sidebarView = new SidebarView();
|
||||
App.sidebarRegion.show(sidebarView);
|
||||
return App;
|
||||
});
|
||||
App.headerRegion.show(new HeaderView());
|
||||
sidebarView = new SidebarView();
|
||||
App.sidebarRegion.show(sidebarView);
|
||||
return App;
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
@@ -27,6 +27,9 @@ define ['app', 'marionette', 'vent', 'utils'
|
||||
@showMixList({stream: true})
|
||||
|
||||
showMixListType: (type) ->
|
||||
@showMixList({order_by: type})
|
||||
|
||||
showMixListGenre: (type) ->
|
||||
@showMixList({genres__slug: type, order_by: 'latest'})
|
||||
|
||||
showMix: (slug)->
|
||||
|
||||
@@ -1,217 +1,226 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
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; };
|
||||
(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', 'utils', 'views/mix/mixListLayout', 'views/mix/mixListView', 'views/mix/mixDetailView', 'views/mix/mixEditView', 'views/user/userProfileView', 'views/user/userListView', 'views/user/userEditView', 'models/mix/mixCollection', 'models/mix/mixItem', 'models/user/userItem'], function(App, Marionette, vent, utils, MixListLayout, MixListView, MixDetailView, MixEditView, UserProfileView, UserListView, UserEditView, MixCollection, MixItem, UserItem) {
|
||||
var DssController;
|
||||
DssController = (function(_super) {
|
||||
define(['app', 'marionette', 'vent', 'utils', 'views/mix/mixListLayout', 'views/mix/mixListView', 'views/mix/mixDetailView', 'views/mix/mixEditView', 'views/user/userProfileView', 'views/user/userListView', 'views/user/userEditView', 'models/mix/mixCollection', 'models/mix/mixItem', 'models/user/userItem'], function(App, Marionette, vent, utils, MixListLayout, MixListView, MixDetailView, MixEditView, UserProfileView, UserListView, UserEditView, MixCollection, MixItem, UserItem) {
|
||||
var DssController;
|
||||
DssController = (function(_super) {
|
||||
|
||||
__extends(DssController, _super);
|
||||
__extends(DssController, _super);
|
||||
|
||||
function DssController() {
|
||||
return DssController.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
function DssController() {
|
||||
return DssController.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
DssController.prototype.initialize = function() {
|
||||
return this.listenTo(vent, "mix:random", this.showRandomMix);
|
||||
};
|
||||
DssController.prototype.initialize = function() {
|
||||
return this.listenTo(vent, "mix:random", this.showRandomMix);
|
||||
};
|
||||
|
||||
DssController.prototype.home = function() {
|
||||
console.log("Controller: home");
|
||||
return this.showMixList();
|
||||
};
|
||||
DssController.prototype.home = function() {
|
||||
console.log("Controller: home");
|
||||
return this.showMixList();
|
||||
};
|
||||
|
||||
DssController.prototype.doLogin = function() {
|
||||
return vent.trigger('app:login');
|
||||
};
|
||||
DssController.prototype.doLogin = function() {
|
||||
return vent.trigger('app:login');
|
||||
};
|
||||
|
||||
DssController.prototype.showMixList = function(options) {
|
||||
var app;
|
||||
app = require('app');
|
||||
app.contentRegion.show(new MixListLayout(options || {
|
||||
order_by: 'latest'
|
||||
}));
|
||||
return vent.trigger('mix:showlist', options || {
|
||||
order_by: 'latest'
|
||||
});
|
||||
};
|
||||
DssController.prototype.showMixList = function(options) {
|
||||
var app;
|
||||
app = require('app');
|
||||
app.contentRegion.show(new MixListLayout(options || {
|
||||
order_by: 'latest'
|
||||
}));
|
||||
return vent.trigger('mix:showlist', options || {
|
||||
order_by: 'latest'
|
||||
});
|
||||
};
|
||||
|
||||
DssController.prototype.showStreamList = function() {
|
||||
return this.showMixList({
|
||||
stream: true
|
||||
});
|
||||
};
|
||||
DssController.prototype.showStreamList = function() {
|
||||
return this.showMixList({
|
||||
stream: true
|
||||
});
|
||||
};
|
||||
|
||||
DssController.prototype.showMixListType = function(type) {
|
||||
return this.showMixList({
|
||||
genres__slug: type,
|
||||
order_by: 'latest'
|
||||
});
|
||||
};
|
||||
DssController.prototype.showMixListType = function(type) {
|
||||
return this.showMixList({
|
||||
order_by: type
|
||||
});
|
||||
};
|
||||
|
||||
DssController.prototype.showMix = function(slug) {
|
||||
var app, mix;
|
||||
console.log("Controller: showMix");
|
||||
app = require('app');
|
||||
mix = new MixItem({
|
||||
id: slug
|
||||
});
|
||||
return mix.fetch({
|
||||
success: function() {
|
||||
return app.contentRegion.show(new MixDetailView({
|
||||
model: mix
|
||||
}));
|
||||
}
|
||||
});
|
||||
};
|
||||
DssController.prototype.showMixListGenre = function(type) {
|
||||
return this.showMixList({
|
||||
genres__slug: type,
|
||||
order_by: 'latest'
|
||||
});
|
||||
};
|
||||
|
||||
DssController.prototype.showRandomMix = function() {
|
||||
var app, mix;
|
||||
console.log("Controller: showRandomMix");
|
||||
app = require('app');
|
||||
mix = new MixItem({
|
||||
id: 'random'
|
||||
});
|
||||
mix.fetch({
|
||||
success: function() {
|
||||
return app.contentRegion.show(new MixDetailView({
|
||||
model: mix
|
||||
}));
|
||||
}
|
||||
});
|
||||
return Backbone.history.navigate("/random", {
|
||||
trigger: false
|
||||
});
|
||||
};
|
||||
DssController.prototype.showMix = function(slug) {
|
||||
var app, mix;
|
||||
console.log("Controller: showMix");
|
||||
app = require('app');
|
||||
mix = new MixItem({
|
||||
id: slug
|
||||
});
|
||||
return mix.fetch({
|
||||
success: function() {
|
||||
return app.contentRegion.show(new MixDetailView({
|
||||
model: mix
|
||||
}));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
DssController.prototype.uploadMix = function() {
|
||||
var app, mix;
|
||||
console.log("Controller: mixUpload");
|
||||
app = require('app');
|
||||
mix = new MixItem({
|
||||
title: '',
|
||||
description: '',
|
||||
mix_image: com.podnoms.settings.staticUrl + 'img/default-track.png',
|
||||
download_allowed: true,
|
||||
is_featured: false
|
||||
});
|
||||
app.contentRegion.show(new MixEditView({
|
||||
model: mix
|
||||
}));
|
||||
return true;
|
||||
};
|
||||
DssController.prototype.showRandomMix = function() {
|
||||
var app, mix;
|
||||
console.log("Controller: showRandomMix");
|
||||
app = require('app');
|
||||
mix = new MixItem({
|
||||
id: 'random'
|
||||
});
|
||||
mix.fetch({
|
||||
success: function() {
|
||||
return app.contentRegion.show(new MixDetailView({
|
||||
model: mix
|
||||
}));
|
||||
}
|
||||
});
|
||||
return Backbone.history.navigate("/random", {
|
||||
trigger: false
|
||||
});
|
||||
};
|
||||
|
||||
DssController.prototype.editMix = function(slug) {
|
||||
var app, mix;
|
||||
console.log("Controller: mixEdit");
|
||||
app = require('app');
|
||||
mix = new MixItem({
|
||||
id: slug
|
||||
});
|
||||
mix.fetch({
|
||||
success: function() {
|
||||
return app.contentRegion.show(new MixEditView({
|
||||
model: mix
|
||||
}));
|
||||
}
|
||||
});
|
||||
return true;
|
||||
};
|
||||
DssController.prototype.uploadMix = function() {
|
||||
var app, mix;
|
||||
console.log("Controller: mixUpload");
|
||||
app = require('app');
|
||||
mix = new MixItem({
|
||||
title: '',
|
||||
description: '',
|
||||
mix_image: com.podnoms.settings.staticUrl + 'img/default-track.png',
|
||||
download_allowed: true,
|
||||
is_featured: false
|
||||
});
|
||||
app.contentRegion.show(new MixEditView({
|
||||
model: mix
|
||||
}));
|
||||
return true;
|
||||
};
|
||||
|
||||
DssController.prototype.showChat = function() {
|
||||
var app;
|
||||
console.log("Controller: showChat");
|
||||
app = require('app');
|
||||
return app.contentRegion.show(new ChatView());
|
||||
};
|
||||
DssController.prototype.editMix = function(slug) {
|
||||
var app, mix;
|
||||
console.log("Controller: mixEdit");
|
||||
app = require('app');
|
||||
mix = new MixItem({
|
||||
id: slug
|
||||
});
|
||||
mix.fetch({
|
||||
success: function() {
|
||||
return app.contentRegion.show(new MixEditView({
|
||||
model: mix
|
||||
}));
|
||||
}
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
DssController.prototype.showUserList = function() {
|
||||
var app;
|
||||
console.log("Controller: showUserList");
|
||||
app = require('app');
|
||||
return app.contentRegion.show(new UserListView());
|
||||
};
|
||||
DssController.prototype.showChat = function() {
|
||||
var app;
|
||||
console.log("Controller: showChat");
|
||||
app = require('app');
|
||||
return app.contentRegion.show(new ChatView());
|
||||
};
|
||||
|
||||
DssController.prototype.showUserProfile = function(slug) {
|
||||
var app, user;
|
||||
console.log("Controller: showUserProfile");
|
||||
app = require('app');
|
||||
user = new UserItem({
|
||||
id: slug
|
||||
});
|
||||
return user.fetch({
|
||||
success: function() {
|
||||
return app.contentRegion.show(new UserProfileView({
|
||||
model: user
|
||||
}));
|
||||
},
|
||||
error: function(a, b, c) {
|
||||
return console.log("Error fetching user");
|
||||
}
|
||||
});
|
||||
};
|
||||
DssController.prototype.showUserList = function() {
|
||||
var app;
|
||||
console.log("Controller: showUserList");
|
||||
app = require('app');
|
||||
return app.contentRegion.show(new UserListView());
|
||||
};
|
||||
|
||||
DssController.prototype.showUserFavourites = function(slug) {
|
||||
console.log("Controller: showUserFavourites");
|
||||
return this.showMixList({
|
||||
order_by: 'latest',
|
||||
favourites__slug: slug
|
||||
});
|
||||
};
|
||||
DssController.prototype.showUserProfile = function(slug) {
|
||||
var app, user;
|
||||
console.log("Controller: showUserProfile");
|
||||
app = require('app');
|
||||
user = new UserItem({
|
||||
id: slug
|
||||
});
|
||||
return user.fetch({
|
||||
success: function() {
|
||||
return app.contentRegion.show(new UserProfileView({
|
||||
model: user
|
||||
}));
|
||||
},
|
||||
error: function(a, b, c) {
|
||||
return console.log("Error fetching user");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
DssController.prototype.showUserLikes = function(slug) {
|
||||
console.log("Controller: showUserLikes");
|
||||
return this.showMixList({
|
||||
order_by: 'latest',
|
||||
likes__slug: slug
|
||||
});
|
||||
};
|
||||
DssController.prototype.showUserFavourites = function(slug) {
|
||||
console.log("Controller: showUserFavourites");
|
||||
return this.showMixList({
|
||||
order_by: 'latest',
|
||||
favourites__slug: slug
|
||||
});
|
||||
};
|
||||
|
||||
DssController.prototype.showUserMixes = function(slug) {
|
||||
console.log("Controller: showUserMixes");
|
||||
return this.showMixList({
|
||||
order_by: 'latest',
|
||||
user: slug
|
||||
});
|
||||
};
|
||||
DssController.prototype.showUserLikes = function(slug) {
|
||||
console.log("Controller: showUserLikes");
|
||||
return this.showMixList({
|
||||
order_by: 'latest',
|
||||
likes__slug: slug
|
||||
});
|
||||
};
|
||||
|
||||
DssController.prototype.showUserFollowing = function(slug) {
|
||||
var app;
|
||||
console.log("Controller: showUserFollowing");
|
||||
app = require('app');
|
||||
return app.contentRegion.show(new UserListView({
|
||||
followers__slug: slug
|
||||
}));
|
||||
};
|
||||
DssController.prototype.showUserMixes = function(slug) {
|
||||
console.log("Controller: showUserMixes");
|
||||
return this.showMixList({
|
||||
order_by: 'latest',
|
||||
user: slug
|
||||
});
|
||||
};
|
||||
|
||||
DssController.prototype.showUserFollowers = function(slug) {
|
||||
var app;
|
||||
console.log("Controller: showUserFollowers");
|
||||
app = require('app');
|
||||
return app.contentRegion.show(new UserListView({
|
||||
following__slug: slug
|
||||
}));
|
||||
};
|
||||
DssController.prototype.showUserFollowing = function(slug) {
|
||||
var app;
|
||||
console.log("Controller: showUserFollowing");
|
||||
app = require('app');
|
||||
return app.contentRegion.show(new UserListView({
|
||||
followers__slug: slug
|
||||
}));
|
||||
};
|
||||
|
||||
DssController.prototype.editUser = function() {
|
||||
var app, user;
|
||||
console.log("Controller: editUser");
|
||||
app = require('app');
|
||||
user = new UserItem({
|
||||
id: com.podnoms.settings.currentUser
|
||||
});
|
||||
user.fetch({
|
||||
success: function() {
|
||||
return app.contentRegion.show(new UserEditView({
|
||||
model: user
|
||||
}));
|
||||
}
|
||||
});
|
||||
return true;
|
||||
};
|
||||
DssController.prototype.showUserFollowers = function(slug) {
|
||||
var app;
|
||||
console.log("Controller: showUserFollowers");
|
||||
app = require('app');
|
||||
return app.contentRegion.show(new UserListView({
|
||||
following__slug: slug
|
||||
}));
|
||||
};
|
||||
|
||||
DssController.prototype.editUser = function() {
|
||||
var app, user;
|
||||
console.log("Controller: editUser");
|
||||
app = require('app');
|
||||
user = new UserItem({
|
||||
id: com.podnoms.settings.currentUser
|
||||
});
|
||||
user.fetch({
|
||||
success: function() {
|
||||
return app.contentRegion.show(new UserEditView({
|
||||
model: user
|
||||
}));
|
||||
}
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
return DssController;
|
||||
|
||||
})(Marionette.Controller);
|
||||
return DssController;
|
||||
});
|
||||
|
||||
})(Marionette.Controller);
|
||||
return DssController;
|
||||
});
|
||||
}).call(this);
|
||||
|
||||
@@ -9,6 +9,7 @@ define ['marionette', 'vent', 'app.lib/controller'],
|
||||
"mix/upload": "uploadMix",
|
||||
"mixes": "showMixList",
|
||||
"mixes/:type": "showMixListType"
|
||||
"mixes/genre/:type": "showMixListGenre"
|
||||
"mix/:slug": "showMix"
|
||||
"mix/edit/:slug": "editMix",
|
||||
|
||||
|
||||
@@ -1,49 +1,53 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
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; };
|
||||
(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;
|
||||
return DssRouter = (function(_super) {
|
||||
define(['marionette', 'vent', 'app.lib/controller'], function(Marionette, vent, Controller) {
|
||||
var DssRouter;
|
||||
return DssRouter = (function(_super) {
|
||||
|
||||
__extends(DssRouter, _super);
|
||||
__extends(DssRouter, _super);
|
||||
|
||||
function DssRouter() {
|
||||
return DssRouter.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
function DssRouter() {
|
||||
return DssRouter.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
DssRouter.prototype.controller = new Controller;
|
||||
DssRouter.prototype.controller = new Controller;
|
||||
|
||||
DssRouter.prototype.appRoutes = {
|
||||
"": "home",
|
||||
"/": "home",
|
||||
"mix/upload": "uploadMix",
|
||||
"mixes": "showMixList",
|
||||
"mixes/:type": "showMixListType",
|
||||
"mix/:slug": "showMix",
|
||||
"mix/edit/:slug": "editMix",
|
||||
"chat": "showChat",
|
||||
"random": "showRandomMix",
|
||||
"stream": "showStreamList",
|
||||
"login": "doLogin",
|
||||
"users": "showUserList",
|
||||
"user/:slug/favourites": "showUserFavourites",
|
||||
"user/:slug/likes": "showUserLikes",
|
||||
"user/:slug/followers": "showUserFollowers",
|
||||
"user/:slug/following": "showUserFollowing",
|
||||
"user/:slug/mixes": "showUserMixes",
|
||||
"user/:slug": "showUserProfile",
|
||||
"me": "editUser"
|
||||
};
|
||||
DssRouter.prototype.appRoutes = {
|
||||
"": "home",
|
||||
"/": "home",
|
||||
"mix/upload": "uploadMix",
|
||||
"mixes": "showMixList",
|
||||
"mixes/:type": "showMixListType",
|
||||
"mixes/genre/:type": "showMixListGenre",
|
||||
"mix/:slug": "showMix",
|
||||
"mix/edit/:slug": "editMix",
|
||||
"chat": "showChat",
|
||||
"random": "showRandomMix",
|
||||
"stream": "showStreamList",
|
||||
"login": "doLogin",
|
||||
"users": "showUserList",
|
||||
"user/:slug/favourites": "showUserFavourites",
|
||||
"user/:slug/likes": "showUserLikes",
|
||||
"user/:slug/followers": "showUserFollowers",
|
||||
"user/:slug/following": "showUserFollowing",
|
||||
"user/:slug/mixes": "showUserMixes",
|
||||
"user/:slug": "showUserProfile",
|
||||
"me": "editUser"
|
||||
};
|
||||
|
||||
DssRouter.prototype.initialize = function() {
|
||||
console.log("Router: initialize");
|
||||
return this.listenTo(vent, "navigate:mix", function(slug) {
|
||||
return this.navigate('mix/' + slug, true);
|
||||
});
|
||||
};
|
||||
DssRouter.prototype.initialize = function() {
|
||||
console.log("Router: initialize");
|
||||
return this.listenTo(vent, "navigate:mix", function(slug) {
|
||||
return this.navigate('mix/' + slug, true);
|
||||
});
|
||||
};
|
||||
|
||||
return DssRouter;
|
||||
return DssRouter;
|
||||
|
||||
})(Marionette.AppRouter);
|
||||
});
|
||||
})(Marionette.AppRouter);
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
@@ -1,57 +1,60 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
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; };
|
||||
(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(['utils', 'vent', 'models/comment/commentCollection', 'models/comment/commentItem', 'models/genre/genreCollection', 'models/genre/genreItem', 'app.lib/backbone.dss.model'], function(utils, vent, CommentCollection, CommentItem, GenreCollection, GenreItem, DssModel) {
|
||||
var MixItem;
|
||||
return MixItem = (function(_super) {
|
||||
define(['utils', 'vent', 'models/comment/commentCollection', 'models/comment/commentItem', 'models/genre/genreCollection', 'models/genre/genreItem', 'app.lib/backbone.dss.model'], function(utils, vent, CommentCollection, CommentItem, GenreCollection, GenreItem, DssModel) {
|
||||
var MixItem;
|
||||
return MixItem = (function(_super) {
|
||||
|
||||
__extends(MixItem, _super);
|
||||
__extends(MixItem, _super);
|
||||
|
||||
function MixItem() {
|
||||
return MixItem.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
MixItem.prototype.urlRoot = com.podnoms.settings.urlRoot + "mix/";
|
||||
|
||||
MixItem.prototype.relations = [
|
||||
{
|
||||
type: Backbone.Many,
|
||||
key: "comments",
|
||||
relatedModel: CommentItem,
|
||||
collectionType: CommentCollection
|
||||
}, {
|
||||
type: Backbone.Many,
|
||||
key: "genres",
|
||||
relatedModel: GenreItem,
|
||||
collectionType: GenreCollection
|
||||
function MixItem() {
|
||||
return MixItem.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
];
|
||||
|
||||
MixItem.prototype.addComment = function(comment, success, error) {
|
||||
var c;
|
||||
c = void 0;
|
||||
if (comment) {
|
||||
return c = this.get("comments").create({
|
||||
comment: comment,
|
||||
mix_id: this.get("slug")
|
||||
MixItem.prototype.urlRoot = com.podnoms.settings.urlRoot + "mix/";
|
||||
|
||||
MixItem.prototype.relations = [
|
||||
{
|
||||
type: Backbone.Many,
|
||||
key: "comments",
|
||||
relatedModel: CommentItem,
|
||||
collectionType: CommentCollection
|
||||
}, {
|
||||
success: function() {
|
||||
return success();
|
||||
},
|
||||
error: function() {
|
||||
return error();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return error("Comment cannot be empty");
|
||||
}
|
||||
};
|
||||
type: Backbone.Many,
|
||||
key: "genres",
|
||||
relatedModel: GenreItem,
|
||||
collectionType: GenreCollection
|
||||
}
|
||||
];
|
||||
|
||||
MixItem;
|
||||
MixItem.prototype.addComment = function(comment, success, error) {
|
||||
var c;
|
||||
c = void 0;
|
||||
if (comment) {
|
||||
return c = this.get("comments").create({
|
||||
comment: comment,
|
||||
mix_id: this.get("slug")
|
||||
}, {
|
||||
success: function() {
|
||||
return success();
|
||||
},
|
||||
error: function() {
|
||||
return error();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return error("Comment cannot be empty");
|
||||
}
|
||||
};
|
||||
|
||||
MixItem;
|
||||
|
||||
|
||||
return MixItem;
|
||||
return MixItem;
|
||||
|
||||
})(DssModel);
|
||||
});
|
||||
})(DssModel);
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
@@ -1,71 +1,72 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
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; };
|
||||
(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.lib/editableView', 'vent', 'moment', 'utils', 'backbone.syphon', 'text!/tpl/MixEditView', 'models/genre/genreCollection', 'lib/jdataview', 'ace', 'dropzone', 'wizard', 'ajaxfileupload', 'jquery.fileupload', 'lib/ace/uncompressed/select2'], function(EditableView, vent, moment, utils, Syphon, Template, GenreCollection, jDataView) {
|
||||
var MixEditView;
|
||||
return MixEditView = (function(_super) {
|
||||
define(['app.lib/editableView', 'vent', 'moment', 'utils', 'backbone.syphon', 'text!/tpl/MixEditView', 'models/genre/genreCollection', 'lib/jdataview', 'ace', 'dropzone', 'wizard', 'ajaxfileupload', 'jquery.fileupload', 'lib/ace/uncompressed/select2'], function(EditableView, vent, moment, utils, Syphon, Template, GenreCollection, jDataView) {
|
||||
var MixEditView;
|
||||
return MixEditView = (function(_super) {
|
||||
|
||||
__extends(MixEditView, _super);
|
||||
__extends(MixEditView, _super);
|
||||
|
||||
function MixEditView() {
|
||||
this.saveChanges = __bind(this.saveChanges, this);
|
||||
return MixEditView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
MixEditView.prototype.template = _.template(Template);
|
||||
|
||||
MixEditView.prototype.events = {
|
||||
"click #login": "login",
|
||||
"change input[name='...']": "imageChanged"
|
||||
};
|
||||
|
||||
MixEditView.prototype.ui = {
|
||||
image: "#mix-image",
|
||||
progress: "#mix-upload-progress",
|
||||
uploadError: '#mix-upload-error'
|
||||
};
|
||||
|
||||
MixEditView.prototype.initialize = function() {
|
||||
this.guid = utils.generateGuid();
|
||||
this.uploadState = 0;
|
||||
this.detailsEntered = false;
|
||||
return this.patch = false;
|
||||
};
|
||||
|
||||
MixEditView.prototype.onRender = function() {
|
||||
var wizard,
|
||||
_this = this;
|
||||
console.log("MixEditView: onRender js");
|
||||
$('.progress', this.el).hide();
|
||||
this.sendImage = false;
|
||||
if (!this.model.id) {
|
||||
$('input[name="upload-hash"]', this.el).val(this.guid);
|
||||
} else {
|
||||
$('#header-step1', this.el).remove();
|
||||
$('#step1', this.el).remove();
|
||||
$('#header-step2', this.el).addClass("active");
|
||||
$('#step2', this.el).addClass("active");
|
||||
$('.progress', this.el).hide();
|
||||
this.patch = true;
|
||||
this.uploadState = 2;
|
||||
function MixEditView() {
|
||||
this.saveChanges = __bind(this.saveChanges, this);
|
||||
return MixEditView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
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.fadeIn();
|
||||
$('#step1').addClass("alert-danger");
|
||||
return false;
|
||||
|
||||
MixEditView.prototype.template = _.template(Template);
|
||||
|
||||
MixEditView.prototype.events = {
|
||||
"click #login": "login",
|
||||
"change input[name='...']": "imageChanged"
|
||||
};
|
||||
|
||||
MixEditView.prototype.ui = {
|
||||
image: "#mix-image",
|
||||
progress: "#mix-upload-progress",
|
||||
uploadError: '#mix-upload-error'
|
||||
};
|
||||
|
||||
MixEditView.prototype.initialize = function() {
|
||||
this.guid = utils.generateGuid();
|
||||
this.uploadState = 0;
|
||||
this.detailsEntered = false;
|
||||
return this.patch = false;
|
||||
};
|
||||
|
||||
MixEditView.prototype.onRender = function() {
|
||||
var wizard,
|
||||
_this = this;
|
||||
console.log("MixEditView: onRender js");
|
||||
$('.progress', this.el).hide();
|
||||
this.sendImage = false;
|
||||
if (!this.model.id) {
|
||||
$('input[name="upload-hash"]', this.el).val(this.guid);
|
||||
} else {
|
||||
return true;
|
||||
$('#header-step1', this.el).remove();
|
||||
$('#step1', this.el).remove();
|
||||
$('#header-step2', this.el).addClass("active");
|
||||
$('#step2', this.el).addClass("active");
|
||||
$('.progress', this.el).hide();
|
||||
this.patch = true;
|
||||
this.uploadState = 2;
|
||||
}
|
||||
}).on("finished", function(e) {
|
||||
console.log("Finished");
|
||||
return _this.saveChanges();
|
||||
});
|
||||
$("#mix-upload-form", this.el).dropzone({
|
||||
previewTemplate: '<div class=\"dz-preview dz-file-preview\">\n\
|
||||
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.fadeIn();
|
||||
$('#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: '<div class=\"dz-preview dz-file-preview\">\n\
|
||||
<div class=\"dz-details\">\n\
|
||||
<div class=\"dz-filename\"><span data-dz-name></span></div>\n\
|
||||
<div class=\"dz-size\" data-dz-size></div>\n\
|
||||
@@ -78,147 +79,149 @@ define(['app.lib/editableView', 'vent', 'moment', 'utils', 'backbone.syphon', 't
|
||||
<div class=\"dz-error-mark\"><span></span></div>\n\
|
||||
<div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n\
|
||||
</div>',
|
||||
dictDefaultMessage: '<span class="bigger-150 bolder"><i class="icon-caret-right red"></i> Drop files</span> to upload\
|
||||
dictDefaultMessage: '<span class="bigger-150 bolder"><i class="icon-caret-right red"></i> Drop files</span> to upload\
|
||||
<span class="smaller-80 grey">(or click)</span> <br />\
|
||||
<i class="upload-icon icon-cloud-upload blue icon-3x"></i>',
|
||||
uploadprogress: function(e, progress, bytesSent) {
|
||||
var percentage;
|
||||
$('.progress', _this.el).hide();
|
||||
_this.uploadState = 1;
|
||||
percentage = Math.round(progress);
|
||||
console.log("Progressing");
|
||||
return _this.ui.progress.css("width", percentage + "%").parent().attr("data-percent", percentage + "%");
|
||||
},
|
||||
complete: function() {
|
||||
_this.uploadState = 2;
|
||||
return _this.checkRedirect();
|
||||
}
|
||||
});
|
||||
$("#genres", this.el).select2({
|
||||
placeholder: "Start typing and choose from list or create your own.",
|
||||
minimumInputLength: 1,
|
||||
multiple: true,
|
||||
ajax: {
|
||||
url: "/ajax/lookup/genre/",
|
||||
dataType: "json",
|
||||
data: function(term, page) {
|
||||
return {
|
||||
q: term
|
||||
};
|
||||
uploadprogress: function(e, progress, bytesSent) {
|
||||
var percentage;
|
||||
$('.progress', _this.el).hide();
|
||||
_this.uploadState = 1;
|
||||
percentage = Math.round(progress);
|
||||
console.log("Progressing");
|
||||
return _this.ui.progress.css("width", percentage + "%").parent().attr("data-percent", percentage + "%");
|
||||
},
|
||||
results: function(data, page) {
|
||||
return {
|
||||
results: data
|
||||
};
|
||||
complete: function() {
|
||||
_this.uploadState = 2;
|
||||
return _this.checkRedirect();
|
||||
}
|
||||
},
|
||||
formatResult: function(genre) {
|
||||
return genre.description;
|
||||
},
|
||||
formatSelection: function(genre) {
|
||||
return "<div class='select2-user-result'>" + genre.description + "</div>";
|
||||
},
|
||||
initSelection: function(element, callback) {
|
||||
var genres, result;
|
||||
console.log("MixEditView: genres:initSelection");
|
||||
result = [];
|
||||
genres = _this.model.get("genres");
|
||||
if (genres !== undefined) {
|
||||
genres.each(function(data) {
|
||||
return result.push({
|
||||
id: data.get("id"),
|
||||
description: data.get("description")
|
||||
});
|
||||
$("#genres", this.el).select2({
|
||||
placeholder: "Start typing and choose from list or create your own.",
|
||||
minimumInputLength: 1,
|
||||
multiple: true,
|
||||
ajax: {
|
||||
url: "/ajax/lookup/genre/",
|
||||
dataType: "json",
|
||||
data: function(term, page) {
|
||||
return {
|
||||
q: term
|
||||
};
|
||||
},
|
||||
results: function(data, page) {
|
||||
return {
|
||||
results: data
|
||||
};
|
||||
}
|
||||
},
|
||||
formatResult: function(genre) {
|
||||
return genre.description;
|
||||
},
|
||||
formatSelection: function(genre) {
|
||||
return "<div class='select2-user-result'>" + genre.description + "</div>";
|
||||
},
|
||||
initSelection: function(element, callback) {
|
||||
var genres, result;
|
||||
console.log("MixEditView: genres:initSelection");
|
||||
result = [];
|
||||
genres = _this.model.get("genres");
|
||||
if (genres !== undefined) {
|
||||
genres.each(function(data) {
|
||||
return result.push({
|
||||
id: data.get("id"),
|
||||
description: data.get("description")
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
return callback(result);
|
||||
}
|
||||
return callback(result);
|
||||
}
|
||||
}, "createSearchChoice: (term, data) ->\n if $(data).filter(->\n @description.localeCompare(term) is 0\n ).length is 0\n id: term\n text: term");
|
||||
return true;
|
||||
};
|
||||
}, "createSearchChoice: (term, data) ->\n if $(data).filter(->\n @description.localeCompare(term) is 0\n ).length is 0\n id: term\n text: term");
|
||||
return true;
|
||||
};
|
||||
|
||||
MixEditView.prototype.saveChanges = function() {
|
||||
var flair,
|
||||
_this = this;
|
||||
console.log("MixEditView: saveChanges");
|
||||
this.model.set(Syphon.serialize($("#mix-details-form", this.el)[0]));
|
||||
flair = Syphon.serialize($("#mix-flair-form", this.el)[0], {
|
||||
exclude: ["...", ""]
|
||||
});
|
||||
this.model.set(flair);
|
||||
this.model.set("upload-hash", this.guid);
|
||||
this.model.set("upload-extension", $("#upload-extension", this.el).val());
|
||||
this.model.set("genres", new GenreCollection());
|
||||
$.each($("#genres", this.el).select2("data"), function(i, item) {
|
||||
"if @model.get(\"genres\") is undefined\n @model.set(\"genres\", new GenreCollection())";
|
||||
return _this.model.get("genres").add({
|
||||
id: item.id,
|
||||
description: item.text
|
||||
MixEditView.prototype.saveChanges = function() {
|
||||
var flair,
|
||||
_this = this;
|
||||
console.log("MixEditView: saveChanges");
|
||||
this.model.set(Syphon.serialize($("#mix-details-form", this.el)[0]));
|
||||
flair = Syphon.serialize($("#mix-flair-form", this.el)[0], {
|
||||
exclude: ["...", ""]
|
||||
});
|
||||
});
|
||||
if (!this.sendImage) {
|
||||
this.model.unset("mix_image");
|
||||
}
|
||||
this.model.unset("comments");
|
||||
this._saveChanges({
|
||||
patch: this.patch,
|
||||
success: function() {
|
||||
if (_this.sendImage) {
|
||||
$.ajaxFileUpload({
|
||||
url: "/ajax/upload_mix_image/" + _this.model.get("id") + "/",
|
||||
secureuri: false,
|
||||
fileElementId: "input[name='...']",
|
||||
success: function(data, status) {
|
||||
if (typeof data.error !== "undefined") {
|
||||
if (data.error !== "") {
|
||||
return alert(data.error);
|
||||
this.model.set(flair);
|
||||
this.model.set("upload-hash", this.guid);
|
||||
this.model.set("upload-extension", $("#upload-extension", this.el).val());
|
||||
this.model.set("genres", new GenreCollection());
|
||||
$.each($("#genres", this.el).select2("data"), function(i, item) {
|
||||
"if @model.get(\"genres\") is undefined\n @model.set(\"genres\", new GenreCollection())";
|
||||
return _this.model.get("genres").add({
|
||||
id: item.id,
|
||||
description: item.text
|
||||
});
|
||||
});
|
||||
if (!this.sendImage) {
|
||||
this.model.unset("mix_image");
|
||||
}
|
||||
this.model.unset("comments");
|
||||
this._saveChanges({
|
||||
patch: this.patch,
|
||||
success: function() {
|
||||
if (_this.sendImage) {
|
||||
$.ajaxFileUpload({
|
||||
url: "/ajax/upload_mix_image/" + _this.model.get("id") + "/",
|
||||
secureuri: false,
|
||||
fileElementId: "input[name='...']",
|
||||
success: function(data, status) {
|
||||
if (typeof data.error !== "undefined") {
|
||||
if (data.error !== "") {
|
||||
return alert(data.error);
|
||||
} else {
|
||||
return alert(data.msg);
|
||||
}
|
||||
} else {
|
||||
return alert(data.msg);
|
||||
$("#mix-upload-wizard", _this.el).hide();
|
||||
_this.detailsEntered = true;
|
||||
return _this.checkRedirect();
|
||||
}
|
||||
} else {
|
||||
$("#mix-upload-wizard", _this.el).hide();
|
||||
_this.detailsEntered = true;
|
||||
return _this.checkRedirect();
|
||||
},
|
||||
error: function(data, status, e) {
|
||||
return utils.showError(e);
|
||||
}
|
||||
},
|
||||
error: function(data, status, e) {
|
||||
return utils.showError(e);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("#mix-upload-wizard", _this.el).hide();
|
||||
_this.detailsEntered = true;
|
||||
_this.checkRedirect();
|
||||
});
|
||||
} else {
|
||||
$("#mix-upload-wizard", _this.el).hide();
|
||||
_this.detailsEntered = true;
|
||||
_this.checkRedirect();
|
||||
}
|
||||
return true;
|
||||
},
|
||||
error: function(model, response) {
|
||||
return utils.showError("Error", "Something went wrong<br />Nerd stuff is: " + response);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
error: function(model, response) {
|
||||
return utils.showError("Error", "Something went wrong<br />Nerd stuff is: " + response);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
MixEditView.prototype.checkRedirect = function() {
|
||||
if (this.detailsEntered && this.uploadState === 2) {
|
||||
return Backbone.history.navigate("/mix/" + this.model.get("slug"), {
|
||||
trigger: true
|
||||
});
|
||||
}
|
||||
};
|
||||
return false;
|
||||
};
|
||||
|
||||
MixEditView.prototype.login = function() {
|
||||
return vent.trigger('app:login');
|
||||
};
|
||||
MixEditView.prototype.checkRedirect = function() {
|
||||
if (this.detailsEntered && this.uploadState === 2) {
|
||||
return Backbone.history.navigate("/mix/" + this.model.get("slug"), {
|
||||
trigger: true
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
MixEditView.prototype.imageChanged = function(evt) {
|
||||
return this.sendImage = true;
|
||||
};
|
||||
MixEditView.prototype.login = function() {
|
||||
return vent.trigger('app:login');
|
||||
};
|
||||
|
||||
MixEditView;
|
||||
MixEditView.prototype.imageChanged = function(evt) {
|
||||
return this.sendImage = true;
|
||||
};
|
||||
|
||||
MixEditView;
|
||||
|
||||
|
||||
return MixEditView;
|
||||
return MixEditView;
|
||||
|
||||
})(EditableView);
|
||||
});
|
||||
})(EditableView);
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
@@ -1,153 +1,156 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
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; };
|
||||
(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', 'text!/tpl/MixListItemView'], function(moment, App, vent, Marionette, utils, Template) {
|
||||
var MixItemView;
|
||||
MixItemView = (function(_super) {
|
||||
define(['moment', 'app', 'vent', 'marionette', 'utils', 'text!/tpl/MixListItemView'], function(moment, App, vent, Marionette, utils, Template) {
|
||||
var MixItemView;
|
||||
MixItemView = (function(_super) {
|
||||
|
||||
__extends(MixItemView, _super);
|
||||
__extends(MixItemView, _super);
|
||||
|
||||
function MixItemView() {
|
||||
this.doStart = __bind(this.doStart, this);
|
||||
function MixItemView() {
|
||||
this.doStart = __bind(this.doStart, this);
|
||||
|
||||
this.onRender = __bind(this.onRender, this);
|
||||
this.onRender = __bind(this.onRender, this);
|
||||
|
||||
this.initialize = __bind(this.initialize, this);
|
||||
return MixItemView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
MixItemView.prototype.template = _.template(Template);
|
||||
|
||||
MixItemView.prototype.tagName = MixItemView.tagName || "li";
|
||||
|
||||
MixItemView.prototype.className = MixItemView.className || "";
|
||||
|
||||
MixItemView.prototype.events = {
|
||||
"click .play-button-small-start": "doStart",
|
||||
"click .play-button-small-resume": "doResume",
|
||||
"click .play-button-small-pause": "doPause",
|
||||
"click .mix-link": "mixLink",
|
||||
"click .delete-button a": "mixDelete",
|
||||
"click .like-button a": "mixLike",
|
||||
"click .favourite-button a": "mixFavourite",
|
||||
"click .share-button": "mixShare",
|
||||
"click .download-button a": "mixDownload",
|
||||
"click .login-download-button a": "login"
|
||||
};
|
||||
|
||||
MixItemView.prototype.ui = {
|
||||
playButton: ".play-button-small"
|
||||
};
|
||||
|
||||
MixItemView.prototype.initialize = function() {
|
||||
this.listenTo(this.model, 'change:favourited', this.render);
|
||||
this.listenTo(this.model, 'change:liked', this.render);
|
||||
this.listenTo(this.model, 'nested-change', this.render);
|
||||
this.listenTo(vent, 'mix:play', this.mixPlay);
|
||||
this.listenTo(vent, 'mix:pause', this.mixPause);
|
||||
return true;
|
||||
};
|
||||
|
||||
MixItemView.prototype.onRender = function() {
|
||||
var id;
|
||||
id = this.model.get('id');
|
||||
if (this.model.get('duration')) {
|
||||
$('#player-duration-' + id, this.el).text(this.model.secondsToHms('duration'));
|
||||
this.initialize = __bind(this.initialize, this);
|
||||
return MixItemView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
window.scrollTo(0, 0);
|
||||
};
|
||||
|
||||
MixItemView.prototype.onShow = function() {
|
||||
if (com.podnoms.player.isPlayingId(this.model.id)) {
|
||||
com.podnoms.settings.setupPlayerWrapper(this.model.get('id'), com.podnoms.player.getStreamUrl(), this.el);
|
||||
this.mixPlay(this.model);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
MixItemView.prototype.template = _.template(Template);
|
||||
|
||||
MixItemView.prototype.doStart = function() {
|
||||
console.log("MixItemView: mixStart");
|
||||
this.ui.playButton.toggleClass('play-button-small-start', false).toggleClass('play-button-small-resume', false).toggleClass('play-button-small-pause', true);
|
||||
vent.trigger('mix:init', this.model);
|
||||
};
|
||||
MixItemView.prototype.tagName = MixItemView.tagName || "li";
|
||||
|
||||
MixItemView.prototype.doPause = function() {
|
||||
console.log("MixItemView: mixPause");
|
||||
vent.trigger("mix:pause", this.model);
|
||||
return true;
|
||||
};
|
||||
MixItemView.prototype.className = MixItemView.className || "";
|
||||
|
||||
MixItemView.prototype.doResume = function() {
|
||||
console.log("MixItemView: mixResume");
|
||||
vent.trigger("mix:play", this.model);
|
||||
return true;
|
||||
};
|
||||
MixItemView.prototype.events = {
|
||||
"click .play-button-small-start": "doStart",
|
||||
"click .play-button-small-resume": "doResume",
|
||||
"click .play-button-small-pause": "doPause",
|
||||
"click .mix-link": "mixLink",
|
||||
"click .delete-button a": "mixDelete",
|
||||
"click .like-button a": "mixLike",
|
||||
"click .favourite-button a": "mixFavourite",
|
||||
"click .share-button": "mixShare",
|
||||
"click .download-button a": "mixDownload",
|
||||
"click .login-download-button a": "login"
|
||||
};
|
||||
|
||||
MixItemView.prototype.mixPlay = function(model) {
|
||||
if (this.model.get('id') === model.get('id')) {
|
||||
MixItemView.prototype.ui = {
|
||||
playButton: ".play-button-small"
|
||||
};
|
||||
|
||||
MixItemView.prototype.initialize = function() {
|
||||
this.listenTo(this.model, 'change:favourited', this.render);
|
||||
this.listenTo(this.model, 'change:liked', this.render);
|
||||
this.listenTo(this.model, 'nested-change', this.render);
|
||||
this.listenTo(vent, 'mix:play', this.mixPlay);
|
||||
this.listenTo(vent, 'mix:pause', this.mixPause);
|
||||
return true;
|
||||
};
|
||||
|
||||
MixItemView.prototype.onRender = function() {
|
||||
var id;
|
||||
id = this.model.get('id');
|
||||
if (this.model.get('duration')) {
|
||||
$('#player-duration-' + id, this.el).text(this.model.secondsToHms('duration'));
|
||||
}
|
||||
window.scrollTo(0, 0);
|
||||
};
|
||||
|
||||
MixItemView.prototype.onShow = function() {
|
||||
if (com.podnoms.player.isPlayingId(this.model.id)) {
|
||||
com.podnoms.settings.setupPlayerWrapper(this.model.get('id'), com.podnoms.player.getStreamUrl(), this.el);
|
||||
this.mixPlay(this.model);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
MixItemView.prototype.doStart = function() {
|
||||
console.log("MixItemView: mixStart");
|
||||
this.ui.playButton.toggleClass('play-button-small-start', false).toggleClass('play-button-small-resume', false).toggleClass('play-button-small-pause', true);
|
||||
}
|
||||
};
|
||||
vent.trigger('mix:init', this.model);
|
||||
};
|
||||
|
||||
MixItemView.prototype.mixPause = function(model) {
|
||||
if (this.model.get('id') === model.get('id')) {
|
||||
this.ui.playButton.toggleClass('play-button-small-start', false).toggleClass('play-button-small-resume', true).toggleClass('play-button-small-pause', false);
|
||||
}
|
||||
};
|
||||
MixItemView.prototype.doPause = function() {
|
||||
console.log("MixItemView: mixPause");
|
||||
vent.trigger("mix:pause", this.model);
|
||||
return true;
|
||||
};
|
||||
|
||||
MixItemView.prototype.mixStop = function(model) {
|
||||
if (this.model.get('id') === model.get('id')) {
|
||||
this.ui.playButton.toggleClass('play-button-small-start', true).toggleClass('play-button-small-resume', false).toggleClass('play-button-small-pause', false);
|
||||
}
|
||||
};
|
||||
MixItemView.prototype.doResume = function() {
|
||||
console.log("MixItemView: mixResume");
|
||||
vent.trigger("mix:play", this.model);
|
||||
return true;
|
||||
};
|
||||
|
||||
MixItemView.prototype.mixFavourite = function() {
|
||||
var app;
|
||||
console.log("MixItemView: favouriteMix");
|
||||
app = require('app');
|
||||
vent.trigger("mix:favourite", this.model);
|
||||
return true;
|
||||
};
|
||||
MixItemView.prototype.mixPlay = function(model) {
|
||||
if (this.model.get('id') === model.get('id')) {
|
||||
this.ui.playButton.toggleClass('play-button-small-start', false).toggleClass('play-button-small-resume', false).toggleClass('play-button-small-pause', true);
|
||||
}
|
||||
};
|
||||
|
||||
MixItemView.prototype.mixDelete = function() {
|
||||
var _this = this;
|
||||
console.log("MixItemView: mixDelete");
|
||||
return utils.messageBox("/dlg/DeleteMixConfirm", function() {
|
||||
return _this.model.destroy();
|
||||
});
|
||||
};
|
||||
MixItemView.prototype.mixPause = function(model) {
|
||||
if (this.model.get('id') === model.get('id')) {
|
||||
this.ui.playButton.toggleClass('play-button-small-start', false).toggleClass('play-button-small-resume', true).toggleClass('play-button-small-pause', false);
|
||||
}
|
||||
};
|
||||
|
||||
MixItemView.prototype.mixLike = function() {
|
||||
console.log("MixItemView: likeMix");
|
||||
vent.trigger("mix:like", this.model);
|
||||
return true;
|
||||
};
|
||||
MixItemView.prototype.mixStop = function(model) {
|
||||
if (this.model.get('id') === model.get('id')) {
|
||||
this.ui.playButton.toggleClass('play-button-small-start', true).toggleClass('play-button-small-resume', false).toggleClass('play-button-small-pause', false);
|
||||
}
|
||||
};
|
||||
|
||||
MixItemView.prototype.mixShare = function(e) {
|
||||
var mode;
|
||||
console.log("MixItemView: shareMix");
|
||||
mode = $(e.currentTarget).data("mode");
|
||||
console.log("MixItemView: " + mode);
|
||||
vent.trigger("mix:share", mode, this.model);
|
||||
return true;
|
||||
};
|
||||
MixItemView.prototype.mixFavourite = function() {
|
||||
var app;
|
||||
console.log("MixItemView: favouriteMix");
|
||||
app = require('app');
|
||||
vent.trigger("mix:favourite", this.model);
|
||||
return true;
|
||||
};
|
||||
|
||||
MixItemView.prototype.mixDownload = function() {
|
||||
console.log("MixItemView: mixDownload");
|
||||
utils.downloadURL("/audio/download/" + this.model.get('id'));
|
||||
return true;
|
||||
};
|
||||
MixItemView.prototype.mixDelete = function() {
|
||||
var _this = this;
|
||||
console.log("MixItemView: mixDelete");
|
||||
return utils.messageBox("/dlg/DeleteMixConfirm", function() {
|
||||
return _this.model.destroy();
|
||||
});
|
||||
};
|
||||
|
||||
MixItemView.prototype.login = function() {
|
||||
console.log("MixItemView: login");
|
||||
vent.trigger('app:login');
|
||||
return true;
|
||||
};
|
||||
MixItemView.prototype.mixLike = function() {
|
||||
console.log("MixItemView: likeMix");
|
||||
vent.trigger("mix:like", this.model);
|
||||
return true;
|
||||
};
|
||||
|
||||
MixItemView.prototype.mixShare = function(e) {
|
||||
var mode;
|
||||
console.log("MixItemView: shareMix");
|
||||
mode = $(e.currentTarget).data("mode");
|
||||
console.log("MixItemView: " + mode);
|
||||
vent.trigger("mix:share", mode, this.model);
|
||||
return true;
|
||||
};
|
||||
|
||||
MixItemView.prototype.mixDownload = function() {
|
||||
console.log("MixItemView: mixDownload");
|
||||
utils.downloadURL("/audio/download/" + this.model.get('id'));
|
||||
return true;
|
||||
};
|
||||
|
||||
MixItemView.prototype.login = function() {
|
||||
console.log("MixItemView: login");
|
||||
vent.trigger('app:login');
|
||||
return true;
|
||||
};
|
||||
|
||||
return MixItemView;
|
||||
|
||||
})(Marionette.ItemView);
|
||||
return MixItemView;
|
||||
});
|
||||
|
||||
})(Marionette.ItemView);
|
||||
return MixItemView;
|
||||
});
|
||||
}).call(this);
|
||||
|
||||
@@ -1,65 +1,68 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
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; };
|
||||
(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', 'models/user/userItem', 'models/mix/mixCollection', 'views/widgets/mixTabHeaderView', 'views/user/userItemView', 'views/mix/mixListView', 'text!/tpl/MixListLayoutView'], function(Marionette, vent, UserItem, MixCollection, MixTabHeaderView, UserItemView, MixListView, Template) {
|
||||
var MixListLayout;
|
||||
MixListLayout = (function(_super) {
|
||||
define(['marionette', 'vent', 'models/user/userItem', 'models/mix/mixCollection', 'views/widgets/mixTabHeaderView', 'views/user/userItemView', 'views/mix/mixListView', 'text!/tpl/MixListLayoutView'], function(Marionette, vent, UserItem, MixCollection, MixTabHeaderView, UserItemView, MixListView, Template) {
|
||||
var MixListLayout;
|
||||
MixListLayout = (function(_super) {
|
||||
|
||||
__extends(MixListLayout, _super);
|
||||
__extends(MixListLayout, _super);
|
||||
|
||||
function MixListLayout() {
|
||||
return MixListLayout.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
function MixListLayout() {
|
||||
return MixListLayout.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
MixListLayout.prototype.template = _.template(Template);
|
||||
MixListLayout.prototype.template = _.template(Template);
|
||||
|
||||
MixListLayout.prototype.regions = {
|
||||
headerRegion: "#mix-list-heading",
|
||||
bodyRegion: "#mix-list-body"
|
||||
};
|
||||
MixListLayout.prototype.regions = {
|
||||
headerRegion: "#mix-list-heading",
|
||||
bodyRegion: "#mix-list-body"
|
||||
};
|
||||
|
||||
MixListLayout.prototype.initialize = function(options) {
|
||||
this.listenTo(vent, "mix:showlist", this.showMixList);
|
||||
this.listenTo(vent, "user:showdetail", this.showUserView);
|
||||
return this.showMixList(options);
|
||||
};
|
||||
MixListLayout.prototype.initialize = function(options) {
|
||||
this.listenTo(vent, "mix:showlist", this.showMixList);
|
||||
this.listenTo(vent, "user:showdetail", this.showUserView);
|
||||
return this.showMixList(options);
|
||||
};
|
||||
|
||||
MixListLayout.prototype.onShow = function() {
|
||||
return this.headerRegion.show(new MixTabHeaderView());
|
||||
};
|
||||
MixListLayout.prototype.onShow = function() {
|
||||
return this.headerRegion.show(new MixTabHeaderView());
|
||||
};
|
||||
|
||||
MixListLayout.prototype.showMixList = function(options) {
|
||||
var _this = this;
|
||||
this.collection = new MixCollection();
|
||||
return this.collection.fetch({
|
||||
data: options,
|
||||
success: function(collection) {
|
||||
return _this.bodyRegion.show(new MixListView({
|
||||
collection: collection
|
||||
}));
|
||||
}
|
||||
});
|
||||
};
|
||||
MixListLayout.prototype.showMixList = function(options) {
|
||||
var _this = this;
|
||||
this.collection = new MixCollection();
|
||||
return this.collection.fetch({
|
||||
data: options,
|
||||
success: function(collection) {
|
||||
return _this.bodyRegion.show(new MixListView({
|
||||
collection: collection
|
||||
}));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
MixListLayout.prototype.showUserView = function(options) {
|
||||
var user,
|
||||
_this = this;
|
||||
this.bodyRegion.show(new MixListView(options));
|
||||
user = new UserItem({
|
||||
id: options.user
|
||||
});
|
||||
return user.fetch({
|
||||
success: function() {
|
||||
return _this.headerRegion.show(new UserItemView({
|
||||
model: user
|
||||
}));
|
||||
}
|
||||
});
|
||||
};
|
||||
MixListLayout.prototype.showUserView = function(options) {
|
||||
var user,
|
||||
_this = this;
|
||||
this.bodyRegion.show(new MixListView(options));
|
||||
user = new UserItem({
|
||||
id: options.user
|
||||
});
|
||||
return user.fetch({
|
||||
success: function() {
|
||||
return _this.headerRegion.show(new UserItemView({
|
||||
model: user
|
||||
}));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return MixListLayout;
|
||||
|
||||
})(Marionette.Layout);
|
||||
return MixListLayout;
|
||||
});
|
||||
|
||||
})(Marionette.Layout);
|
||||
return MixListLayout;
|
||||
});
|
||||
}).call(this);
|
||||
|
||||
@@ -1,43 +1,46 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
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; };
|
||||
(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', 'models/mix/mixCollection', 'views/mix/mixItemView', 'text!/tpl/MixListView'], function(Marionette, vent, MixCollection, MixItemView, Template) {
|
||||
var MixListView;
|
||||
MixListView = (function(_super) {
|
||||
var currentMix;
|
||||
define(['marionette', 'vent', 'models/mix/mixCollection', 'views/mix/mixItemView', 'text!/tpl/MixListView'], function(Marionette, vent, MixCollection, MixItemView, Template) {
|
||||
var MixListView;
|
||||
MixListView = (function(_super) {
|
||||
var currentMix;
|
||||
|
||||
__extends(MixListView, _super);
|
||||
__extends(MixListView, _super);
|
||||
|
||||
function MixListView() {
|
||||
return MixListView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
MixListView.prototype.template = _.template(Template);
|
||||
|
||||
MixListView.prototype.className = "mix-listing audio-listing";
|
||||
|
||||
MixListView.prototype.itemView = MixItemView;
|
||||
|
||||
MixListView.prototype.itemViewContainer = "#mix-list-container-ul";
|
||||
|
||||
currentMix = -1;
|
||||
|
||||
MixListView.prototype.mixPlay = function(model) {
|
||||
var v;
|
||||
if (currentMix !== -1) {
|
||||
v = this.children.findByModelCid(currentMix);
|
||||
v.mixStop(v.model);
|
||||
function MixListView() {
|
||||
return MixListView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
currentMix = model.cid;
|
||||
};
|
||||
|
||||
MixListView.prototype.onRender = function() {
|
||||
return window.scrollTo(0, 0);
|
||||
};
|
||||
MixListView.prototype.template = _.template(Template);
|
||||
|
||||
MixListView.prototype.className = "mix-listing audio-listing";
|
||||
|
||||
MixListView.prototype.itemView = MixItemView;
|
||||
|
||||
MixListView.prototype.itemViewContainer = "#mix-list-container-ul";
|
||||
|
||||
currentMix = -1;
|
||||
|
||||
MixListView.prototype.mixPlay = function(model) {
|
||||
var v;
|
||||
if (currentMix !== -1) {
|
||||
v = this.children.findByModelCid(currentMix);
|
||||
v.mixStop(v.model);
|
||||
}
|
||||
currentMix = model.cid;
|
||||
};
|
||||
|
||||
MixListView.prototype.onRender = function() {
|
||||
return window.scrollTo(0, 0);
|
||||
};
|
||||
|
||||
return MixListView;
|
||||
|
||||
})(Marionette.CompositeView);
|
||||
return MixListView;
|
||||
});
|
||||
|
||||
})(Marionette.CompositeView);
|
||||
return MixListView;
|
||||
});
|
||||
}).call(this);
|
||||
|
||||
@@ -1,86 +1,89 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
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; };
|
||||
(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;
|
||||
NotificationsListView = (function(_super) {
|
||||
define(['marionette', 'underscore', 'vent', 'utils', 'models/notifications/notificationCollection', 'views/notifications/notificationsItemView', 'text!/tpl/NotificationsListView'], function(Marionette, _, vent, utils, NotificationCollection, NotificationsItemView, Template) {
|
||||
var NotificationsListView;
|
||||
NotificationsListView = (function(_super) {
|
||||
|
||||
__extends(NotificationsListView, _super);
|
||||
__extends(NotificationsListView, _super);
|
||||
|
||||
function NotificationsListView() {
|
||||
this.initialize = __bind(this.initialize, this);
|
||||
return NotificationsListView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
NotificationsListView.prototype.template = _.template(Template);
|
||||
|
||||
NotificationsListView.prototype.itemView = NotificationsItemView;
|
||||
|
||||
NotificationsListView.prototype.itemViewContainer = "#notif_list_node";
|
||||
|
||||
NotificationsListView.prototype.tagName = "li";
|
||||
|
||||
NotificationsListView.prototype.events = {
|
||||
"click #notifications-dropdown": "showNotifications"
|
||||
};
|
||||
|
||||
NotificationsListView.prototype.ui = {
|
||||
notificationSurround: "#notification-surround",
|
||||
notificationCountBadge: "#notification-count-badge",
|
||||
notificationCount: "#notification-count"
|
||||
};
|
||||
|
||||
NotificationsListView.prototype.initialize = function() {
|
||||
var _this = this;
|
||||
this.collection = new NotificationCollection;
|
||||
return this.collection.fetch({
|
||||
success: function() {
|
||||
_this.renderBeacon();
|
||||
return _this.collection.on({
|
||||
'add': function(model, collection) {
|
||||
_this.collection.meta.is_new += 1;
|
||||
return _this.renderBeacon(model);
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function() {
|
||||
return $(_this.ui.notificationSurround).hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
NotificationsListView.prototype.renderBeacon = function(model) {
|
||||
var newCount;
|
||||
newCount = this.collection.meta.is_new;
|
||||
if (newCount === 0) {
|
||||
$(this.ui.notificationCount).text("Notifications");
|
||||
return $(this.ui.notificationCountBadge).hide();
|
||||
} else {
|
||||
$(this.ui.notificationCount).text(newCount + " new notifications");
|
||||
$(this.ui.notificationCountBadge).show();
|
||||
$(this.ui.notificationCountBadge).addClass('animate pulse');
|
||||
$('#notification-icon', this.el).addClass('icon-animated-bell');
|
||||
return $(this.ui.notificationCountBadge).text(newCount);
|
||||
function NotificationsListView() {
|
||||
this.initialize = __bind(this.initialize, this);
|
||||
return NotificationsListView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
NotificationsListView.prototype.showNotifications = function() {
|
||||
var _this = this;
|
||||
console.log("NotificationsListView: showNotifications");
|
||||
return $.ajax({
|
||||
url: '/ajax/mark_read/',
|
||||
type: 'post',
|
||||
success: function() {
|
||||
$(_this.ui.notificationCountBadge).hide();
|
||||
return _this.collection.meta.is_new = 0;
|
||||
NotificationsListView.prototype.template = _.template(Template);
|
||||
|
||||
NotificationsListView.prototype.itemView = NotificationsItemView;
|
||||
|
||||
NotificationsListView.prototype.itemViewContainer = "#notif_list_node";
|
||||
|
||||
NotificationsListView.prototype.tagName = "li";
|
||||
|
||||
NotificationsListView.prototype.events = {
|
||||
"click #notifications-dropdown": "showNotifications"
|
||||
};
|
||||
|
||||
NotificationsListView.prototype.ui = {
|
||||
notificationSurround: "#notification-surround",
|
||||
notificationCountBadge: "#notification-count-badge",
|
||||
notificationCount: "#notification-count"
|
||||
};
|
||||
|
||||
NotificationsListView.prototype.initialize = function() {
|
||||
var _this = this;
|
||||
this.collection = new NotificationCollection;
|
||||
return this.collection.fetch({
|
||||
success: function() {
|
||||
_this.renderBeacon();
|
||||
return _this.collection.on({
|
||||
'add': function(model, collection) {
|
||||
_this.collection.meta.is_new += 1;
|
||||
return _this.renderBeacon(model);
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function() {
|
||||
return $(_this.ui.notificationSurround).hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
NotificationsListView.prototype.renderBeacon = function(model) {
|
||||
var newCount;
|
||||
newCount = this.collection.meta.is_new;
|
||||
if (newCount === 0) {
|
||||
$(this.ui.notificationCount).text("Notifications");
|
||||
return $(this.ui.notificationCountBadge).hide();
|
||||
} else {
|
||||
$(this.ui.notificationCount).text(newCount + " new notifications");
|
||||
$(this.ui.notificationCountBadge).show();
|
||||
$(this.ui.notificationCountBadge).addClass('animate pulse');
|
||||
$('#notification-icon', this.el).addClass('icon-animated-bell');
|
||||
return $(this.ui.notificationCountBadge).text(newCount);
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
NotificationsListView.prototype.showNotifications = function() {
|
||||
var _this = this;
|
||||
console.log("NotificationsListView: showNotifications");
|
||||
return $.ajax({
|
||||
url: '/ajax/mark_read/',
|
||||
type: 'post',
|
||||
success: function() {
|
||||
$(_this.ui.notificationCountBadge).hide();
|
||||
return _this.collection.meta.is_new = 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return NotificationsListView;
|
||||
|
||||
})(Marionette.CompositeView);
|
||||
return NotificationsListView;
|
||||
});
|
||||
|
||||
})(Marionette.CompositeView);
|
||||
return NotificationsListView;
|
||||
});
|
||||
}).call(this);
|
||||
|
||||
@@ -1,38 +1,41 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
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; };
|
||||
(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;
|
||||
UserItemView = (function(_super) {
|
||||
define(['app', 'moment', 'app.lib/dssView', 'vent', 'text!/tpl/UserListItemView'], function(App, moment, DssView, vent, Template) {
|
||||
var UserItemView;
|
||||
UserItemView = (function(_super) {
|
||||
|
||||
__extends(UserItemView, _super);
|
||||
__extends(UserItemView, _super);
|
||||
|
||||
function UserItemView() {
|
||||
this.initialize = __bind(this.initialize, this);
|
||||
return UserItemView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
UserItemView.prototype.template = _.template(Template);
|
||||
|
||||
UserItemView.prototype.className = "row";
|
||||
|
||||
UserItemView.prototype.events = {
|
||||
"click #follow-button": function() {
|
||||
return vent.trigger("user:follow", this.model);
|
||||
},
|
||||
"click #follow-button-login": function() {
|
||||
return vent.trigger("app:login", this.model);
|
||||
function UserItemView() {
|
||||
this.initialize = __bind(this.initialize, this);
|
||||
return UserItemView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
UserItemView.prototype.initialize = function() {
|
||||
return this.listenTo(this.model, 'change:is_following', this.render);
|
||||
};
|
||||
UserItemView.prototype.template = _.template(Template);
|
||||
|
||||
UserItemView.prototype.className = "row";
|
||||
|
||||
UserItemView.prototype.events = {
|
||||
"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);
|
||||
};
|
||||
|
||||
return UserItemView;
|
||||
|
||||
})(DssView);
|
||||
return UserItemView;
|
||||
});
|
||||
|
||||
})(DssView);
|
||||
return UserItemView;
|
||||
});
|
||||
}).call(this);
|
||||
|
||||
@@ -1,74 +1,77 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
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; };
|
||||
(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'], function($, Marionette, UserCollection, UserItemView, Template) {
|
||||
var UserListView;
|
||||
UserListView = (function(_super) {
|
||||
define(['jquery', 'marionette', 'models/user/userCollection', 'views/user/userItemView', 'text!/tpl/UserListView'], function($, Marionette, UserCollection, UserItemView, Template) {
|
||||
var UserListView;
|
||||
UserListView = (function(_super) {
|
||||
|
||||
__extends(UserListView, _super);
|
||||
__extends(UserListView, _super);
|
||||
|
||||
function UserListView() {
|
||||
this.doSearch = __bind(this.doSearch, this);
|
||||
function UserListView() {
|
||||
this.doSearch = __bind(this.doSearch, this);
|
||||
|
||||
this._fetchCollection = __bind(this._fetchCollection, this);
|
||||
this._fetchCollection = __bind(this._fetchCollection, this);
|
||||
|
||||
this.initialize = __bind(this.initialize, this);
|
||||
return UserListView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
UserListView.prototype.template = _.template(Template);
|
||||
|
||||
UserListView.prototype.events = {
|
||||
"keyup #search-text": "doSearch"
|
||||
};
|
||||
|
||||
UserListView.prototype.ui = {
|
||||
searchText: "#search-text"
|
||||
};
|
||||
|
||||
UserListView.prototype.className = "row";
|
||||
|
||||
UserListView.prototype.itemView = UserItemView;
|
||||
|
||||
UserListView.prototype.itemViewContainer = "#user-table";
|
||||
|
||||
UserListView.prototype.initialize = function(options) {
|
||||
console.log("UserListView: initialize");
|
||||
this.collection = new UserCollection();
|
||||
this._fetchCollection(options);
|
||||
};
|
||||
|
||||
UserListView.prototype._fetchCollection = function(options) {
|
||||
var _this = this;
|
||||
return this.collection.fetch({
|
||||
data: options,
|
||||
success: function() {
|
||||
console.log("UserListView: Collection fetched");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
UserListView.prototype.doSearch = function() {
|
||||
var query;
|
||||
console.log("UserListView: doSearch");
|
||||
query = this.ui.searchText.val();
|
||||
if (query) {
|
||||
return this._fetchCollection({
|
||||
q: query
|
||||
});
|
||||
} else {
|
||||
return this._fetchCollection(this.options);
|
||||
this.initialize = __bind(this.initialize, this);
|
||||
return UserListView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
UserListView.prototype.onRender = function() {
|
||||
return window.scrollTo(0, 0);
|
||||
};
|
||||
UserListView.prototype.template = _.template(Template);
|
||||
|
||||
UserListView.prototype.events = {
|
||||
"keyup #search-text": "doSearch"
|
||||
};
|
||||
|
||||
UserListView.prototype.ui = {
|
||||
searchText: "#search-text"
|
||||
};
|
||||
|
||||
UserListView.prototype.className = "row";
|
||||
|
||||
UserListView.prototype.itemView = UserItemView;
|
||||
|
||||
UserListView.prototype.itemViewContainer = "#user-table";
|
||||
|
||||
UserListView.prototype.initialize = function(options) {
|
||||
console.log("UserListView: initialize");
|
||||
this.collection = new UserCollection();
|
||||
this._fetchCollection(options);
|
||||
};
|
||||
|
||||
UserListView.prototype._fetchCollection = function(options) {
|
||||
var _this = this;
|
||||
return this.collection.fetch({
|
||||
data: options,
|
||||
success: function() {
|
||||
console.log("UserListView: Collection fetched");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
UserListView.prototype.doSearch = function() {
|
||||
var query;
|
||||
console.log("UserListView: doSearch");
|
||||
query = this.ui.searchText.val();
|
||||
if (query) {
|
||||
return this._fetchCollection({
|
||||
q: query
|
||||
});
|
||||
} else {
|
||||
return this._fetchCollection(this.options);
|
||||
}
|
||||
};
|
||||
|
||||
UserListView.prototype.onRender = function() {
|
||||
return window.scrollTo(0, 0);
|
||||
};
|
||||
|
||||
return UserListView;
|
||||
|
||||
})(Marionette.CompositeView);
|
||||
return UserListView;
|
||||
});
|
||||
|
||||
})(Marionette.CompositeView);
|
||||
return UserListView;
|
||||
});
|
||||
}).call(this);
|
||||
|
||||
@@ -1,77 +1,80 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
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; };
|
||||
(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', 'utils', 'moment', 'marionette', 'vent', 'app.lib/editableView', 'models/user/userItem', 'text!/tpl/UserProfileView', 'ace-editable', 'wysiwyg'], function(App, utils, moment, Marionette, vent, EditableView, UserItem, Template) {
|
||||
var UserProfileView;
|
||||
UserProfileView = (function(_super) {
|
||||
define(['app', 'utils', 'moment', 'marionette', 'vent', 'app.lib/editableView', 'models/user/userItem', 'text!/tpl/UserProfileView', 'ace-editable', 'wysiwyg'], function(App, utils, moment, Marionette, vent, EditableView, UserItem, Template) {
|
||||
var UserProfileView;
|
||||
UserProfileView = (function(_super) {
|
||||
|
||||
__extends(UserProfileView, _super);
|
||||
__extends(UserProfileView, _super);
|
||||
|
||||
function UserProfileView() {
|
||||
this.initialize = __bind(this.initialize, this);
|
||||
return UserProfileView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
UserProfileView.prototype.template = _.template(Template);
|
||||
|
||||
UserProfileView.prototype.events = {
|
||||
"click #follow-button": function() {
|
||||
return vent.trigger("user:follow", this.model);
|
||||
},
|
||||
"click #follow-button-login": function() {
|
||||
return vent.trigger("app:login", this.model);
|
||||
function UserProfileView() {
|
||||
this.initialize = __bind(this.initialize, this);
|
||||
return UserProfileView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
UserProfileView.prototype.initialize = function() {
|
||||
return this.listenTo(this.model, 'change:is_following', this.render);
|
||||
};
|
||||
UserProfileView.prototype.template = _.template(Template);
|
||||
|
||||
UserProfileView.prototype.templateHelpers = {
|
||||
humanise: function(date) {
|
||||
return moment(date).fromNow();
|
||||
}
|
||||
};
|
||||
UserProfileView.prototype.events = {
|
||||
"click #follow-button": function() {
|
||||
return vent.trigger("user:follow", this.model);
|
||||
},
|
||||
"click #follow-button-login": function() {
|
||||
return vent.trigger("app:login", this.model);
|
||||
}
|
||||
};
|
||||
|
||||
UserProfileView.prototype.onDomRefresh = function() {
|
||||
var _this = this;
|
||||
console.log("UserProfileView: initialize");
|
||||
this.setupImageEditable({
|
||||
el: $("#avatar", this.el),
|
||||
url: "/ajax/upload_avatar_image/",
|
||||
chooseMessage: "Choose profile image"
|
||||
});
|
||||
$.fn.editable.defaults.mode = "inline";
|
||||
$.fn.editableform.loading = "<div class='editableform-loading'><i class='light-blue icon-2x icon-spinner icon-spin'></i></div>";
|
||||
$.fn.editableform.buttons = "<button type=\"submit\" class=\"btn btn-info editable-submit\"><i class=\"icon-ok icon-white\"></i></button>" + "<button type=\"button\" class=\"btn editable-cancel\"><i class=\"icon-remove\"></i></button>";
|
||||
if (utils.isMe(this.model.get("id"))) {
|
||||
$("#about", this.el).editable({
|
||||
mode: "inline",
|
||||
type: "wysiwyg",
|
||||
name: "about",
|
||||
wysiwyg: {},
|
||||
css: {
|
||||
'max-width': '300px'
|
||||
},
|
||||
success: function(response, newValue) {
|
||||
console.log("Update model with new value");
|
||||
return _this.model.save('description', newValue, {
|
||||
patch: true
|
||||
});
|
||||
}
|
||||
UserProfileView.prototype.initialize = function() {
|
||||
return this.listenTo(this.model, 'change:is_following', this.render);
|
||||
};
|
||||
|
||||
UserProfileView.prototype.templateHelpers = {
|
||||
humanise: function(date) {
|
||||
return moment(date).fromNow();
|
||||
}
|
||||
};
|
||||
|
||||
UserProfileView.prototype.onDomRefresh = function() {
|
||||
var _this = this;
|
||||
console.log("UserProfileView: initialize");
|
||||
this.setupImageEditable({
|
||||
el: $("#avatar", this.el),
|
||||
url: "/ajax/upload_avatar_image/",
|
||||
chooseMessage: "Choose profile image"
|
||||
});
|
||||
}
|
||||
return $(".usereditable").attr('class', utils.isMe(this.model.get("id")) ? "editable editable-click" : "user-info");
|
||||
};
|
||||
$.fn.editable.defaults.mode = "inline";
|
||||
$.fn.editableform.loading = "<div class='editableform-loading'><i class='light-blue icon-2x icon-spinner icon-spin'></i></div>";
|
||||
$.fn.editableform.buttons = "<button type=\"submit\" class=\"btn btn-info editable-submit\"><i class=\"icon-ok icon-white\"></i></button>" + "<button type=\"button\" class=\"btn editable-cancel\"><i class=\"icon-remove\"></i></button>";
|
||||
if (utils.isMe(this.model.get("id"))) {
|
||||
$("#about", this.el).editable({
|
||||
mode: "inline",
|
||||
type: "wysiwyg",
|
||||
name: "about",
|
||||
wysiwyg: {},
|
||||
css: {
|
||||
'max-width': '300px'
|
||||
},
|
||||
success: function(response, newValue) {
|
||||
console.log("Update model with new value");
|
||||
return _this.model.save('description', newValue, {
|
||||
patch: true
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return $(".usereditable").attr('class', utils.isMe(this.model.get("id")) ? "editable editable-click" : "user-info");
|
||||
};
|
||||
|
||||
UserProfileView.prototype.onRender = function() {
|
||||
return window.scrollTo(0, 0);
|
||||
};
|
||||
UserProfileView.prototype.onRender = function() {
|
||||
return window.scrollTo(0, 0);
|
||||
};
|
||||
|
||||
return UserProfileView;
|
||||
|
||||
})(EditableView);
|
||||
return UserProfileView;
|
||||
});
|
||||
|
||||
})(EditableView);
|
||||
return UserProfileView;
|
||||
});
|
||||
}).call(this);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
|
||||
/*
|
||||
@license
|
||||
|
||||
@@ -8,114 +9,118 @@ Copyright (c) 2012, Fergal Moran. All rights reserved.
|
||||
Code provided under the BSD License:
|
||||
*/
|
||||
|
||||
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", "marionette", "vent", "utils", "views/widgets/searchView", "views/notifications/notificationsListView", "text!/tpl/HeaderView"], function(_, Marionette, vent, utils, SearchView, NotificationsListView, Template) {
|
||||
var HeaderView;
|
||||
HeaderView = (function(_super) {
|
||||
var NowrapRegion;
|
||||
(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; };
|
||||
|
||||
__extends(HeaderView, _super);
|
||||
define(["underscore", "marionette", "vent", "utils", "views/widgets/searchView", "views/notifications/notificationsListView", "text!/tpl/HeaderView"], function(_, Marionette, vent, utils, SearchView, NotificationsListView, Template) {
|
||||
var HeaderView;
|
||||
HeaderView = (function(_super) {
|
||||
var NowrapRegion;
|
||||
|
||||
function HeaderView() {
|
||||
return HeaderView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
__extends(HeaderView, _super);
|
||||
|
||||
NowrapRegion = Marionette.Region.extend({
|
||||
open: function(view) {
|
||||
return this.$el.html(view.$el.html());
|
||||
function HeaderView() {
|
||||
return HeaderView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
});
|
||||
|
||||
HeaderView.prototype.template = _.template(Template);
|
||||
NowrapRegion = Marionette.Region.extend({
|
||||
open: function(view) {
|
||||
return this.$el.html(view.$el.html());
|
||||
}
|
||||
});
|
||||
|
||||
HeaderView.prototype.className = "navbar navbar-default";
|
||||
HeaderView.prototype.template = _.template(Template);
|
||||
|
||||
HeaderView.prototype.events = {
|
||||
"click #header-random-button": "showRandom",
|
||||
"click #header-play-pause-button": "togglePlayState",
|
||||
"click #header-login-button": "login",
|
||||
"click #header-donate-button": "donate",
|
||||
"click #header-live-button.btn-success": "playLive",
|
||||
"click #header-live-button.btn-danger": "pauseLive"
|
||||
};
|
||||
HeaderView.prototype.className = "navbar navbar-default";
|
||||
|
||||
HeaderView.prototype.ui = {
|
||||
liveButton: "#header-live-button"
|
||||
};
|
||||
HeaderView.prototype.events = {
|
||||
"click #header-random-button": "showRandom",
|
||||
"click #header-play-pause-button": "togglePlayState",
|
||||
"click #header-login-button": "login",
|
||||
"click #header-donate-button": "donate",
|
||||
"click #header-live-button.btn-success": "playLive",
|
||||
"click #header-live-button.btn-danger": "pauseLive"
|
||||
};
|
||||
|
||||
HeaderView.prototype.regions = {
|
||||
searchRegion: "#header-search",
|
||||
notificationsRegion: {
|
||||
selector: "#header-notifications"
|
||||
}
|
||||
};
|
||||
HeaderView.prototype.ui = {
|
||||
liveButton: "#header-live-button"
|
||||
};
|
||||
|
||||
HeaderView.prototype.initialize = function() {
|
||||
this.render();
|
||||
this.listenTo(vent, "mix:play", this.trackPlaying);
|
||||
return this.listenTo(vent, "mix:pause", this.trackPaused);
|
||||
};
|
||||
HeaderView.prototype.regions = {
|
||||
searchRegion: "#header-search",
|
||||
notificationsRegion: {
|
||||
selector: "#header-notifications"
|
||||
}
|
||||
};
|
||||
|
||||
HeaderView.prototype.onShow = function() {
|
||||
this.searchRegion.show(new SearchView());
|
||||
if (com.podnoms.settings.currentUser !== -1) {
|
||||
return this.notificationsRegion.show(new NotificationsListView());
|
||||
}
|
||||
};
|
||||
HeaderView.prototype.initialize = function() {
|
||||
this.render();
|
||||
this.listenTo(vent, "mix:play", this.trackPlaying);
|
||||
return this.listenTo(vent, "mix:pause", this.trackPaused);
|
||||
};
|
||||
|
||||
HeaderView.prototype.showRandom = function() {
|
||||
console.log("headerView: showRandom");
|
||||
return vent.trigger("mix:random");
|
||||
};
|
||||
HeaderView.prototype.onShow = function() {
|
||||
this.searchRegion.show(new SearchView());
|
||||
if (com.podnoms.settings.currentUser !== -1) {
|
||||
return this.notificationsRegion.show(new NotificationsListView());
|
||||
}
|
||||
};
|
||||
|
||||
HeaderView.prototype.login = function() {
|
||||
return vent.trigger('app:login');
|
||||
};
|
||||
HeaderView.prototype.showRandom = function() {
|
||||
console.log("headerView: showRandom");
|
||||
return vent.trigger("mix:random");
|
||||
};
|
||||
|
||||
HeaderView.prototype.donate = function() {
|
||||
return vent.trigger('app:donate');
|
||||
};
|
||||
HeaderView.prototype.login = function() {
|
||||
return vent.trigger('app:login');
|
||||
};
|
||||
|
||||
HeaderView.prototype.logout = function() {
|
||||
return utils.showAlert("Success", "You are now logged out");
|
||||
};
|
||||
HeaderView.prototype.donate = function() {
|
||||
return vent.trigger('app:donate');
|
||||
};
|
||||
|
||||
HeaderView.prototype.trackChanged = function(data) {
|
||||
$(this.el).find("#track-description").text(data.title);
|
||||
return $(this.el).find("#track-description").attr("href", "#" + data.item_url);
|
||||
};
|
||||
HeaderView.prototype.logout = function() {
|
||||
return utils.showAlert("Success", "You are now logged out");
|
||||
};
|
||||
|
||||
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");
|
||||
};
|
||||
HeaderView.prototype.trackChanged = function(data) {
|
||||
$(this.el).find("#track-description").text(data.title);
|
||||
return $(this.el).find("#track-description").attr("href", "#" + data.item_url);
|
||||
};
|
||||
|
||||
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");
|
||||
};
|
||||
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");
|
||||
};
|
||||
|
||||
HeaderView.prototype.render = function() {
|
||||
$(this.el).html(this.template());
|
||||
return this;
|
||||
};
|
||||
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");
|
||||
};
|
||||
|
||||
HeaderView.prototype.playLive = function() {
|
||||
console.log("HeaderView: playLive");
|
||||
$(this.ui.liveButton).toggleClass('btn-success', false).toggleClass('btn-danger', true);
|
||||
return vent.trigger('live:play');
|
||||
};
|
||||
HeaderView.prototype.render = function() {
|
||||
$(this.el).html(this.template());
|
||||
return this;
|
||||
};
|
||||
|
||||
HeaderView.prototype.pauseLive = function() {
|
||||
console.log("HeaderView: pauseLive");
|
||||
$(this.ui.liveButton).toggleClass('btn-success', true).toggleClass('btn-danger', false);
|
||||
return vent.trigger('live:pause');
|
||||
};
|
||||
HeaderView.prototype.playLive = function() {
|
||||
console.log("HeaderView: playLive");
|
||||
$(this.ui.liveButton).toggleClass('btn-success', false).toggleClass('btn-danger', true);
|
||||
return vent.trigger('live:play');
|
||||
};
|
||||
|
||||
HeaderView.prototype.pauseLive = function() {
|
||||
console.log("HeaderView: pauseLive");
|
||||
$(this.ui.liveButton).toggleClass('btn-success', true).toggleClass('btn-danger', false);
|
||||
return vent.trigger('live:pause');
|
||||
};
|
||||
|
||||
return HeaderView;
|
||||
|
||||
})(Marionette.Layout);
|
||||
return HeaderView;
|
||||
});
|
||||
|
||||
})(Marionette.Layout);
|
||||
return HeaderView;
|
||||
});
|
||||
}).call(this);
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<div class="pull-right title-bar-item">
|
||||
<div id="genre-list" class="pull-right">
|
||||
<% _.each(genres, function(i) { %>
|
||||
<a href="/mixes/<%= i.slug %>" class="label label-info arrowed-right arrowed-in"><%= i.description %></a>
|
||||
<a href="/mixes/genre/<%= i.slug %>" class="label label-info arrowed-right arrowed-in"><%= i.description %></a>
|
||||
<% }); %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user