# HG changeset patch # User cavaliet # Date 1334847836 -7200 # Node ID 776c73c98550f2353a27709ddcb1350777f0e2ce # Parent a9aa620029930f82e3d0657dc3f54e893cbdf435 Enhance SlideShare widget for it to point the a specified div. Clean url template for some api calls. diff -r a9aa62002993 -r 776c73c98550 src/ldt/ldt/api/ldt/urls.py --- a/src/ldt/ldt/api/ldt/urls.py Wed Apr 18 15:29:06 2012 +0200 +++ b/src/ldt/ldt/api/ldt/urls.py Thu Apr 19 17:03:56 2012 +0200 @@ -1,4 +1,5 @@ from django.conf.urls.defaults import patterns, url +from django.views.defaults import page_not_found from piston.resource import Resource from ldt.api.ldt.handlers import ProjectHandler, AnnotationHandler, ContentHandler, SegmentHandler @@ -9,8 +10,10 @@ urlpatterns = patterns('', url(r'projects/(?P[^/.]+)\.?(?P.*)$', project_handler, name='project_api'), + url(r'annotations/$', page_not_found, name='annotation_api_empty'), url(r'annotations/(?P[^/.]+)\.?(?P.*)$', annotation_handler, name='annotation_api'), url(r'contents/(?P[^/.]+)\.?(?P.*)$', content_handler, name='content_api'), + url(r'segments/$', page_not_found, name='segment_api_empty'), url(r'segments/(?P.*)/(?P.*)/(?P.*)$', segment_handler, name='segment_api'), ) diff -r a9aa62002993 -r 776c73c98550 src/ldt/ldt/ldt_utils/templates/front/front_player.html --- a/src/ldt/ldt/ldt_utils/templates/front/front_player.html Wed Apr 18 15:29:06 2012 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/front/front_player.html Thu Apr 19 17:03:56 2012 +0200 @@ -95,8 +95,8 @@

{% trans 'All annotations on the media' %}

-
-
+
+
{% endblock %} diff -r a9aa62002993 -r 776c73c98550 src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html Wed Apr 18 15:29:06 2012 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html Thu Apr 19 17:03:56 2012 +0200 @@ -62,7 +62,8 @@ }, { type: "AnnotationsListWidget", - container: "annot_media" + container: "annot_media", + ajax_url: "{% url segment_api_empty %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}" }, { type: "PlayerWidget", @@ -96,11 +97,12 @@ }, { type: "createAnnotationWidget", - api_endpoint_template: "{{WEB_URL}}{{BASE_URL}}/ldtplatform/api/ldt/annotations/{% templatetag openvariable %}id{% templatetag closevariable %}{% templatetag closebrace %}.json", + api_endpoint_template: "{% url annotation_api_empty %}{% templatetag openvariable %}id{% templatetag closevariable %}{% templatetag closebrace %}.json", keywords: ["#amateur", "#digital-humanities"] }, { - type: "SlideShareWidget" + type: "SlideShareWidget", + container: "slides_container" } ] }, diff -r a9aa62002993 -r 776c73c98550 src/ldt/ldt/static/ldt/css/front_player.css --- a/src/ldt/ldt/static/ldt/css/front_player.css Wed Apr 18 15:29:06 2012 +0200 +++ b/src/ldt/ldt/static/ldt/css/front_player.css Thu Apr 19 17:03:56 2012 +0200 @@ -52,7 +52,7 @@ width: 400px; margin-left: 10px; } -#annot_media { +#annot_media, #slides_container { width: 400px; margin: 5px 0 10px 10px; } diff -r a9aa62002993 -r 776c73c98550 src/ldt/ldt/static/ldt/js/LdtPlayer-release.js --- a/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Wed Apr 18 15:29:06 2012 +0200 +++ b/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Thu Apr 19 17:03:56 2012 +0200 @@ -1115,7 +1115,7 @@ IriSP.search_template = "{{! template for the search container }}
"; IriSP.share_template = "{{! social network sharing template }} "; IriSP.sliceWidget_template = "{{! template for the slice widget }}
{{! the whole bar }}
{{! the zone which represents our slice }}
"; -IriSP.slideShareWidget_template = "{{! template for the slideShare widget of the other }}
"; +IriSP.slideShareWidget_template = "{{! template for the slideShare widget of the other }}
"; IriSP.sliderWidget_template = "{{! template for the slider widget - it's composed of two divs we one overlayed on top of the other }}
"; IriSP.tooltip_template = "{{! template used by the jquery ui tooltip }}
{{title}}
{{begin}} : {{end}}
{{description}}
"; IriSP.tooltipWidget_template = "{{! template for the tooltip widget }}
"; @@ -4898,8 +4898,13 @@ IriSP.SlideShareWidget.prototype.draw = function() { var self = this; + // If the div supposed to host the slides does not exist, we cancel + if(this.selector.length==0){ + if(console){ if(console.log){ console.log("No div for slideshare widget, this widget is canceled. id = " + this._id); } } + return; + } var templ = Mustache.to_html(IriSP.slideShareWidget_template); - this.selector.append(templ); + this.selector.html(templ); // Synchro management this._disableUpdate = false; @@ -4925,7 +4930,8 @@ var annotations = this._serializer._data.annotations; var view_type = this._serializer.getSlideShareType(); if(typeof(view_type) === "undefined") { - return; + if(console){ if(console.log){ console.log("No annotation-type for slideshare widget, this widget is canceled."); } } + return; } var i = 0; this.segments_slides = [];