mirror of
https://github.com/fergalmoran/dss.git
synced 2025-12-22 09:38:18 +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 = {
|
||||
'stream_url': mix.get_stream_path(),
|
||||
'description': mix.description,
|
||||
'item_url': mix.get_absolute_url(),
|
||||
'title': mix.title
|
||||
}
|
||||
return HttpResponse(json.dumps(data), mimetype="application/json")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from django.conf.urls import url
|
||||
from tastypie.authentication import Authentication
|
||||
from tastypie.authorization import Authorization
|
||||
from tastypie.constants import ALL_WITH_RELATIONS
|
||||
from spa.api.v1.BackboneCompatibleResource import BackboneCompatibleResource
|
||||
from spa.models import UserProfile
|
||||
|
||||
@@ -7,6 +9,11 @@ class UserResource(BackboneCompatibleResource):
|
||||
class Meta:
|
||||
queryset = UserProfile.objects.all()
|
||||
authorization = Authorization()
|
||||
authentication = Authentication()
|
||||
always_return_data = True
|
||||
filtering = {
|
||||
'user': ALL_WITH_RELATIONS,
|
||||
}
|
||||
|
||||
def dehydrate(self, bundle):
|
||||
bundle.data['display_name'] = bundle.obj.display_name
|
||||
@@ -15,7 +22,6 @@ class UserResource(BackboneCompatibleResource):
|
||||
bundle.data['email'] = bundle.obj.email
|
||||
return bundle
|
||||
|
||||
def override_urls(self):
|
||||
return [
|
||||
url(r"^(?P<resource_name>%s)/(?P<username>[\w\d_.-]+)/$" % self._meta.resource_name, self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
|
||||
]
|
||||
def apply_authorization_limits(self, request, object_list):
|
||||
if request.user is not None:
|
||||
return object_list.filter(user=request.user)
|
||||
@@ -62,4 +62,7 @@ class UserProfile(_BaseModel):
|
||||
elif avatar_type == 'custom' or avatar_type:
|
||||
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({
|
||||
routes:{
|
||||
"":"defaultRoute",
|
||||
"/mixes":"mixList",
|
||||
"/mixes/:type":"mixList",
|
||||
"/mix/:id":"mixDetails",
|
||||
@@ -8,9 +7,11 @@ var AppRouter = Backbone.Router.extend({
|
||||
"/release/:id":"releaseDetails",
|
||||
"/events":"eventList",
|
||||
"/event/:id":"eventDetails",
|
||||
"/accounts/social/connections/":"connectAccounts",
|
||||
"/accounts/login/":"login",
|
||||
"/accounts/logout/":"logout",
|
||||
"/me":"userDetails"
|
||||
"/me":"userDetails",
|
||||
"*path":"defaultRoute"
|
||||
},
|
||||
initialize:function () {
|
||||
this.headerView = new HeaderView();
|
||||
@@ -18,9 +19,7 @@ var AppRouter = Backbone.Router.extend({
|
||||
$('#site-content-fill').html('');
|
||||
},
|
||||
defaultRoute:function (path) {
|
||||
if (!path)
|
||||
this.mixList('latest');
|
||||
else if (path == "" || path == "/")
|
||||
if (path == undefined || path == "" || path == "/")
|
||||
this.mixList('latest');
|
||||
},
|
||||
mixList:function (type) {
|
||||
@@ -107,7 +106,10 @@ var AppRouter = Backbone.Router.extend({
|
||||
logout:function () {
|
||||
window.utils.showAlert("Success", "You are now logged out", "alert-success");
|
||||
},
|
||||
userDetails: function(){
|
||||
connectAccounts:function () {
|
||||
alert("sdfkjsdlfj");
|
||||
},
|
||||
userDetails:function () {
|
||||
var user = new User();
|
||||
$('#site-content-fill').html('');
|
||||
user.fetch({success:function () {
|
||||
@@ -118,12 +120,12 @@ var AppRouter = Backbone.Router.extend({
|
||||
});
|
||||
|
||||
utils.loadTemplate([
|
||||
'HeaderView', 'SidebarView', 'UserView',
|
||||
'MixListView', 'MixListItemView', 'MixView',
|
||||
'CommentListView', 'CommentListItemView',
|
||||
'ReleaseListView', 'ReleaseListItemView', 'ReleaseItemView', 'ReleaseView', 'ReleaseAudioListView', 'ReleaseAudioItemView',
|
||||
'EventListView', 'EventListItemView', 'EventView', 'EventItemView'
|
||||
], function () {
|
||||
'HeaderView', 'SidebarView', 'UserView',
|
||||
'MixListView', 'MixListItemView', 'MixView',
|
||||
'CommentListView', 'CommentListItemView',
|
||||
'ReleaseListView', 'ReleaseListItemView', 'ReleaseItemView', 'ReleaseView', 'ReleaseAudioListView', 'ReleaseAudioItemView',
|
||||
'EventListView', 'EventListItemView', 'EventView', 'EventItemView'
|
||||
], function () {
|
||||
window.app = new AppRouter();
|
||||
Backbone.history.start();
|
||||
}
|
||||
|
||||
@@ -59,13 +59,21 @@ window.utils = {
|
||||
$('.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').addClass(klass);
|
||||
$('.alert').html('<strong>' + title + '</strong> ' + text);
|
||||
$('.alert').show();
|
||||
if (fade) {
|
||||
$('.alert').fadeOut(5000, function () {
|
||||
});
|
||||
}else{
|
||||
$('.alert').click(function() {
|
||||
$('.alert').fadeOut('slow', function() {
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
hideAlert:function () {
|
||||
$('.alert').hide();
|
||||
}
|
||||
@@ -88,3 +96,10 @@ window.TastypieCollection = Backbone.Collection.extend({
|
||||
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) {
|
||||
$(this.el).find('#track-description').text(data.title);
|
||||
$(this.el).find('#track-description').attr("href", "#" + data.item_url);
|
||||
},
|
||||
trackPlaying:function (data) {
|
||||
$(this.el).find('#header-play-button-icon').removeClass('icon-play');
|
||||
|
||||
@@ -12,7 +12,17 @@ window.UserView = Backbone.View.extend({
|
||||
return this;
|
||||
},
|
||||
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;
|
||||
},
|
||||
changed:function(evt) {
|
||||
|
||||
@@ -44,15 +44,17 @@
|
||||
</head>
|
||||
<body>
|
||||
{% include 'inc/ancient_browser.html' %}
|
||||
<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 id="header"></div>
|
||||
|
||||
<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 id="header"></div>
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span8" id="content">
|
||||
{% block content %}
|
||||
|
||||
Reference in New Issue
Block a user