mirror of
https://github.com/fergalmoran/dss.git
synced 2025-12-22 09:38:18 +00:00
Fixed socket.io throwing error on non standard port
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -24,3 +24,5 @@ dss_ah
|
||||
fixtures.json
|
||||
dss_test.db
|
||||
dsskeys
|
||||
.ropeproject/*
|
||||
*.map
|
||||
|
||||
@@ -98,7 +98,7 @@ STATICFILES_DIRS = (
|
||||
here('static'),
|
||||
)
|
||||
|
||||
SECRET_KEY = '8*&j)j4lnq*ft*=jhajvc7&upaifb2f2s5(v6i($$+3p(4^bvd'
|
||||
SECRET_KEY = localsettings.SECRET_KEY
|
||||
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
|
||||
@@ -8,14 +8,13 @@ from django.db import models
|
||||
from core.utils import url
|
||||
from core.utils.audio.mp3 import mp3_length, tag_mp3
|
||||
from core.utils.url import unique_slugify
|
||||
from spa.models.activity import ActivityFavourite, ActivityLike, ActivityDownload, ActivityPlay
|
||||
from spa.models.activity import ActivityDownload, ActivityPlay
|
||||
from spa.models.genre import Genre
|
||||
from dss import settings, localsettings
|
||||
from spa.models.userprofile import UserProfile
|
||||
from spa.models._basemodel import _BaseModel
|
||||
from core.utils.file import generate_save_file_name
|
||||
|
||||
|
||||
def mix_file_name(instance, filename):
|
||||
return generate_save_file_name(instance.uid, 'mixes', filename)
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ from spa.models import _BaseModel, UserProfile
|
||||
|
||||
class NotificationThread(threading.Thread):
|
||||
def __init__(self, instance, **kwargs):
|
||||
self.instance = instance
|
||||
self._instance = instance
|
||||
super(NotificationThread, self).__init__(**kwargs)
|
||||
|
||||
def run(self):
|
||||
post_notification(self.instance.get_notification_url())
|
||||
post_notification(self._instance.get_notification_url())
|
||||
|
||||
|
||||
class Notification(_BaseModel):
|
||||
|
||||
@@ -55,4 +55,3 @@ def post_save_handler(**kwargs):
|
||||
|
||||
|
||||
post_save.connect(post_save_handler)
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
define ['backbone', 'marionette', 'vent', 'utils',
|
||||
'app.lib/social', 'app.lib/router', 'app.lib/panningRegion', 'app.lib/realtimeController',
|
||||
'app.lib/audioController',
|
||||
'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'],
|
||||
(Backbone, Marionette, vent, utils, social, DssRouter, PanningRegion, RealtimeController, AudioController, UserItem, MixCollection, HeaderView, SidebarView) ->
|
||||
(Backbone, Marionette, vent, utils,
|
||||
social, DssRouter, PanningRegion, RealtimeController, AudioController,
|
||||
UserItem, MixCollection,
|
||||
HeaderView, SidebarView) ->
|
||||
App = new Marionette.Application();
|
||||
App.audioController = new AudioController();
|
||||
App.realtimeController = new RealtimeController();
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
// Generated by CoffeeScript 1.6.2
|
||||
// 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);
|
||||
@@ -35,7 +34,6 @@
|
||||
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")
|
||||
@@ -71,7 +69,6 @@
|
||||
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
|
||||
@@ -80,7 +77,6 @@
|
||||
user.fetch({
|
||||
success: function() {
|
||||
var f, newFollowers;
|
||||
|
||||
if (!model.get("is_following")) {
|
||||
newFollowers = user.get("following").concat([target]);
|
||||
user.save({
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
define ['app', 'marionette', 'vent',
|
||||
'views/chat/chatView',
|
||||
'models/mix/mixItem', 'views/mix/mixListLayout', 'views/mix/mixListView', 'views/mix/mixDetailView'
|
||||
'views/mix/mixEditView', 'views/user/userProfileView',
|
||||
'models/user/userItem', 'views/user/userListView', 'views/user/userEditView'],
|
||||
(App, Marionette, vent, ChatView, MixItem, MixListLayout, MixListView, MixDetailView, MixEditView, UserProfileView, UserItem, UserListView, UserEditView)->
|
||||
(App, Marionette, vent,
|
||||
MixItem, MixListLayout, MixListView, MixDetailView,
|
||||
MixEditView, UserProfileView,
|
||||
UserItem, UserListView, UserEditView)->
|
||||
class DssController extends Marionette.Controller
|
||||
|
||||
home: ->
|
||||
@@ -11,14 +13,13 @@ define ['app', 'marionette', 'vent',
|
||||
@showMixList()
|
||||
true
|
||||
|
||||
_showMixList: () ->
|
||||
showMixList: (options) ->
|
||||
app = require('app')
|
||||
app.contentRegion.show(new MixListLayout())
|
||||
app.contentRegion.show(new MixListLayout(options or {order_by: 'latest'}))
|
||||
true
|
||||
|
||||
showMixList: (type) ->
|
||||
@_showMixList()
|
||||
vent.trigger("mix:showlist", {order_by: type || 'latest'})
|
||||
showMixListType: (type) ->
|
||||
@showMixList({order_by: type})
|
||||
true
|
||||
|
||||
showMix: (slug)->
|
||||
@@ -78,18 +79,15 @@ define ['app', 'marionette', 'vent',
|
||||
|
||||
showUserFavourites: (slug) ->
|
||||
console.log("Controller: showUserFavourites")
|
||||
@_showMixList()
|
||||
vent.trigger("mix:showlist", {order_by: 'latest', favourites__slug: slug})
|
||||
@showMixList({order_by: 'latest', favourites__slug: slug})
|
||||
|
||||
showUserLikes: (slug) ->
|
||||
console.log("Controller: showUserLikes")
|
||||
@_showMixList()
|
||||
vent.trigger("mix:showlist", {order_by: 'latest', likes__slug: slug})
|
||||
@showMixList({order_by: 'latest', likes__slug: slug})
|
||||
|
||||
showUserMixes: (slug) ->
|
||||
console.log("Controller: showUserMixes")
|
||||
@_showMixList()
|
||||
vent.trigger("mix:showlist", {order_by: 'latest', user: slug})
|
||||
@showMixList({order_by: 'latest', user: slug})
|
||||
|
||||
showUserFollowing: (slug) ->
|
||||
console.log("Controller: showUserFollowing")
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
var __hasProp = {}.hasOwnProperty,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||
|
||||
define(['app', 'marionette', 'vent', 'views/chat/chatView', 'models/mix/mixItem', 'views/mix/mixListLayout', 'views/mix/mixListView', 'views/mix/mixDetailView', 'views/mix/mixEditView', 'views/user/userProfileView', 'models/user/userItem', 'views/user/userListView', 'views/user/userEditView'], function(App, Marionette, vent, ChatView, MixItem, MixListLayout, MixListView, MixDetailView, MixEditView, UserProfileView, UserItem, UserListView, UserEditView) {
|
||||
define(['app', 'marionette', 'vent', 'models/mix/mixItem', 'views/mix/mixListLayout', 'views/mix/mixListView', 'views/mix/mixDetailView', 'views/mix/mixEditView', 'views/user/userProfileView', 'models/user/userItem', 'views/user/userListView', 'views/user/userEditView'], function(App, Marionette, vent, MixItem, MixListLayout, MixListView, MixDetailView, MixEditView, UserProfileView, UserItem, UserListView, UserEditView) {
|
||||
var DssController, _ref;
|
||||
|
||||
DssController = (function(_super) {
|
||||
@@ -20,18 +20,19 @@
|
||||
return true;
|
||||
};
|
||||
|
||||
DssController.prototype._showMixList = function() {
|
||||
DssController.prototype.showMixList = function(options) {
|
||||
var app;
|
||||
|
||||
app = require('app');
|
||||
app.contentRegion.show(new MixListLayout());
|
||||
app.contentRegion.show(new MixListLayout(options || {
|
||||
order_by: 'latest'
|
||||
}));
|
||||
return true;
|
||||
};
|
||||
|
||||
DssController.prototype.showMixList = function(type) {
|
||||
this._showMixList();
|
||||
vent.trigger("mix:showlist", {
|
||||
order_by: type || 'latest'
|
||||
DssController.prototype.showMixListType = function(type) {
|
||||
this.showMixList({
|
||||
order_by: type
|
||||
});
|
||||
return true;
|
||||
};
|
||||
@@ -128,8 +129,7 @@
|
||||
|
||||
DssController.prototype.showUserFavourites = function(slug) {
|
||||
console.log("Controller: showUserFavourites");
|
||||
this._showMixList();
|
||||
return vent.trigger("mix:showlist", {
|
||||
return this.showMixList({
|
||||
order_by: 'latest',
|
||||
favourites__slug: slug
|
||||
});
|
||||
@@ -137,8 +137,7 @@
|
||||
|
||||
DssController.prototype.showUserLikes = function(slug) {
|
||||
console.log("Controller: showUserLikes");
|
||||
this._showMixList();
|
||||
return vent.trigger("mix:showlist", {
|
||||
return this.showMixList({
|
||||
order_by: 'latest',
|
||||
likes__slug: slug
|
||||
});
|
||||
@@ -146,8 +145,7 @@
|
||||
|
||||
DssController.prototype.showUserMixes = function(slug) {
|
||||
console.log("Controller: showUserMixes");
|
||||
this._showMixList();
|
||||
return vent.trigger("mix:showlist", {
|
||||
return this.showMixList({
|
||||
order_by: 'latest',
|
||||
user: slug
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ define ['vent', 'socket.io'],
|
||||
(vent, SocketIO) ->
|
||||
class RealtimeController
|
||||
startSocketIO: ->
|
||||
console.log("RealtimeController: Socket IO starting")
|
||||
console.log("RealtimeController: SocketIO starting on " + com.podnoms.settings.REALTIME_HOST)
|
||||
@socket = SocketIO.connect(com.podnoms.settings.REALTIME_HOST)
|
||||
@socket.on "hello", (data) =>
|
||||
console.log("RealtimeController: Connected " + data['message'])
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
// Generated by CoffeeScript 1.6.2
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
(function() {
|
||||
|
||||
define(['vent', 'socket.io'], function(vent, SocketIO) {
|
||||
var RealtimeController;
|
||||
|
||||
RealtimeController = (function() {
|
||||
|
||||
function RealtimeController() {}
|
||||
|
||||
RealtimeController.prototype.startSocketIO = function() {
|
||||
var _this = this;
|
||||
|
||||
console.log("RealtimeController: Socket IO starting");
|
||||
console.log("RealtimeController: SocketIO starting on " + com.podnoms.settings.REALTIME_HOST);
|
||||
this.socket = SocketIO.connect(com.podnoms.settings.REALTIME_HOST);
|
||||
this.socket.on("hello", function(data) {
|
||||
return console.log("RealtimeController: Connected " + data['message']);
|
||||
});
|
||||
"@socket.on \"activity\", (data) =>\n console.log(\"RealtimeController: activity \" + data['message'])\n vent.trigger(\"model:activity:new\", data['message'])";
|
||||
|
||||
return this.socket.on("notification", function(data) {
|
||||
console.log("RealtimeController: notification " + data['message']);
|
||||
return vent.trigger("model:notification:new", data['message']);
|
||||
|
||||
@@ -8,7 +8,7 @@ define ['marionette', 'vent', 'app.lib/controller'],
|
||||
|
||||
"mix/upload": "uploadMix",
|
||||
"mixes": "showMixList",
|
||||
"mixes/:type": "showMixList"
|
||||
"mixes/:type": "showMixListType"
|
||||
"mix/:slug": "showMix"
|
||||
"mix/edit/:slug": "editMix",
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
// Generated by CoffeeScript 1.6.2
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
(function() {
|
||||
var __hasProp = {}.hasOwnProperty,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||
|
||||
define(['marionette', 'vent', 'app.lib/controller'], function(Marionette, vent, Controller) {
|
||||
var DssRouter, _ref;
|
||||
|
||||
var DssRouter;
|
||||
return DssRouter = (function(_super) {
|
||||
|
||||
__extends(DssRouter, _super);
|
||||
|
||||
function DssRouter() {
|
||||
_ref = DssRouter.__super__.constructor.apply(this, arguments);
|
||||
return _ref;
|
||||
return DssRouter.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
DssRouter.prototype.controller = new Controller;
|
||||
@@ -21,7 +20,7 @@
|
||||
"/": "home",
|
||||
"mix/upload": "uploadMix",
|
||||
"mixes": "showMixList",
|
||||
"mixes/:type": "showMixList",
|
||||
"mixes/:type": "showMixListType",
|
||||
"mix/:slug": "showMix",
|
||||
"mix/edit/:slug": "editMix",
|
||||
"chat": "showChat",
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
// Generated by CoffeeScript 1.3.3
|
||||
(function() {
|
||||
|
||||
define(['jquery', 'utils', 'facebook'], function($, utils) {
|
||||
return {
|
||||
postFacebookLike: function(mixId) {
|
||||
return $.getJSON("social/like/" + mixId + "/", function(data) {
|
||||
return com.podnoms.utils.showAlert("Posted your like to facebook, you can stop this in your settings page.", "Cheers feen");
|
||||
});
|
||||
},
|
||||
generateEmbedCode: function(model) {
|
||||
console.log("Generating embed code");
|
||||
return utils.modal("/dlg/embed/" + model.get('slug'));
|
||||
},
|
||||
sharePageToTwitter: function(model) {
|
||||
var loc, title;
|
||||
loc = $(this).attr("href");
|
||||
title = $(this).attr("title");
|
||||
return window.open("http://twitter.com/share?url=" + "http://" + window.location.host + "/" + model.get("item_url") + "&text=" + model.get("title"), "twitterwindow", "height=450, width=550, top=" + ($(window).height() / 2 - 225) + ", left=" + $(window).width() / 2 + ", toolbar=0, location=0, menubar=0, directories=0, scrollbars=0");
|
||||
},
|
||||
sharePageToFacebook: function(model) {
|
||||
FB.init({
|
||||
appId: '154504534677009',
|
||||
xfbml: true
|
||||
});
|
||||
return FB.getLoginStatus(function(oResponse) {
|
||||
if (oResponse.status === "connected") {
|
||||
return FB.ui({
|
||||
method: "feed",
|
||||
name: "Check out this mix on Deep South Sounds",
|
||||
display: "popup",
|
||||
link: "http://" + window.location.host + "/" + model.get("item_url"),
|
||||
picture: com.podnoms.settings.staticUrl + model.get("mix_image"),
|
||||
caption: model.get("title"),
|
||||
description: model.get("description")
|
||||
}, function(response) {
|
||||
if (response && response.post_id) {
|
||||
return utils.showAlert("Success", "Post shared to facebook");
|
||||
} else {
|
||||
return utils.showError("Error", "Failure sharing post");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return utils.showError("Error", "Failure sharing post");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
@@ -4,7 +4,4 @@ define ['backbone', 'models/mix/mixItem', 'app.lib/backbone.dss.model.collection
|
||||
model: MixItem
|
||||
url:com.podnoms.settings.urlRoot + "mix/"
|
||||
|
||||
_parse: (data) ->
|
||||
console.log("MixCollection: parse")
|
||||
|
||||
MixCollection
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
// Generated by CoffeeScript 1.6.2
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
(function() {
|
||||
var __hasProp = {}.hasOwnProperty,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||
|
||||
define(['backbone', 'models/mix/mixItem', 'app.lib/backbone.dss.model.collection'], function(Backbone, MixItem, DssCollection) {
|
||||
var MixCollection, _ref;
|
||||
|
||||
var MixCollection;
|
||||
MixCollection = (function(_super) {
|
||||
|
||||
__extends(MixCollection, _super);
|
||||
|
||||
function MixCollection() {
|
||||
_ref = MixCollection.__super__.constructor.apply(this, arguments);
|
||||
return _ref;
|
||||
return MixCollection.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
MixCollection.prototype.model = MixItem;
|
||||
|
||||
MixCollection.prototype.url = com.podnoms.settings.urlRoot + "mix/";
|
||||
|
||||
MixCollection.prototype._parse = function(data) {
|
||||
return console.log("MixCollection: parse");
|
||||
};
|
||||
|
||||
return MixCollection;
|
||||
|
||||
})(DssCollection);
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
define ['backbone', 'vent', 'models/notifications/notificationItem', 'app.lib/backbone.dss.model.collection'], \
|
||||
(Backbone, vent, NotificationItem, DssCollection) ->
|
||||
class NotificationCollection extends DssCollection
|
||||
page: 0
|
||||
model: NotificationItem
|
||||
limit: 5
|
||||
url: ->
|
||||
com.podnoms.settings.urlRoot + "notification/?limit=" + @limit + "&offset=" + Math.max(@page-1, 0) * @limit
|
||||
define ['backbone', 'vent',
|
||||
'models/notifications/notificationItem', 'app.lib/backbone.dss.model.collection'],
|
||||
(Backbone, vent,
|
||||
NotificationItem, DssCollection) ->
|
||||
class NotificationCollection extends DssCollection
|
||||
page: 0
|
||||
model: NotificationItem
|
||||
limit: 5
|
||||
url: ->
|
||||
com.podnoms.settings.urlRoot + "notification/?limit=" + @limit + "&offset=" + Math.max(@page - 1,
|
||||
0) * @limit
|
||||
|
||||
initialize: ->
|
||||
@listenTo vent, "model:notification:new", (url) =>
|
||||
console.log("NotificationCollection: notification:new")
|
||||
item = new NotificationItem()
|
||||
item.fetch
|
||||
url: url
|
||||
success: (response) =>
|
||||
console.log("NotificationCollection: item fetched")
|
||||
console.log(response)
|
||||
@add response
|
||||
initialize: ->
|
||||
@listenTo vent, "model:notification:new", (url) =>
|
||||
console.log("NotificationCollection: notification:new")
|
||||
item = new NotificationItem()
|
||||
item.fetch
|
||||
url: url
|
||||
success: (response) =>
|
||||
console.log("NotificationCollection: item fetched")
|
||||
console.log(response)
|
||||
@add response
|
||||
|
||||
comparator: (item)->
|
||||
-item.id
|
||||
comparator: (item)->
|
||||
-item.id
|
||||
|
||||
NotificationCollection
|
||||
NotificationCollection
|
||||
@@ -1,17 +1,16 @@
|
||||
// Generated by CoffeeScript 1.6.2
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
(function() {
|
||||
var __hasProp = {}.hasOwnProperty,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||
|
||||
define(['backbone', 'vent', 'models/notifications/notificationItem', 'app.lib/backbone.dss.model.collection'], function(Backbone, vent, NotificationItem, DssCollection) {
|
||||
var NotificationCollection, _ref;
|
||||
|
||||
var NotificationCollection;
|
||||
NotificationCollection = (function(_super) {
|
||||
|
||||
__extends(NotificationCollection, _super);
|
||||
|
||||
function NotificationCollection() {
|
||||
_ref = NotificationCollection.__super__.constructor.apply(this, arguments);
|
||||
return _ref;
|
||||
return NotificationCollection.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
NotificationCollection.prototype.page = 0;
|
||||
@@ -26,10 +25,8 @@
|
||||
|
||||
NotificationCollection.prototype.initialize = function() {
|
||||
var _this = this;
|
||||
|
||||
return this.listenTo(vent, "model:notification:new", function(url) {
|
||||
var item;
|
||||
|
||||
console.log("NotificationCollection: notification:new");
|
||||
item = new NotificationItem();
|
||||
return item.fetch({
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
define ['moment', 'app', 'vent', 'marionette', 'utils', 'models/comment/commentCollection', 'views/comment/commentListView', 'text!/tpl/MixListItemView'],
|
||||
(moment, App, vent, Marionette, utils, CommentsCollection, CommentsListView, Template) ->
|
||||
define ['moment', 'app', 'vent', 'marionette', 'utils',
|
||||
'models/comment/commentCollection',
|
||||
'views/comment/commentListView',
|
||||
'text!/tpl/MixListItemView'],
|
||||
(moment, App, vent, Marionette, utils,
|
||||
CommentsCollection,
|
||||
CommentsListView,
|
||||
Template) ->
|
||||
class MixItemView extends Marionette.ItemView
|
||||
template: _.template(Template)
|
||||
tagName: @tagName or "li"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Generated by CoffeeScript 1.3.3
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
(function() {
|
||||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
||||
__hasProp = {}.hasOwnProperty,
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
define [
|
||||
'marionette', 'vent',
|
||||
'models/user/userItem',
|
||||
'models/user/userItem', 'models/mix/mixCollection'
|
||||
'views/widgets/mixTabHeaderView', 'views/user/userItemView', 'views/mix/mixListView',
|
||||
'text!/tpl/MixListLayoutView'],
|
||||
(Marionette, vent,
|
||||
UserItem,
|
||||
UserItem, MixCollection,
|
||||
MixTabHeaderView, UserItemView, MixListView,
|
||||
Template) ->
|
||||
|
||||
class MixListRegionView extends Marionette.Layout
|
||||
class MixListLayout extends Marionette.Layout
|
||||
template: _.template(Template)
|
||||
regions:{
|
||||
regions: {
|
||||
headerRegion: "#mix-list-heading"
|
||||
bodyRegion: "#mix-list-body"
|
||||
}
|
||||
@@ -18,12 +17,17 @@ define [
|
||||
initialize: ->
|
||||
@listenTo(vent, "mix:showlist", @showMixList)
|
||||
@listenTo(vent, "user:showdetail", @showUserView)
|
||||
@showMixList(@options)
|
||||
|
||||
onShow: ->
|
||||
@headerRegion.show(new MixTabHeaderView())
|
||||
|
||||
showMixList: (options)->
|
||||
@bodyRegion.show(new MixListView(options))
|
||||
@collection = new MixCollection()
|
||||
@collection.fetch
|
||||
data: @options
|
||||
success: (collection)=>
|
||||
@bodyRegion.show(new MixListView({collection: collection}))
|
||||
|
||||
showUserView: (options) ->
|
||||
@bodyRegion.show(new MixListView(options))
|
||||
@@ -32,4 +36,5 @@ define [
|
||||
success: =>
|
||||
@headerRegion.show(new UserItemView({model: user}))
|
||||
)
|
||||
MixListRegionView
|
||||
|
||||
MixListLayout
|
||||
@@ -1,43 +1,51 @@
|
||||
// Generated by CoffeeScript 1.6.2
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
(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', 'views/widgets/mixTabHeaderView', 'views/user/userItemView', 'views/mix/mixListView', 'text!/tpl/MixListLayoutView'], function(Marionette, vent, UserItem, MixTabHeaderView, UserItemView, MixListView, Template) {
|
||||
var MixListRegionView, _ref;
|
||||
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) {
|
||||
|
||||
MixListRegionView = (function(_super) {
|
||||
__extends(MixListRegionView, _super);
|
||||
__extends(MixListLayout, _super);
|
||||
|
||||
function MixListRegionView() {
|
||||
_ref = MixListRegionView.__super__.constructor.apply(this, arguments);
|
||||
return _ref;
|
||||
function MixListLayout() {
|
||||
return MixListLayout.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
MixListRegionView.prototype.template = _.template(Template);
|
||||
MixListLayout.prototype.template = _.template(Template);
|
||||
|
||||
MixListRegionView.prototype.regions = {
|
||||
MixListLayout.prototype.regions = {
|
||||
headerRegion: "#mix-list-heading",
|
||||
bodyRegion: "#mix-list-body"
|
||||
};
|
||||
|
||||
MixListRegionView.prototype.initialize = function() {
|
||||
MixListLayout.prototype.initialize = function() {
|
||||
this.listenTo(vent, "mix:showlist", this.showMixList);
|
||||
return this.listenTo(vent, "user:showdetail", this.showUserView);
|
||||
this.listenTo(vent, "user:showdetail", this.showUserView);
|
||||
return this.showMixList(this.options);
|
||||
};
|
||||
|
||||
MixListRegionView.prototype.onShow = function() {
|
||||
MixListLayout.prototype.onShow = function() {
|
||||
return this.headerRegion.show(new MixTabHeaderView());
|
||||
};
|
||||
|
||||
MixListRegionView.prototype.showMixList = function(options) {
|
||||
return this.bodyRegion.show(new MixListView(options));
|
||||
MixListLayout.prototype.showMixList = function(options) {
|
||||
var _this = this;
|
||||
this.collection = new MixCollection();
|
||||
return this.collection.fetch({
|
||||
data: this.options,
|
||||
success: function(collection) {
|
||||
return _this.bodyRegion.show(new MixListView({
|
||||
collection: collection
|
||||
}));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
MixListRegionView.prototype.showUserView = function(options) {
|
||||
MixListLayout.prototype.showUserView = function(options) {
|
||||
var user,
|
||||
_this = this;
|
||||
|
||||
this.bodyRegion.show(new MixListView(options));
|
||||
user = new UserItem({
|
||||
id: options.user
|
||||
@@ -51,10 +59,10 @@
|
||||
});
|
||||
};
|
||||
|
||||
return MixListRegionView;
|
||||
return MixListLayout;
|
||||
|
||||
})(Marionette.Layout);
|
||||
return MixListRegionView;
|
||||
return MixListLayout;
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
@@ -9,13 +9,6 @@ define ['marionette', 'vent', 'models/mix/mixCollection', 'views/mix/mixItemView
|
||||
|
||||
currentMix = -1
|
||||
|
||||
initialize: ->
|
||||
@collection = new MixCollection()
|
||||
@collection.fetch
|
||||
data: @options
|
||||
|
||||
return
|
||||
|
||||
mixPlay: (model) ->
|
||||
if currentMix != -1
|
||||
v = @children.findByModelCid(currentMix)
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
// Generated by CoffeeScript 1.6.2
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
(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, _ref;
|
||||
|
||||
var MixListView;
|
||||
MixListView = (function(_super) {
|
||||
var currentMix;
|
||||
|
||||
__extends(MixListView, _super);
|
||||
|
||||
function MixListView() {
|
||||
_ref = MixListView.__super__.constructor.apply(this, arguments);
|
||||
return _ref;
|
||||
return MixListView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
MixListView.prototype.template = _.template(Template);
|
||||
@@ -26,16 +24,8 @@
|
||||
|
||||
currentMix = -1;
|
||||
|
||||
MixListView.prototype.initialize = function() {
|
||||
this.collection = new MixCollection();
|
||||
this.collection.fetch({
|
||||
data: this.options
|
||||
});
|
||||
};
|
||||
|
||||
MixListView.prototype.mixPlay = function(model) {
|
||||
var v;
|
||||
|
||||
if (currentMix !== -1) {
|
||||
v = this.children.findByModelCid(currentMix);
|
||||
v.mixStop(v.model);
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
// Generated by CoffeeScript 1.3.3
|
||||
(function() {
|
||||
var __hasProp = {}.hasOwnProperty,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||
|
||||
define(['app', 'toastr', 'app.lib/editableView', 'moment', 'utils', 'backbone.syphon', 'text!/tpl/UserEditView'], function(App, toastr, EditableView, moment, utils, Syphon, Template) {
|
||||
var UserEditView;
|
||||
UserEditView = (function(_super) {
|
||||
|
||||
__extends(UserEditView, _super);
|
||||
|
||||
function UserEditView() {
|
||||
return UserEditView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
UserEditView.prototype.template = _.template(Template);
|
||||
|
||||
UserEditView.prototype.events = {
|
||||
"click #save-changes": "saveChanges",
|
||||
"change input[type=radio]": "selectAvatar"
|
||||
};
|
||||
|
||||
UserEditView.prototype.onRender = function() {
|
||||
var avatarType;
|
||||
console.log("MixEditView: onRender");
|
||||
avatarType = this.model.get('avatar_type');
|
||||
$('#avatar_' + avatarType, this.el).attr('checked', true);
|
||||
if (avatarType === "custom") {
|
||||
$("#div_avatar_image_upload", this.el).show();
|
||||
} else {
|
||||
$("#div_avatar_image_upload", this.el).hide();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
UserEditView.prototype.selectAvatar = function(evt) {
|
||||
var type;
|
||||
type = $(evt.currentTarget).val();
|
||||
this.model.set("avatar_type", type);
|
||||
if (type === "custom") {
|
||||
return $("#custom_avatar_helptext", this.el).show();
|
||||
} else {
|
||||
return $("#custom_avatar_helptext", this.el).hide();
|
||||
}
|
||||
};
|
||||
|
||||
UserEditView.prototype.saveChanges = function() {
|
||||
var data, ref;
|
||||
data = Backbone.Syphon.serialize(this);
|
||||
this.model.set(data);
|
||||
ref = this;
|
||||
this._saveChanges({
|
||||
success: function() {
|
||||
var _this = this;
|
||||
if (ref.model.get('avatar_type') === "custom") {
|
||||
$.ajaxFileUpload({
|
||||
url: "ajax/upload_avatar_image/",
|
||||
secureuri: false,
|
||||
fileElementId: "mix_image",
|
||||
success: function(data, status) {
|
||||
if (typeof data.error !== "undefined") {
|
||||
if (data.error !== "") {
|
||||
return alert(data.error);
|
||||
} else {
|
||||
return alert(data.msg);
|
||||
}
|
||||
} else {
|
||||
$("#mix-details", _this.el).hide();
|
||||
return Backbone.history.navigate("/", {
|
||||
trigger: true
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(data, status, e) {
|
||||
return utils.showError(e);
|
||||
}
|
||||
});
|
||||
this.uploadImage({
|
||||
el: $('#avatar_image'),
|
||||
success: function() {
|
||||
utils.showMessage("Successfully updated yourself");
|
||||
return Backbone.history.navigate("/", {
|
||||
trigger: true
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
toastr.info("Successfully updated yourself");
|
||||
Backbone.history.navigate("/", {
|
||||
trigger: true
|
||||
});
|
||||
}
|
||||
return true;
|
||||
},
|
||||
error: function() {
|
||||
toastr.error("There was an error updating your info. Please try again later.");
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
false;
|
||||
|
||||
return UserEditView;
|
||||
|
||||
})(EditableView);
|
||||
return UserEditView;
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
var socket = new io.Socket({host: 'ext-test.deepsouthsounds.com', resource: 'socket.io', port: '8000', rememberTransport: false});
|
||||
socket.connect();
|
||||
|
||||
@@ -36,3 +37,4 @@ function message (from, msg) {
|
||||
console.log(msg);
|
||||
$('#lines').append($('<p>').append($('<b>').text(from), msg));
|
||||
}
|
||||
*/
|
||||
@@ -22,7 +22,7 @@ requirejs.config({
|
||||
ace: 'lib/ace',
|
||||
wysiwyg: 'lib/bootstrap-wysiwyg',
|
||||
'ace-editable': 'lib/ace-editable',
|
||||
'facebook': '//connect.facebook.net/en_US/all',
|
||||
//'facebook': '//connect.facebook.net/en_US/all',
|
||||
|
||||
/*File upload */
|
||||
/*TOOD: Move this to a shim */
|
||||
@@ -61,10 +61,10 @@ requirejs.config({
|
||||
bootstrap: {
|
||||
exports: 'bootstrap',
|
||||
deps: ['jquery']
|
||||
},
|
||||
}/*,
|
||||
'facebook': {
|
||||
export: 'FB'
|
||||
},
|
||||
}*/,
|
||||
'ace': {
|
||||
exports: 'ace',
|
||||
deps: ['jquery', 'lib/ace-elements', 'lib/ace-extra']
|
||||
|
||||
Reference in New Issue
Block a user