Fixed progress in upload

This commit is contained in:
Fergal Moran
2014-01-23 20:19:59 +00:00
parent 9e7bf63de1
commit 19ea214ad9
14 changed files with 3075 additions and 2092 deletions

View File

@@ -183,7 +183,6 @@ LOGGING = logsettings.LOGGING
FACEBOOK_APP_ID = '154504534677009'
FACEBOOK_APP_SECRET = localsettings.FACEBOOK_APP_SECRET
from celery_settings import *
djcelery.setup_loader()
SOCIALACCOUNT_AVATAR_SUPPORT = True
@@ -200,7 +199,6 @@ SOCIALACCOUNT_PROVIDERS = {
}
AVATAR_STORAGE_DIR = MEDIA_ROOT + '/avatars/'
ACCOUNT_LOGOUT_REDIRECT_URL = '/'
LOGIN_REDIRECT_URL = '/'
DSS_TEMP_PATH = localsettings.DSS_TEMP_PATH
DSS_LAME_PATH = localsettings.DSS_LAME_PATH
@@ -231,7 +229,6 @@ SENDFILE_ROOT = os.path.join(MEDIA_ROOT, 'mixes')
SENDFILE_URL = '/media/mixes'
import mimetypes
mimetypes.add_type("text/xml", ".plist", False)
HTML_MINIFY = not localsettings.DEBUG

View File

