mirror of
https://github.com/fergalmoran/dss.git
synced 2025-12-22 09:38:18 +00:00
New header functions
This commit is contained in:
2
INSTALL
2
INSTALL
@@ -1,6 +1,6 @@
|
||||
#curl -u hb_client_2862_1:j2CbCM8H -H 'Accept: application/json' -H 'Content-type: application/json' http://c1.lon2.dediserve.com/virtual_machines.xml
|
||||
|
||||
apt-get install git python-virtualenv postgresql postgresql-client postgresql-client-common postgresql-dev-all rabbitmq-server libsndfile1-dev libpng++-dev libpng12-dev libboost-program-options-dev libjpeg-dev
|
||||
apt-get install git python-virtualenv postgresql postgresql-client postgresql-client-common postgresql-dev-all rabbitmq-server libsndfile1-dev libpng++-dev libpng12-dev libboost-program-options-dev libjpeg-dev python-dev
|
||||
|
||||
virtualenv env
|
||||
source env/bin/activate
|
||||
|
||||
@@ -14,7 +14,10 @@ def generate_waveform(input_file, output_file):
|
||||
print "Finished decode"
|
||||
if os.path.exists(working_file):
|
||||
print "Starting waveform generation"
|
||||
ret = subprocess.call([settings.DSS_WAVE_PATH, "-w", "800", "-h", "120", "-o", output_file, working_file], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
ret = subprocess.call([
|
||||
settings.DSS_WAVE_PATH, "-w", "800", "-h", "120", "-o",
|
||||
output_file,
|
||||
working_file], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
if os.path.isfile(output_file):
|
||||
os.remove(working_file)
|
||||
print "Generated waveform"
|
||||
|
||||
@@ -70,8 +70,10 @@ def session_pre_save(sender, **kwargs):
|
||||
if s is not None:
|
||||
uid = s.get_decoded().get('_auth_user_id')
|
||||
if uid is not None:
|
||||
user = User.objects.get(pk=uid)
|
||||
if user is not None:
|
||||
try:
|
||||
user = User.objects.get(pk=uid)
|
||||
p = user.get_profile()
|
||||
p.last_known_session = s.session_key
|
||||
p.save()
|
||||
except ObjectDoesNotExist:
|
||||
pass
|
||||
@@ -37,9 +37,8 @@ urlpatterns = patterns(
|
||||
|
||||
url(r'^js/(?P<template_name>\w+)/$', 'spa.templates.get_javascript'),
|
||||
url(r'^tplex/(?P<template_name>\w+)/$', 'spa.templates.get_template_ex'),
|
||||
url(r'^podcast\.xml', 'spa.podcast.get_default_podcast'),
|
||||
url(r'^podcast', 'spa.podcast.get_default_podcast'),
|
||||
url(r'^podcasts', 'spa.podcast.get_default_podcast'),
|
||||
url(r'^podcast\.xml', 'spa.podcast.get_default_podcast'),
|
||||
url(r'^social/', include('spa.social.urls')),
|
||||
url(r'^embed/', include('spa.embedding.urls')),
|
||||
url(r'_upload/', 'spa.ajax.upload', name='jfu_upload'),
|
||||
|
||||
@@ -65,6 +65,16 @@ define ['backbone', 'marionette', 'vent', 'utils',
|
||||
model.save 'liked', !model.get('liked'), patch: true
|
||||
true
|
||||
|
||||
@listenTo vent, "mix:delete", (model) ->
|
||||
console.log "App(vent): mix:like"
|
||||
utils.messageBox "/dlg/DeleteMixConfirm"
|
||||
yes: ->
|
||||
console.log("Controller: mixDeleteYES!!")
|
||||
mix.destroy()
|
||||
Backbone.history.navigate "/", trigger: true
|
||||
no: ->
|
||||
console.log("Controller: mixDeleteNO!!")
|
||||
|
||||
@listenTo vent, "user:follow", (model)->
|
||||
console.log "App(vent): user:follow"
|
||||
user = new UserItem({id: com.podnoms.settings.currentUser })
|
||||
@@ -106,7 +116,6 @@ define ['backbone', 'marionette', 'vent', 'utils',
|
||||
social.generateEmbedCode(model)
|
||||
|
||||
true
|
||||
|
||||
App.headerRegion.show(new HeaderView());
|
||||
sidebarView = new SidebarView();
|
||||
App.sidebarRegion.show(sidebarView)
|
||||
|
||||
@@ -71,6 +71,21 @@
|
||||
});
|
||||
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, "user:follow", function(model) {
|
||||
var target, user,
|
||||
_this = this;
|
||||
|
||||
@@ -40,6 +40,7 @@ define ['app', 'marionette', 'vent', 'utils'
|
||||
app.contentRegion.show(new MixDetailView({model: mix}))
|
||||
)
|
||||
Backbone.history.navigate "/random", trigger: false
|
||||
|
||||
uploadMix: ->
|
||||
console.log("Controller: mixUpload")
|
||||
app = require('app')
|
||||
|
||||
@@ -1,64 +1,78 @@
|
||||
// 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(['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;
|
||||
|
||||
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/mixItem', 'models/mix/mixCollection', 'models/user/userItem'], function(App, Marionette, vent, utils, MixListLayout, MixListView, MixDetailView, MixEditView, UserProfileView, UserListView, UserEditView, MixItem, MixCollection, UserItem) {
|
||||
var DssController;
|
||||
DssController = (function(_super) {
|
||||
|
||||
__extends(DssController, _super);
|
||||
|
||||
function DssController() {
|
||||
_ref = DssController.__super__.constructor.apply(this, arguments);
|
||||
return _ref;
|
||||
return DssController.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
DssController.prototype.initialize = function() {
|
||||
return this.listenTo(vent, "mix:random", this.showRandomMix);
|
||||
};
|
||||
|
||||
DssController.prototype.home = function() {
|
||||
console.log("Controller: home");
|
||||
this.showMixList();
|
||||
return true;
|
||||
return this.showMixList();
|
||||
};
|
||||
|
||||
DssController.prototype.showMixList = function(options) {
|
||||
var app;
|
||||
|
||||
app = require('app');
|
||||
app.contentRegion.show(new MixListLayout(options || {
|
||||
return app.contentRegion.show(new MixListLayout(options || {
|
||||
order_by: 'latest'
|
||||
}));
|
||||
return true;
|
||||
};
|
||||
|
||||
DssController.prototype.showMixListType = function(type) {
|
||||
this.showMixList({
|
||||
return this.showMixList({
|
||||
order_by: type
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
DssController.prototype.showMix = function(slug) {
|
||||
var app, mix;
|
||||
|
||||
console.log("Controller: showMix");
|
||||
app = require('app');
|
||||
mix = new MixItem({
|
||||
id: slug
|
||||
});
|
||||
mix.fetch({
|
||||
return mix.fetch({
|
||||
success: function() {
|
||||
app.contentRegion.show(new MixDetailView({
|
||||
return app.contentRegion.show(new MixDetailView({
|
||||
model: mix
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
DssController.prototype.showRandomMix = function() {
|
||||
var app, mix;
|
||||
console.log("Controller: showRandomMix");
|
||||
app = require('app');
|
||||
mix = new MixItem({
|
||||
id: 'random'
|
||||
});
|
||||
mix.fetch({
|
||||
success: function() {
|
||||
return app.contentRegion.show(new MixDetailView({
|
||||
model: mix
|
||||
}));
|
||||
}
|
||||
});
|
||||
return Backbone.history.navigate("/random", {
|
||||
trigger: false
|
||||
});
|
||||
};
|
||||
|
||||
DssController.prototype.uploadMix = function() {
|
||||
var app, mix;
|
||||
|
||||
console.log("Controller: mixUpload");
|
||||
app = require('app');
|
||||
mix = new MixItem({
|
||||
@@ -75,7 +89,6 @@
|
||||
|
||||
DssController.prototype.editMix = function(slug) {
|
||||
var app, mix;
|
||||
|
||||
console.log("Controller: mixEdit");
|
||||
app = require('app');
|
||||
mix = new MixItem({
|
||||
@@ -93,7 +106,6 @@
|
||||
|
||||
DssController.prototype.showChat = function() {
|
||||
var app;
|
||||
|
||||
console.log("Controller: showChat");
|
||||
app = require('app');
|
||||
return app.contentRegion.show(new ChatView());
|
||||
@@ -101,7 +113,6 @@
|
||||
|
||||
DssController.prototype.showUserList = function() {
|
||||
var app;
|
||||
|
||||
console.log("Controller: showUserList");
|
||||
app = require('app');
|
||||
return app.contentRegion.show(new UserListView());
|
||||
@@ -109,7 +120,6 @@
|
||||
|
||||
DssController.prototype.showUserProfile = function(slug) {
|
||||
var app, user;
|
||||
|
||||
console.log("Controller: showUserProfile");
|
||||
app = require('app');
|
||||
user = new UserItem({
|
||||
@@ -153,7 +163,6 @@
|
||||
|
||||
DssController.prototype.showUserFollowing = function(slug) {
|
||||
var app;
|
||||
|
||||
console.log("Controller: showUserFollowing");
|
||||
app = require('app');
|
||||
return app.contentRegion.show(new UserListView({
|
||||
@@ -163,7 +172,6 @@
|
||||
|
||||
DssController.prototype.showUserFollowers = function(slug) {
|
||||
var app;
|
||||
|
||||
console.log("Controller: showUserFollowers");
|
||||
app = require('app');
|
||||
return app.contentRegion.show(new UserListView({
|
||||
@@ -173,7 +181,6 @@
|
||||
|
||||
DssController.prototype.editUser = function() {
|
||||
var app, user;
|
||||
|
||||
console.log("Controller: editUser");
|
||||
app = require('app');
|
||||
user = new UserItem({
|
||||
|
||||
@@ -3,9 +3,17 @@ define ['vent', 'socket.io'],
|
||||
class RealtimeController
|
||||
startSocketIO: ->
|
||||
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'])
|
||||
@socket = SocketIO.connect(com.podnoms.settings.REALTIME_HOST);
|
||||
|
||||
@socket.on 'connect', ->
|
||||
console.log("RealtimeController: Socket connected")
|
||||
@socket.emit('client-reg', {sessionId: com.podnoms.settings.currentUser, userName: com.podnoms.settings.userName})
|
||||
|
||||
@socket.on "server-session", (data) =>
|
||||
if data
|
||||
console.log("RealtimeController: Connected " + data['sessionId'])
|
||||
else
|
||||
console.log("RealtimeController: Can't read sessionId from socket")
|
||||
|
||||
"""
|
||||
@socket.on "activity", (data) =>
|
||||
|
||||
@@ -11,8 +11,20 @@
|
||||
var _this = this;
|
||||
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']);
|
||||
this.socket.on('connect', function() {
|
||||
var _this = this;
|
||||
console.log("RealtimeController: Socket connected");
|
||||
this.socket.emit('client-reg', {
|
||||
sessionId: com.podnoms.settings.currentUser,
|
||||
userName: com.podnoms.settings.userName
|
||||
});
|
||||
return this.socket.on("server-session", function(data) {
|
||||
if (data) {
|
||||
return console.log("RealtimeController: Connected " + data['sessionId']);
|
||||
} else {
|
||||
return console.log("RealtimeController: Can't read sessionId from socket");
|
||||
}
|
||||
});
|
||||
});
|
||||
"@socket.on \"activity\", (data) =>\n console.log(\"RealtimeController: activity \" + data['message'])\n vent.trigger(\"model:activity:new\", data['message'])";
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ define ['marionette', 'vent', 'app.lib/controller'],
|
||||
"mix/edit/:slug": "editMix",
|
||||
|
||||
"chat": "showChat",
|
||||
#"random": "showRandomMix",
|
||||
|
||||
"users": "showUserList"
|
||||
"user/:slug/favourites": "showUserFavourites"
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
(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);
|
||||
|
||||
@@ -5,6 +5,26 @@ define ['jquery', 'bootstrap', 'toastr'], ($, bootstrap, toastr) ->
|
||||
$(url).modal "open"
|
||||
else
|
||||
$.get(url,(data) ->
|
||||
$(data).modal().on "hidden", ->
|
||||
$(this).remove()
|
||||
true
|
||||
$(data).proceed().on "hidden", ->
|
||||
alert("Go on so")
|
||||
true
|
||||
).success ->
|
||||
$("input:text:visible:first").focus()
|
||||
true
|
||||
true
|
||||
|
||||
messageBox: (url) ->
|
||||
if url
|
||||
if url.indexOf("#") is 0
|
||||
$(url).modal "open"
|
||||
else
|
||||
$.get(url,(data) ->
|
||||
$("#yes-no-positive", data).click ->
|
||||
alert("Oh yes")
|
||||
|
||||
$(data).modal().on "hidden", ->
|
||||
$(this).remove()
|
||||
true
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Generated by CoffeeScript 1.6.2
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
(function() {
|
||||
|
||||
define(['jquery', 'bootstrap', 'toastr'], function($, bootstrap, toastr) {
|
||||
return {
|
||||
modal: function(url) {
|
||||
@@ -8,6 +9,31 @@
|
||||
$(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 true;
|
||||
},
|
||||
messageBox: function(url) {
|
||||
if (url) {
|
||||
if (url.indexOf("#") === 0) {
|
||||
$(url).modal("open");
|
||||
} else {
|
||||
$.get(url, function(data) {
|
||||
$("#yes-no-positive", data).click(function() {
|
||||
return alert("Oh yes");
|
||||
});
|
||||
return $(data).modal().on("hidden", function() {
|
||||
$(this).remove();
|
||||
return true;
|
||||
@@ -22,7 +48,6 @@
|
||||
},
|
||||
checkPlayCount: function() {
|
||||
var _this = this;
|
||||
|
||||
if (document.cookie.indexOf("sessionId")) {
|
||||
$.getJSON("/ajax/session_play_count", function(data) {
|
||||
console.log("utils: got playcount");
|
||||
@@ -48,7 +73,6 @@
|
||||
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);
|
||||
@@ -56,7 +80,6 @@
|
||||
},
|
||||
downloadURL: function(url) {
|
||||
var iframe;
|
||||
|
||||
iframe = document.getElementById("hiddenDownloader");
|
||||
if (iframe === null) {
|
||||
iframe = document.createElement("iframe");
|
||||
|
||||
@@ -2,6 +2,6 @@ define ['backbone', 'models/mix/mixItem', 'app.lib/backbone.dss.model.collection
|
||||
(Backbone, MixItem, DssCollection) ->
|
||||
class MixCollection extends DssCollection
|
||||
model: MixItem
|
||||
url:com.podnoms.settings.urlRoot + "mix/"
|
||||
url:com.podnoms.settings.urlRoot + "mix/?limit=5"
|
||||
|
||||
MixCollection
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
MixCollection.prototype.model = MixItem;
|
||||
|
||||
MixCollection.prototype.url = com.podnoms.settings.urlRoot + "mix/";
|
||||
MixCollection.prototype.url = com.podnoms.settings.urlRoot + "mix/?limit=5";
|
||||
|
||||
return MixCollection;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -16,6 +16,7 @@ define ['moment', 'app', 'vent', 'marionette', 'utils',
|
||||
"click .play-button-small-resume": "doResume",
|
||||
"click .play-button-small-pause": "doPause",
|
||||
"click .mix-link": "mixLink",
|
||||
"click .delete-button a": "mixDelete",
|
||||
"click .like-button a": "mixLike",
|
||||
"click .favourite-button a": "mixFavourite",
|
||||
"click .share-button": "mixShare",
|
||||
@@ -119,6 +120,10 @@ define ['moment', 'app', 'vent', 'marionette', 'utils',
|
||||
vent.trigger("mix:favourite", @model)
|
||||
true
|
||||
|
||||
mixDelete: ->
|
||||
console.log("MixItemView: mixDelete")
|
||||
vent.trigger("mix:delete", @model)
|
||||
|
||||
mixLike: ->
|
||||
console.log("MixItemView: likeMix")
|
||||
vent.trigger("mix:like", @model)
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
"click .play-button-small-resume": "doResume",
|
||||
"click .play-button-small-pause": "doPause",
|
||||
"click .mix-link": "mixLink",
|
||||
"click .delete-button a": "mixDelete",
|
||||
"click .like-button a": "mixLike",
|
||||
"click .favourite-button a": "mixFavourite",
|
||||
"click .share-button": "mixShare",
|
||||
@@ -143,6 +144,11 @@
|
||||
return true;
|
||||
};
|
||||
|
||||
MixItemView.prototype.mixDelete = function() {
|
||||
console.log("MixItemView: mixDelete");
|
||||
return vent.trigger("mix:delete", this.model);
|
||||
};
|
||||
|
||||
MixItemView.prototype.mixLike = function() {
|
||||
console.log("MixItemView: likeMix");
|
||||
vent.trigger("mix:like", this.model);
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
// 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(['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);
|
||||
|
||||
@@ -16,6 +16,7 @@ define ["underscore", "marionette", "vent", "utils", "views/widgets/searchView",
|
||||
template: _.template(Template)
|
||||
className: "navbar navbar-default"
|
||||
events:
|
||||
"click #header-random-button": "showRandom"
|
||||
"click #header-play-pause-button": "togglePlayState"
|
||||
"click #header-login-button": "login"
|
||||
"click #header-donate-button": "donate"
|
||||
@@ -40,11 +41,14 @@ define ["underscore", "marionette", "vent", "utils", "views/widgets/searchView",
|
||||
if com.podnoms.settings.currentUser != -1
|
||||
@notificationsRegion.show(new NotificationsListView())
|
||||
|
||||
showRandom: ->
|
||||
console.log("headerView: showRandom")
|
||||
vent.trigger("mix:random")
|
||||
|
||||
login: ->
|
||||
vent.trigger('app:login')
|
||||
|
||||
donate: ->
|
||||
console.log("headerView: donate")
|
||||
vent.trigger('app:donate')
|
||||
|
||||
logout: ->
|
||||
|
||||
@@ -36,6 +36,7 @@ Code provided under the BSD License:
|
||||
HeaderView.prototype.className = "navbar navbar-default";
|
||||
|
||||
HeaderView.prototype.events = {
|
||||
"click #header-random-button": "showRandom",
|
||||
"click #header-play-pause-button": "togglePlayState",
|
||||
"click #header-login-button": "login",
|
||||
"click #header-donate-button": "donate",
|
||||
@@ -67,12 +68,16 @@ Code provided under the BSD License:
|
||||
}
|
||||
};
|
||||
|
||||
HeaderView.prototype.showRandom = function() {
|
||||
console.log("headerView: showRandom");
|
||||
return vent.trigger("mix:random");
|
||||
};
|
||||
|
||||
HeaderView.prototype.login = function() {
|
||||
return vent.trigger('app:login');
|
||||
};
|
||||
|
||||
HeaderView.prototype.donate = function() {
|
||||
console.log("headerView: donate");
|
||||
return vent.trigger('app:donate');
|
||||
};
|
||||
|
||||
|
||||
@@ -4,31 +4,6 @@ jQuery(function($) {
|
||||
window['ace'].click_event = $.fn.tap ? "tap" : "click";
|
||||
});
|
||||
|
||||
jQuery(function($) {
|
||||
//ace.click_event defined in ace-elements.js
|
||||
ace.handle_side_menu(jQuery);
|
||||
|
||||
ace.enable_search_ahead(jQuery);
|
||||
|
||||
ace.general_things(jQuery);//and settings
|
||||
|
||||
ace.widget_boxes(jQuery);
|
||||
ace.widget_reload_handler(jQuery);//this is for demo only, you can remove and have your own function, please see examples/widget.html
|
||||
|
||||
/**
|
||||
//make sidebar scrollbar when it is fixed and some parts of it is out of view
|
||||
//>> you should include jquery-ui and slimscroll javascript files in your file
|
||||
//>> you can call this function when sidebar is clicked to be fixed
|
||||
$('.nav-list').slimScroll({
|
||||
height: '400px',
|
||||
distance:0,
|
||||
size : '6px'
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
|
||||
|
||||
ace.handle_side_menu = function($) {
|
||||
$('#menu-toggler').on(ace.click_event, function() {
|
||||
$('#sidebar').toggleClass('display');
|
||||
@@ -183,7 +158,7 @@ ace.general_things = function($) {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -212,7 +187,7 @@ ace.widget_boxes = function($) {
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
$(document).on('click.ace.widget', '[data-action]', function (ev) {
|
||||
@@ -291,7 +266,7 @@ ace.widget_boxes = function($) {
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ace.widget_reload_handler = function($) {
|
||||
@@ -315,7 +290,7 @@ ace.widget_reload_handler = function($) {
|
||||
$(this).trigger('reloaded.ace.widget');
|
||||
});
|
||||
*/
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -332,7 +307,7 @@ ace.enable_search_ahead = function($) {
|
||||
}
|
||||
});
|
||||
} catch(e) {}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -384,4 +359,28 @@ ace.switch_direction = function($) {
|
||||
var pos = $(document.body).hasClass('rtl') ? 'nw' : 'ne';//draw on north-west or north-east?
|
||||
placeholder.data('draw').call(placeholder.get(0) , placeholder, placeholder.data('chart'), pos);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
jQuery(function($) {
|
||||
//ace.click_event defined in ace-elements.js
|
||||
ace.handle_side_menu(jQuery);
|
||||
|
||||
ace.enable_search_ahead(jQuery);
|
||||
|
||||
ace.general_things(jQuery);//and settings
|
||||
|
||||
ace.widget_boxes(jQuery);
|
||||
ace.widget_reload_handler(jQuery);//this is for demo only, you can remove and have your own function, please see examples/widget.html
|
||||
|
||||
/**
|
||||
//make sidebar scrollbar when it is fixed and some parts of it is out of view
|
||||
//>> you should include jquery-ui and slimscroll javascript files in your file
|
||||
//>> you can call this function when sidebar is clicked to be fixed
|
||||
$('.nav-list').slimScroll({
|
||||
height: '400px',
|
||||
distance:0,
|
||||
size : '6px'
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
|
||||
@@ -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']
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
</div>
|
||||
<div class="navbar-header">
|
||||
<ul class="nav ace-nav">
|
||||
<li><a href="/mixes">Mixes</a></li>
|
||||
<li><a href="/users">Users</a></li>
|
||||
<li><a href="/mixes"><i class="icon-music icon-white"></i>Mixes</a></li>
|
||||
<li><a href="/users"><i class="icon-user icon-white"></i>Users</a></li>
|
||||
<li><a data-bypass="true" id="header-random-button"><i class="icon-cogs icon-white"></i>Random</a></li>
|
||||
<li><a data-bypass="true" target="_blank" href="/podcast"><i class="icon-rss icon-white"></i>Podcast</a></li>
|
||||
{% if false %}
|
||||
<li class="purple">
|
||||
<a data-bypass="true" id="header-live-button"> Listen Live
|
||||
@@ -29,7 +31,7 @@
|
||||
</div>
|
||||
<div class="navbar-header pull-right" role="navigation">
|
||||
<ul class="nav ace-nav">
|
||||
<li><a class="btn-danger" data-bypass="true" id="header-donate-button">Donate</a></li>
|
||||
<li><a class="btn-danger" data-bypass="true" id="header-donate-button"><i class="icon-euro" />Donate</a></li>
|
||||
<li class="nav ace-nav" id="header-notifications">
|
||||
<!-- End Notifications li -->
|
||||
</li>
|
||||
@@ -77,8 +79,7 @@
|
||||
</li>
|
||||
{% else %}
|
||||
<li>
|
||||
<a data-bypass="true" id="header-login-button">Login/Signup <i
|
||||
class="icon-music icon-white"></i></a>
|
||||
<a data-bypass="true" id="header-login-button">Login/Signup</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
@@ -116,8 +116,8 @@
|
||||
<a href="/mix/edit/<%= slug %>" class="btn btn-xs"
|
||||
data-id="<%= id %>"><i class="icon-edit"></i>Edit</a>
|
||||
</div>
|
||||
<div class="edit-button footer-button footer-button-right">
|
||||
<a data-bypass="true" class="btn btn-xs btn-danger" id="mix-delete"
|
||||
<div class="delete-button footer-button footer-button-right">
|
||||
<a data-bypass="true" class="btn btn-xs btn-danger"
|
||||
data-id="<%= id %>"><i class="icon-remove"></i>Delete</a>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
18
templates/views/dlg/DeleteMixConfirm.html
Normal file
18
templates/views/dlg/DeleteMixConfirm.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% extends 'views/dlg/_DialogBase.html' %}
|
||||
|
||||
{% load account %}
|
||||
{% load static %}
|
||||
{% load socialaccount %}
|
||||
{% block header %}
|
||||
<h3>You sure about this chief??</h3>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
Hit Proceed here and your mix is gone.<br/>
|
||||
Comments, likes, favourites, all gone, never to return.
|
||||
{% endblock %}
|
||||
{% block primarybutton %}Cancel{% endblock %}
|
||||
{% block extrabuttons %}
|
||||
<a href="#" data-bypass="true" class="btn btn-success" id="yes-no-positive">
|
||||
Proceed
|
||||
</a>
|
||||
{% endblock %}
|
||||
@@ -48,4 +48,4 @@
|
||||
</button>
|
||||
</p>
|
||||
{% endblock %}
|
||||
{% block primarybutton %}Another time...{% endblock %}
|
||||
{% block positivebutton %}Another time...{% endblock %}
|
||||
@@ -22,4 +22,4 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block primarybutton %}Got it...{% endblock %}
|
||||
{% block positivebutton %}Got it...{% endblock %}
|
||||
@@ -28,4 +28,4 @@
|
||||
<h5>Please note that using a social account<br/> does not give us access to your private information</h5>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block primarybutton %}Nah...{% endblock %}
|
||||
{% block positivebutton %}Nah...{% endblock %}
|
||||
@@ -26,4 +26,4 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block primarybutton %}Okies...{% endblock %}
|
||||
{% block positivebutton %}Okies...{% endblock %}
|
||||
Reference in New Issue
Block a user