mirror of
https://github.com/fergalmoran/dss.git
synced 2025-12-26 11:37:33 +00:00
Fixed url in now playing
This commit is contained in:
@@ -64,6 +64,7 @@ def get_mix_stream_url(request, mix_id):
|
|||||||
data = {
|
data = {
|
||||||
'stream_url': mix.get_stream_path(),
|
'stream_url': mix.get_stream_path(),
|
||||||
'description': mix.description,
|
'description': mix.description,
|
||||||
|
'item_url': mix.get_absolute_url(),
|
||||||
'title': mix.title
|
'title': mix.title
|
||||||
}
|
}
|
||||||
return HttpResponse(json.dumps(data), mimetype="application/json")
|
return HttpResponse(json.dumps(data), mimetype="application/json")
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
from tastypie.authentication import Authentication
|
||||||
from tastypie.authorization import Authorization
|
from tastypie.authorization import Authorization
|
||||||
|
from tastypie.constants import ALL_WITH_RELATIONS
|
||||||
from spa.api.v1.BackboneCompatibleResource import BackboneCompatibleResource
|
from spa.api.v1.BackboneCompatibleResource import BackboneCompatibleResource
|
||||||
from spa.models import UserProfile
|
from spa.models import UserProfile
|
||||||
|
|
||||||
@@ -7,6 +9,11 @@ class UserResource(BackboneCompatibleResource):
|
|||||||
class Meta:
|
class Meta:
|
||||||
queryset = UserProfile.objects.all()
|
queryset = UserProfile.objects.all()
|
||||||
authorization = Authorization()
|
authorization = Authorization()
|
||||||
|
authentication = Authentication()
|
||||||
|
always_return_data = True
|
||||||
|
filtering = {
|
||||||
|
'user': ALL_WITH_RELATIONS,
|
||||||
|
}
|
||||||
|
|
||||||
def dehydrate(self, bundle):
|
def dehydrate(self, bundle):
|
||||||
bundle.data['display_name'] = bundle.obj.display_name
|
bundle.data['display_name'] = bundle.obj.display_name
|
||||||
@@ -15,7 +22,6 @@ class UserResource(BackboneCompatibleResource):
|
|||||||
bundle.data['email'] = bundle.obj.email
|
bundle.data['email'] = bundle.obj.email
|
||||||
return bundle
|
return bundle
|
||||||
|
|
||||||
def override_urls(self):
|
def apply_authorization_limits(self, request, object_list):
|
||||||
return [
|
if request.user is not None:
|
||||||
url(r"^(?P<resource_name>%s)/(?P<username>[\w\d_.-]+)/$" % self._meta.resource_name, self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
|
return object_list.filter(user=request.user)
|
||||||
]
|
|
||||||
@@ -62,4 +62,7 @@ class UserProfile(_BaseModel):
|
|||||||
elif avatar_type == 'custom' or avatar_type:
|
elif avatar_type == 'custom' or avatar_type:
|
||||||
return self.avatar_image.url
|
return self.avatar_image.url
|
||||||
|
|
||||||
return urlparse.urljoin(settings.STATIC_URL, "img/default-avatar-32.png")
|
return urlparse.urljoin(settings.STATIC_URL, "img/default-avatar-32.png")
|
||||||
|
|
||||||
|
def save(self, force_insert=False, force_update=False, using=None):
|
||||||
|
return super(UserProfile, self).save(force_insert, force_update, using)
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
var AppRouter = Backbone.Router.extend({
|
var AppRouter = Backbone.Router.extend({
|
||||||
routes:{
|
routes:{
|
||||||
"":"defaultRoute",
|
|
||||||
"/mixes":"mixList",
|
"/mixes":"mixList",
|
||||||
"/mixes/:type":"mixList",
|
"/mixes/:type":"mixList",
|
||||||
"/mix/:id":"mixDetails",
|
"/mix/:id":"mixDetails",
|
||||||
@@ -8,9 +7,11 @@ var AppRouter = Backbone.Router.extend({
|
|||||||
"/release/:id":"releaseDetails",
|
"/release/:id":"releaseDetails",
|
||||||
"/events":"eventList",
|
"/events":"eventList",
|
||||||
"/event/:id":"eventDetails",
|
"/event/:id":"eventDetails",
|
||||||
|
"/accounts/social/connections/":"connectAccounts",
|
||||||
"/accounts/login/":"login",
|
"/accounts/login/":"login",
|
||||||
"/accounts/logout/":"logout",
|
"/accounts/logout/":"logout",
|
||||||
"/me":"userDetails"
|
"/me":"userDetails",
|
||||||
|
"*path":"defaultRoute"
|
||||||
},
|
},
|
||||||
initialize:function () {
|
initialize:function () {
|
||||||
this.headerView = new HeaderView();
|
this.headerView = new HeaderView();
|
||||||
@@ -18,9 +19,7 @@ var AppRouter = Backbone.Router.extend({
|
|||||||
$('#site-content-fill').html('');
|
$('#site-content-fill').html('');
|
||||||
},
|
},
|
||||||
defaultRoute:function (path) {
|
defaultRoute:function (path) {
|
||||||
if (!path)
|
if (path == undefined || path == "" || path == "/")
|
||||||
this.mixList('latest');
|
|
||||||
else if (path == "" || path == "/")
|
|
||||||
this.mixList('latest');
|
this.mixList('latest');
|
||||||
},
|
},
|
||||||
mixList:function (type) {
|
mixList:function (type) {
|
||||||
@@ -107,7 +106,10 @@ var AppRouter = Backbone.Router.extend({
|
|||||||
logout:function () {
|
logout:function () {
|
||||||
window.utils.showAlert("Success", "You are now logged out", "alert-success");
|
window.utils.showAlert("Success", "You are now logged out", "alert-success");
|
||||||
},
|
},
|
||||||
userDetails: function(){
|
connectAccounts:function () {
|
||||||
|
alert("sdfkjsdlfj");
|
||||||
|
},
|
||||||
|
userDetails:function () {
|
||||||
var user = new User();
|
var user = new User();
|
||||||
$('#site-content-fill').html('');
|
$('#site-content-fill').html('');
|
||||||
user.fetch({success:function () {
|
user.fetch({success:function () {
|
||||||
@@ -118,12 +120,12 @@ var AppRouter = Backbone.Router.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
utils.loadTemplate([
|
utils.loadTemplate([
|
||||||
'HeaderView', 'SidebarView', 'UserView',
|
'HeaderView', 'SidebarView', 'UserView',
|
||||||
'MixListView', 'MixListItemView', 'MixView',
|
'MixListView', 'MixListItemView', 'MixView',
|
||||||
'CommentListView', 'CommentListItemView',
|
'CommentListView', 'CommentListItemView',
|
||||||
'ReleaseListView', 'ReleaseListItemView', 'ReleaseItemView', 'ReleaseView', 'ReleaseAudioListView', 'ReleaseAudioItemView',
|
'ReleaseListView', 'ReleaseListItemView', 'ReleaseItemView', 'ReleaseView', 'ReleaseAudioListView', 'ReleaseAudioItemView',
|
||||||
'EventListView', 'EventListItemView', 'EventView', 'EventItemView'
|
'EventListView', 'EventListItemView', 'EventView', 'EventItemView'
|
||||||
], function () {
|
], function () {
|
||||||
window.app = new AppRouter();
|
window.app = new AppRouter();
|
||||||
Backbone.history.start();
|
Backbone.history.start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,13 +59,21 @@ window.utils = {
|
|||||||
$('.help-inline', controlGroup).html('');
|
$('.help-inline', controlGroup).html('');
|
||||||
},
|
},
|
||||||
|
|
||||||
showAlert:function (title, text, klass) {
|
showAlert:function (title, text, klass, fade) {
|
||||||
$('.alert').removeClass("alert-error alert-warning alert-success alert-info");
|
$('.alert').removeClass("alert-error alert-warning alert-success alert-info");
|
||||||
$('.alert').addClass(klass);
|
$('.alert').addClass(klass);
|
||||||
$('.alert').html('<strong>' + title + '</strong> ' + text);
|
$('.alert').html('<strong>' + title + '</strong> ' + text);
|
||||||
$('.alert').show();
|
$('.alert').show();
|
||||||
|
if (fade) {
|
||||||
|
$('.alert').fadeOut(5000, function () {
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
$('.alert').click(function() {
|
||||||
|
$('.alert').fadeOut('slow', function() {
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
hideAlert:function () {
|
hideAlert:function () {
|
||||||
$('.alert').hide();
|
$('.alert').hide();
|
||||||
}
|
}
|
||||||
@@ -88,3 +96,10 @@ window.TastypieCollection = Backbone.Collection.extend({
|
|||||||
return response.objects || response;
|
return response.objects || response;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
var proxied = window.alert;
|
||||||
|
window.alert = function () {
|
||||||
|
return proxied.apply(this, arguments);
|
||||||
|
};
|
||||||
|
})();
|
||||||
@@ -14,6 +14,7 @@ window.HeaderView = Backbone.View.extend({
|
|||||||
},
|
},
|
||||||
trackChanged:function (data) {
|
trackChanged:function (data) {
|
||||||
$(this.el).find('#track-description').text(data.title);
|
$(this.el).find('#track-description').text(data.title);
|
||||||
|
$(this.el).find('#track-description').attr("href", "#" + data.item_url);
|
||||||
},
|
},
|
||||||
trackPlaying:function (data) {
|
trackPlaying:function (data) {
|
||||||
$(this.el).find('#header-play-button-icon').removeClass('icon-play');
|
$(this.el).find('#header-play-button-icon').removeClass('icon-play');
|
||||||
|
|||||||
@@ -12,7 +12,17 @@ window.UserView = Backbone.View.extend({
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
saveChanges: function(){
|
saveChanges: function(){
|
||||||
this.model.save();
|
this.model.save(
|
||||||
|
null,{
|
||||||
|
success: function(){
|
||||||
|
window.utils.showAlert("Success", "Successfully updated yourself", "alert-info", true);
|
||||||
|
window.history.back();
|
||||||
|
},
|
||||||
|
error: function(){
|
||||||
|
window.utils.showAlert("Success", "Successfully updated yourself", "alert-info", false);
|
||||||
|
alert("Error");
|
||||||
|
}
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
changed:function(evt) {
|
changed:function(evt) {
|
||||||
|
|||||||
@@ -44,15 +44,17 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% include 'inc/ancient_browser.html' %}
|
{% include 'inc/ancient_browser.html' %}
|
||||||
<div class="row status-bar">
|
|
||||||
<div class="span12">
|
<div id="header"></div>
|
||||||
<div class="alert alert-success" style="display: none">
|
|
||||||
<b>Success!</b>Something happened and it was good.
|
<div class="container-fluid">
|
||||||
|
<div class="row status-bar">
|
||||||
|
<div class="span12">
|
||||||
|
<div class="alert alert-success" style="display: none">
|
||||||
|
<b>Success!</b>Something happened and it was good.
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div id="header"></div>
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span8" id="content">
|
<div class="span8" id="content">
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|||||||
Reference in New Issue
Block a user