@@ -1,137 +1,140 @@
// Generated by CoffeeScript 1.4.0
(function() {
define(['backbone', 'marionette', 'vent', 'utils', 'underscore', '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', 'underscore', '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);

View File

@@ -1,111 +1,114 @@
// 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', 'marionette', 'vent', 'utils', 'soundmanager2', 'peneloplay'], function(App, Marionette, vent, utils, soundManager, peneloplay) {
var AudioController;
AudioController = (function(_super) {
define(['app', 'marionette', 'vent', 'utils', 'soundmanager2', 'peneloplay'], function(App, Marionette, vent, utils, soundManager, peneloplay) {
var AudioController;
AudioController = (function(_super) {
__extends(AudioController, _super);
__extends(AudioController, _super);
function AudioController() {
this.mixInit = __bind(this.mixInit, this);
return AudioController.__super__.constructor.apply(this, arguments);
}
function AudioController() {
this.mixInit = __bind(this.mixInit, this);
return AudioController.__super__.constructor.apply(this, arguments);
}
AudioController.prototype.initialize = function(options) {
console.log("AudioController: initialize");
this.listenTo(vent, 'mix:init', this.mixInit);
this.listenTo(vent, 'mix:play', this.mixPlay);
this.listenTo(vent, 'mix:pause', this.mixPause);
this.listenTo(vent, 'mix:resume', this.mixResume);
this.listenTo(vent, 'live:play', this.livePlay);
this.listenTo(vent, 'live:pause', this.livePause);
return soundManager.setup({
url: com.podnoms.settings.staticUrl + '/swf/sm/',
onready: function() {
return console.log("Sound manager ready sir!");
},
debugFlash: com.podnoms.smDebugMode,
preferFlash: true,
defaultOptions: {
volume: com.podnoms.settings.volume
}
});
};
AudioController.prototype.setupPlayer = function(el, url) {
return peneloplay.setupPlayer(el, url);
};
AudioController.prototype.setupPlayerEl = function(el) {
peneloplay.setupPlayer(el);
return peneloplay.setupUIWidgets();
};
AudioController.prototype.mixInit = function(model, el) {
var _this = this;
console.log("AudioController: mixInit");
this.id = model.get('id');
this.duration = model.get("duration");
peneloplay.stopPlaying();
return $.getJSON("/ajax/mix_stream_url/" + this.id + "/", function(data) {
console.log("Setting up player: ", data.stream_url);
_this.setupPlayer(el, data.stream_url);
peneloplay.startPlaying({
success: function() {
vent.trigger("mix:play", model);
utils.checkPlayCount();
AudioController.prototype.initialize = function(options) {
console.log("AudioController: initialize");
this.listenTo(vent, 'mix:init', this.mixInit);
this.listenTo(vent, 'mix:play', this.mixPlay);
this.listenTo(vent, 'mix:pause', this.mixPause);
this.listenTo(vent, 'mix:resume', this.mixResume);
this.listenTo(vent, 'live:play', this.livePlay);
this.listenTo(vent, 'live:pause', this.livePause);
return soundManager.setup({
url: com.podnoms.settings.staticUrl + '/swf/sm/',
onready: function() {
return console.log("Sound manager ready sir!");
},
error: function() {
utils.showWarning("Ooops", "Error playing mix. If you have a flash blocker, please disable it for this site. Otherwise, do please try again.");
debugFlash: com.podnoms.smDebugMode,
preferFlash: true,
defaultOptions: {
volume: com.podnoms.settings.volume
}
});
com.podnoms.storage.setItem("now_playing", _this.id);
});
};
};
AudioController.prototype.isPlayingId = function(id) {
return id === this.id;
};
AudioController.prototype.setupPlayer = function(el, url) {
return peneloplay.setupPlayer(el, url);
};
AudioController.prototype.getMixState = function() {
return peneloplay.getMixState();
};
AudioController.prototype.setupPlayerEl = function(el) {
peneloplay.setupPlayer(el);
return peneloplay.setupUIWidgets();
};
AudioController.prototype.mixPlay = function() {
console.log("AudioController: mixPlay");
return peneloplay.resume();
};
AudioController.prototype.mixInit = function(model, el) {
var _this = this;
console.log("AudioController: mixInit");
this.id = model.get('id');
this.duration = model.get("duration");
peneloplay.stopPlaying();
return $.getJSON("/ajax/mix_stream_url/" + this.id + "/", function(data) {
console.log("Setting up player: ", data.stream_url);
_this.setupPlayer(el, data.stream_url);
peneloplay.startPlaying({
success: function() {
vent.trigger("mix:play", model);
utils.checkPlayCount();
},
error: function() {
utils.showWarning("Ooops", "Error playing mix. If you have a flash blocker, please disable it for this site. Otherwise, do please try again.");
}
});
com.podnoms.storage.setItem("now_playing", _this.id);
});
};
AudioController.prototype.mixPause = function() {
console.log("AudioController: mixPause");
return peneloplay.pause();
};
AudioController.prototype.isPlayingId = function(id) {
return id === this.id;
};
AudioController.prototype.mixResume = function() {
console.log("AudioController: mixResume");
return peneloplay.resume();
};
AudioController.prototype.getMixState = function() {
return peneloplay.getMixState();
};
AudioController.prototype.livePlay = function() {
console.log("AudioController: livePlay");
return peneloplay.playLive({
success: function() {
console.log("Live stream started");
return vent.trigger('live:started');
}
});
};
AudioController.prototype.mixPlay = function() {
console.log("AudioController: mixPlay");
return peneloplay.resume();
};
AudioController.prototype.livePause = function() {
console.log("AudioController: livePause");
return peneloplay.stopLive();
};
AudioController.prototype.mixPause = function() {
console.log("AudioController: mixPause");
return peneloplay.pause();
};
AudioController.prototype.mixResume = function() {
console.log("AudioController: mixResume");
return peneloplay.resume();
};
AudioController.prototype.livePlay = function() {
console.log("AudioController: livePlay");
return peneloplay.playLive({
success: function() {
console.log("Live stream started");
return vent.trigger('live:started');
}
});
};
AudioController.prototype.livePause = function() {
console.log("AudioController: livePause");
return peneloplay.stopLive();
};
return AudioController;
})(Marionette.Controller);
return AudioController;
});
})(Marionette.Controller);
return AudioController;
});
}).call(this);

View File

@@ -1,223 +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({
order_by: type
});
};
DssController.prototype.showMixListType = function(type) {
return this.showMixList({
order_by: type
});
};
DssController.prototype.showMixListGenre = function(type) {
return this.showMixList({
genres__slug: type,
order_by: 'latest'
});
};
DssController.prototype.showMixListGenre = function(type) {
return this.showMixList({
genres__slug: type,
order_by: 'latest'
});
};
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.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.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.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.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.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.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.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.showChat = function() {
var app;
console.log("Controller: showChat");
app = require('app');
return app.contentRegion.show(new ChatView());
};
DssController.prototype.showChat = function() {
var app;
console.log("Controller: showChat");
app = require('app');
return app.contentRegion.show(new ChatView());
};
DssController.prototype.showUserList = function() {
var app;
console.log("Controller: showUserList");
app = require('app');
return app.contentRegion.show(new UserListView());
};
DssController.prototype.showUserList = function() {
var app;
console.log("Controller: showUserList");
app = require('app');
return app.contentRegion.show(new UserListView());
};
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.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.showUserFavourites = function(slug) {
console.log("Controller: showUserFavourites");
return this.showMixList({
order_by: 'latest',
favourites__slug: slug
});
};
DssController.prototype.showUserFavourites = function(slug) {
console.log("Controller: showUserFavourites");
return this.showMixList({
order_by: 'latest',
favourites__slug: slug
});
};
DssController.prototype.showUserLikes = function(slug) {
console.log("Controller: showUserLikes");
return this.showMixList({
order_by: 'latest',
likes__slug: slug
});
};
DssController.prototype.showUserLikes = function(slug) {
console.log("Controller: showUserLikes");
return this.showMixList({
order_by: 'latest',
likes__slug: slug
});
};
DssController.prototype.showUserMixes = function(slug) {
console.log("Controller: showUserMixes");
return this.showMixList({
order_by: 'latest',
user: slug
});
};
DssController.prototype.showUserMixes = function(slug) {
console.log("Controller: showUserMixes");
return this.showMixList({
order_by: 'latest',
user: 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.showUserFollowing = function(slug) {
var app;
console.log("Controller: showUserFollowing");
app = require('app');
return app.contentRegion.show(new UserListView({
followers__slug: 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.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;
};
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);

View File

@@ -1,34 +1,37 @@
// 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', 'utils'], function(Marionette, utils) {
var DssView;
DssView = (function(_super) {
define(['marionette', 'utils'], function(Marionette, utils) {
var DssView;
DssView = (function(_super) {
__extends(DssView, _super);
__extends(DssView, _super);
function DssView() {
return DssView.__super__.constructor.apply(this, arguments);
}
DssView.prototype.templateHelpers = {
renderCheckbox: function(value) {
return (value ? "checked" : "");
},
isMe: function(id) {
return utils.isMe(id);
},
humanise: function(date) {
return moment(date).fromNow();
},
secondsToHms: function(d) {
return utils.secondsToHms(d);
function DssView() {
return DssView.__super__.constructor.apply(this, arguments);
}
};
DssView.prototype.templateHelpers = {
renderCheckbox: function(value) {
return (value ? "checked" : "");
},
isMe: function(id) {
return utils.isMe(id);
},
humanise: function(date) {
return moment(date).fromNow();
},
secondsToHms: function(d) {
return utils.secondsToHms(d);
}
};
return DssView;
})(Marionette.ItemView);
return DssView;
});
})(Marionette.ItemView);
return DssView;
});
}).call(this);

View File

@@ -1,122 +1,125 @@
// Generated by CoffeeScript 1.4.0
(function() {
define(['jquery', 'bootstrap', 'toastr'], function($, bootstrap, toastr) {
return {
modal: function(url) {
if (url) {
if (url.indexOf("#") === 0) {
$(url).modal("open");
} else {
$.get(url, function(data) {
$(data).modal().on("hidden", function() {
$(this).remove();
define(['jquery', 'bootstrap', 'toastr'], function($, bootstrap, toastr) {
return {
modal: function(url) {
if (url) {
if (url.indexOf("#") === 0) {
$(url).modal("open");
} else {
$.get(url, function(data) {
$(data).modal().on("hidden", function() {
$(this).remove();
return true;
});
return $(data).proceed().on("hidden", function() {
alert("Go on so");
return true;
});
}).success(function() {
$("input:text:visible:first").focus();
return true;
});
return $(data).proceed().on("hidden", function() {
alert("Go on so");
return true;
});
}).success(function() {
$("input:text:visible:first").focus();
return true;
});
}
}
}
return true;
},
secondsToHms: function(d) {
var h, m, s;
if (d) {
d = Number(d);
h = Math.floor(d / 3600);
m = Math.floor(d % 3600 / 60);
s = Math.floor(d % 3600 % 60);
return (h > 0 ? h + ":" : "") + (m > 0 ? (h > 0 && m < 10 ? "0" : "") + m + ":" : "00:") + (s < 10 ? "0" : "") + s;
} else {
return "00:00:00";
}
},
messageBox: function(url, success) {
if (url) {
if (url.indexOf("#") === 0) {
$(url).modal("open");
return true;
},
secondsToHms: function(d) {
var h, m, s;
if (d) {
d = Number(d);
h = Math.floor(d / 3600);
m = Math.floor(d % 3600 / 60);
s = Math.floor(d % 3600 % 60);
return (h > 0 ? h + ":" : "") + (m > 0 ? (h > 0 && m < 10 ? "0" : "") + m + ":" : "00:") + (s < 10 ? "0" : "") + s;
} else {
$.get(url, function(data) {
return $(data).modal('show').on("shown.bs.modal", function(e) {
return $(this).find("#yes-no-positive").click(function() {
return success();
return "00:00:00";
}
},
messageBox: function(url, success) {
if (url) {
if (url.indexOf("#") === 0) {
$(url).modal("open");
} else {
$.get(url, function(data) {
return $(data).modal('show').on("shown.bs.modal", function(e) {
return $(this).find("#yes-no-positive").click(function() {
return success();
});
});
});
}
}
return true;
},
checkPlayCount: function() {
var _this = this;
if (document.cookie.indexOf("sessionId")) {
$.getJSON("/ajax/session_play_count", function(data) {
console.log("utils: got playcount");
if (data.play_count !== "0" && ((data.play_count % com.podnoms.settings.nag_count) === 0)) {
return _this.modal("/dlg/PlayCountLoginAlert");
}
});
}
}
return true;
},
checkPlayCount: function() {
var _this = this;
if (document.cookie.indexOf("sessionId")) {
$.getJSON("/ajax/session_play_count", function(data) {
console.log("utils: got playcount");
if (data.play_count !== "0" && ((data.play_count % com.podnoms.settings.nag_count) === 0)) {
return _this.modal("/dlg/PlayCountLoginAlert");
}
return true;
},
toastOptions: function() {
return toastr.options = {
closeButton: true,
debug: false,
positionClass: "toast-bottom-left",
onclick: null,
showDuration: "300",
hideDuration: "1000",
timeOut: "5000",
extendedTimeOut: "1000",
showEasing: "swing",
hideEasing: "linear",
showMethod: "fadeIn",
hideMethod: "fadeOut"
};
},
showError: function(title, message) {
this.toastOptions();
return toastr.error(message, title);
},
showWarning: function(title, message) {
this.toastOptions();
return toastr.warning(message, title);
},
showMessage: function(title, message) {
this.toastOptions();
return toastr.success(message, title);
},
showAlert: function(title, message) {
return this.showMessage(title, message);
},
generateGuid: function() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
var r, v;
r = Math.random() * 16 | 0;
v = (c === "x" ? r : r & 0x3 | 0x8);
return v.toString(16);
});
},
downloadURL: function(url) {
var iframe;
iframe = document.getElementById("hiddenDownloader");
if (iframe === null) {
iframe = document.createElement("iframe");
iframe.id = "hiddenDownloader";
iframe.style.visibility = "hidden";
document.body.appendChild(iframe);
}
iframe.src = url;
return true;
},
isMe: function(id) {
return id === com.podnoms.settings.currentUser;
}
return true;
},
toastOptions: function() {
return toastr.options = {
closeButton: true,
debug: false,
positionClass: "toast-bottom-left",
onclick: null,
showDuration: "300",
hideDuration: "1000",
timeOut: "5000",
extendedTimeOut: "1000",
showEasing: "swing",
hideEasing: "linear",
showMethod: "fadeIn",
hideMethod: "fadeOut"
};
},
showError: function(title, message) {
this.toastOptions();
return toastr.error(message, title);
},
showWarning: function(title, message) {
this.toastOptions();
return toastr.warning(message, title);
},
showMessage: function(title, message) {
this.toastOptions();
return toastr.success(message, title);
},
showAlert: function(title, message) {
return this.showMessage(title, message);
},
generateGuid: function() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
var r, v;
r = Math.random() * 16 | 0;
v = (c === "x" ? r : r & 0x3 | 0x8);
return v.toString(16);
});
},
downloadURL: function(url) {
var iframe;
iframe = document.getElementById("hiddenDownloader");
if (iframe === null) {
iframe = document.createElement("iframe");
iframe.id = "hiddenDownloader";
iframe.style.visibility = "hidden";
document.body.appendChild(iframe);
}
iframe.src = url;
return true;
},
isMe: function(id) {
return id === com.podnoms.settings.currentUser;
}
};
});
};
});
}).call(this);

View File

@@ -1,104 +1,107 @@
// 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', 'utils', 'models/mix/mixItem', 'models/comment/commentItem', 'models/comment/commentCollection', 'views/comment/commentListView', 'views/mix/mixItemView', 'text!/tpl/MixDetailView', 'vent'], function(Marionette, utils, MixItem, CommentItem, CommentsCollection, CommentsListView, MixItemView, Template, vent) {
var MixDetailView;
return MixDetailView = (function(_super) {
define(['marionette', 'utils', 'models/mix/mixItem', 'models/comment/commentItem', 'models/comment/commentCollection', 'views/comment/commentListView', 'views/mix/mixItemView', 'text!/tpl/MixDetailView', 'vent'], function(Marionette, utils, MixItem, CommentItem, CommentsCollection, CommentsListView, MixItemView, Template, vent) {
var MixDetailView;
return MixDetailView = (function(_super) {
__extends(MixDetailView, _super);
__extends(MixDetailView, _super);
function MixDetailView() {
this.modelChanged = __bind(this.modelChanged, this);
return MixDetailView.__super__.constructor.apply(this, arguments);
}
MixDetailView.prototype.template = _.template(Template);
MixDetailView.prototype.regions = {
mix: "#mix",
comments: "#comments"
};
MixDetailView.prototype.ui = {
commentText: '#comment-text'
};
MixDetailView.prototype.events = {
"click #btn-add-comment": "addComment",
"keypress #comment-text": "checkCommentKeypress"
};
MixDetailView.prototype.initialize = function() {
return this.model.on('nested-change', this.modelChanged);
};
MixDetailView.prototype.onRender = function() {
this.view = new MixItemView({
tagName: "div",
className: "mix-listing audio-listing-single",
model: this.model
});
this.mix.show(this.view);
this.renderComments();
return window.scrollTo(0, 0);
};
MixDetailView.prototype.onDomRefresh = function() {
return this.view.onDomRefresh();
};
MixDetailView.prototype.renderComments = function() {
var comments;
console.log("MixDetailView: Rendering comments");
comments = new CommentsCollection();
comments.url = this.model.get("resource_uri") + "/comments/";
comments.mix_id = this.model.id;
comments.mix = this.model;
comments.fetch({
success: function(data) {
var content;
content = new CommentsListView({
collection: comments
}).render();
$("#comments", this.el).html(content.el);
return true;
}
});
return true;
};
MixDetailView.prototype.modelChanged = function() {
console.log("MixDetailView: modelChanged");
this.render();
return true;
};
MixDetailView.prototype.checkCommentKeypress = function(e) {
if (e.which === 13) {
return this.addComment();
function MixDetailView() {
this.modelChanged = __bind(this.modelChanged, this);
return MixDetailView.__super__.constructor.apply(this, arguments);
}
};
MixDetailView.prototype.addComment = function() {
var activeTab, comment,
_this = this;
activeTab = $("ul#mix-tab li.active", this.el);
comment = this.ui.commentText.val();
this.model.addComment(comment, (function() {
_this.ui.commentText.val("");
utils.showMessage("Comment saved..");
return activeTab.tab().show();
}), function(error) {
utils.showError("Woops \n" + error);
$('#comment-input').addClass('has-error');
return $('#comment-text').focus();
});
MixDetailView.prototype.template = _.template(Template);
MixDetailView.prototype.regions = {
mix: "#mix",
comments: "#comments"
};
MixDetailView.prototype.ui = {
commentText: '#comment-text'
};
MixDetailView.prototype.events = {
"click #btn-add-comment": "addComment",
"keypress #comment-text": "checkCommentKeypress"
};
MixDetailView.prototype.initialize = function() {
return this.model.on('nested-change', this.modelChanged);
};
MixDetailView.prototype.onRender = function() {
this.view = new MixItemView({
tagName: "div",
className: "mix-listing audio-listing-single",
model: this.model
});
this.mix.show(this.view);
this.renderComments();
return window.scrollTo(0, 0);
};
MixDetailView.prototype.onDomRefresh = function() {
return this.view.onDomRefresh();
};
MixDetailView.prototype.renderComments = function() {
var comments;
console.log("MixDetailView: Rendering comments");
comments = new CommentsCollection();
comments.url = this.model.get("resource_uri") + "/comments/";
comments.mix_id = this.model.id;
comments.mix = this.model;
comments.fetch({
success: function(data) {
var content;
content = new CommentsListView({
collection: comments
}).render();
$("#comments", this.el).html(content.el);
return true;
}
});
return true;
};
MixDetailView.prototype.modelChanged = function() {
console.log("MixDetailView: modelChanged");
this.render();
return true;
};
MixDetailView.prototype.checkCommentKeypress = function(e) {
if (e.which === 13) {
return this.addComment();
}
};
MixDetailView.prototype.addComment = function() {
var activeTab, comment,
_this = this;
activeTab = $("ul#mix-tab li.active", this.el);
comment = this.ui.commentText.val();
this.model.addComment(comment, (function() {
_this.ui.commentText.val("");
utils.showMessage("Comment saved..");
return activeTab.tab().show();
}), function(error) {
utils.showError("Woops \n" + error);
$('#comment-input').addClass('has-error');
return $('#comment-text').focus();
});
return MixDetailView;
};
return MixDetailView;
};
return MixDetailView;
})(Marionette.Layout);
});
})(Marionette.Layout);
});
}).call(this);

View File

@@ -70,11 +70,13 @@ define ['app.lib/editableView',
<span class="smaller-80 grey">(or click)</span> <br />
<i class="upload-icon icon-cloud-upload blue icon-3x"></i>'
drop: ->
$('.progress', @el).show()
uploadprogress: (e, progress, bytesSent) =>
$('.progress', @el).hide()
$('.progress', @el).show()
@uploadState = 1
percentage = Math.round(progress)
console.log("Progressing")
@ui.progress.css("width", percentage + "%").parent().attr "data-percent", percentage + "%"
complete: =>

View File

@@ -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,151 @@ 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
};
drop: function() {
return $('.progress', this.el).show();
},
results: function(data, page) {
return {
results: data
};
uploadprogress: function(e, progress, bytesSent) {
var percentage;
$('.progress', _this.el).show();
_this.uploadState = 1;
percentage = Math.round(progress);
return _this.ui.progress.css("width", percentage + "%").parent().attr("data-percent", percentage + "%");
},
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);

View File

@@ -1,163 +1,166 @@
// 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(['underscore', 'moment', 'app', 'vent', 'app.lib/dssView', 'utils', 'text!/tpl/MixItemView'], function(_, moment, App, vent, DssView, utils, Template) {
var MixItemView;
MixItemView = (function(_super) {
define(['underscore', 'moment', 'app', 'vent', 'app.lib/dssView', 'utils', 'text!/tpl/MixItemView'], function(_, moment, App, vent, DssView, utils, Template) {
var MixItemView;
MixItemView = (function(_super) {
__extends(MixItemView, _super);
__extends(MixItemView, _super);
function MixItemView() {
this.onRender = __bind(this.onRender, this);
function MixItemView() {
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": "mixPlay",
"click .pause": "mixPause",
"click .resume": "mixResume",
"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: ".mix-state-toggle",
playButtonIcon: ".mix-state-toggle i",
playerEl: ".pnp-instance"
};
MixItemView.prototype.initialize = function() {
this.mixState = 0;
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:init', this.onMixInit);
this.listenTo(vent, 'mix:resume', this.onMixStateChanged);
this.listenTo(vent, 'mix:pause', this.onMixStateChanged);
this.app = require('app');
return true;
};
MixItemView.prototype.onRender = function() {
var data, id;
id = this.model.get('id');
data = this.model.toJSON();
return window.scrollTo(0, 0);
};
MixItemView.prototype.onDomRefresh = function() {
if (this.app.audioController.isPlayingId(this.model.id)) {
console.log("Re-wrapping player");
this.app.audioController.setupPlayerEl($(this.el));
this.ui.playButton.toggleClass("play", false).toggleClass("pause", false).toggleClass("resume", false);
this.mixState = this.app.audioController.getMixState();
this._setupStateUI();
this.initialize = __bind(this.initialize, this);
return MixItemView.__super__.constructor.apply(this, arguments);
}
};
MixItemView.prototype.onMixInit = function() {
this.mixState = 1;
return this._setupStateUI();
};
MixItemView.prototype.template = _.template(Template);
MixItemView.prototype.onMixStateChanged = function() {
console.log("***** state is " + this.state);
if (this.app.audioController.isPlayingId(this.model.id)) {
if (this.mixState === 0) {
this.mixState = 1;
} else if (this.mixState === 1) {
this.mixState = 2;
} else if (this.mixState === 2) {
this.mixState = 1;
MixItemView.prototype.tagName = MixItemView.tagName || "li";
MixItemView.prototype.className = MixItemView.className || "";
MixItemView.prototype.events = {
"click .play": "mixPlay",
"click .pause": "mixPause",
"click .resume": "mixResume",
"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: ".mix-state-toggle",
playButtonIcon: ".mix-state-toggle i",
playerEl: ".pnp-instance"
};
MixItemView.prototype.initialize = function() {
this.mixState = 0;
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:init', this.onMixInit);
this.listenTo(vent, 'mix:resume', this.onMixStateChanged);
this.listenTo(vent, 'mix:pause', this.onMixStateChanged);
this.app = require('app');
return true;
};
MixItemView.prototype.onRender = function() {
var data, id;
id = this.model.get('id');
data = this.model.toJSON();
return window.scrollTo(0, 0);
};
MixItemView.prototype.onDomRefresh = function() {
if (this.app.audioController.isPlayingId(this.model.id)) {
console.log("Re-wrapping player");
this.app.audioController.setupPlayerEl($(this.el));
this.ui.playButton.toggleClass("play", false).toggleClass("pause", false).toggleClass("resume", false);
this.mixState = this.app.audioController.getMixState();
this._setupStateUI();
}
};
MixItemView.prototype.onMixInit = function() {
this.mixState = 1;
return this._setupStateUI();
}
};
};
MixItemView.prototype._setupStateUI = function() {
this.ui.playButton.removeClass("play").removeClass("resume").removeClass("pause");
this.ui.playButtonIcon.removeClass("icon-play").removeClass("icon-pause");
if (this.mixState === 1) {
this.ui.playButton.addClass("pause");
return this.ui.playButtonIcon.removeClass("icon-play").addClass("icon-pause");
} else if (this.mixState === 2) {
this.ui.playButton.addClass("resume");
return this.ui.playButtonIcon.removeClass("icon-pause").addClass("icon-play");
}
};
MixItemView.prototype.onMixStateChanged = function() {
console.log("***** state is " + this.state);
if (this.app.audioController.isPlayingId(this.model.id)) {
if (this.mixState === 0) {
this.mixState = 1;
} else if (this.mixState === 1) {
this.mixState = 2;
} else if (this.mixState === 2) {
this.mixState = 1;
}
return this._setupStateUI();
}
};
MixItemView.prototype.mixPlay = function(button) {
return vent.trigger('mix:init', this.model, $(this.el));
};
MixItemView.prototype._setupStateUI = function() {
this.ui.playButton.removeClass("play").removeClass("resume").removeClass("pause");
this.ui.playButtonIcon.removeClass("icon-play").removeClass("icon-pause");
if (this.mixState === 1) {
this.ui.playButton.addClass("pause");
return this.ui.playButtonIcon.removeClass("icon-play").addClass("icon-pause");
} else if (this.mixState === 2) {
this.ui.playButton.addClass("resume");
return this.ui.playButtonIcon.removeClass("icon-pause").addClass("icon-play");
}
};
MixItemView.prototype.mixPause = function() {
return vent.trigger('mix:pause', this.model, $(this.el));
};
MixItemView.prototype.mixPlay = function(button) {
return vent.trigger('mix:init', this.model, $(this.el));
};
MixItemView.prototype.mixResume = function() {
return vent.trigger('mix:resume', this.model, $(this.el));
};
MixItemView.prototype.mixPause = function() {
return vent.trigger('mix:pause', this.model, $(this.el));
};
MixItemView.prototype.mixFavourite = function() {
var app;
console.log("MixItemView: favouriteMix");
app = require('app');
vent.trigger("mix:favourite", this.model);
return true;
};
MixItemView.prototype.mixResume = function() {
return vent.trigger('mix:resume', this.model, $(this.el));
};
MixItemView.prototype.mixDelete = function() {
var _this = this;
console.log("MixItemView: mixDelete");
return utils.messageBox("/dlg/DeleteMixConfirm", function() {
return _this.model.destroy();
});
};
MixItemView.prototype.mixFavourite = function() {
var app;
console.log("MixItemView: favouriteMix");
app = require('app');
vent.trigger("mix:favourite", this.model);
return true;
};
MixItemView.prototype.mixLike = function() {
console.log("MixItemView: likeMix");
vent.trigger("mix:like", this.model);
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.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.mixLike = function() {
console.log("MixItemView: likeMix");
vent.trigger("mix:like", this.model);
return true;
};
MixItemView.prototype.mixDownload = function() {
console.log("MixItemView: mixDownload");
utils.downloadURL("/audio/download/" + this.model.get('id'));
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.login = function() {
console.log("MixItemView: login");
vent.trigger('app:login');
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;
})(DssView);
return MixItemView;
});
})(DssView);
return MixItemView;
});
}).call(this);

View File

@@ -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);

3099
static/js/lib/jquery.js vendored

File diff suppressed because it is too large Load Diff

View File

@@ -53,8 +53,8 @@ requirejs.config({
'tmpl': 'lib/tmpl',
toastr: 'lib/toastr',
'socket.io': [
com.podnoms.settings.SOCKET_IO_JS_URL,
'lib/socket.io'
com.podnoms.settings.SOCKET_IO_JS_URL,
'lib/socket.io'
]
},
shim: {
@@ -78,7 +78,7 @@ requirejs.config({
deps: ['jquery']
},
'facebook': {
export: 'FB'
exports: 'FB'
},
'ace': {
exports: 'ace',
@@ -111,6 +111,12 @@ requirejs.config({
requirejs(['site', 'toastr', 'underscore', 'backbone', 'app'], function (site, toastr, _, Backbone, App) {
'use strict'
console.log('Dss.Bootstrapper: primed');
console.log('Dss.Bootstrapper: primed')
if(typeof String.prototype.trim !== 'function') {
console.log("Fucking Microsoft!");
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
App.start();
});

View File

@@ -29,10 +29,11 @@
{% block headerscripts %}
{% endblock %}
<!--if lt IE 9script(src='http://html5shim.googlecode.com/svn/trunk/html5.js')
-->
</head>
<body>
{% include 'inc/analytics.html' %}
{% include 'inc/ancient_browser.html' %}
<div id="header"></div>
<div class="space-6"></div>
<div class="body-content col-md-9" id="content">
@@ -47,11 +48,12 @@
</div>
<div id="footer"></div>
<script src="/js/settings/"></script>
<script src="{{ STATIC_URL }}js/lib/require.js" data-main="{{ STATIC_URL }}js/main.js"></script>
{% compress js %}
<script src="{{ STATIC_URL }}js/lib/respond.js"></script>
<script src="{{ STATIC_URL }}js/com.podnoms.storage.js"></script>
{% endcompress %}
<script src="{{ STATIC_URL }}js/lib/require.js" data-main="{{ STATIC_URL }}js/main.js"></script>
{% block footerscripts %}
{% endblock %}
</body>