Fixed timeout after submitting for Markers + Fixed overflow on delete button for Markers design for remie + Fixed editing class not being removed when submitting edited segment for CurrentSegmentInfobox
authordurandn
Tue, 08 Sep 2015 16:01:55 +0200
changeset 105 e597e63e45f8
parent 104 64ad4987d31c
child 106 294fdb24a1e2
Fixed timeout after submitting for Markers + Fixed overflow on delete button for Markers design for remie + Fixed editing class not being removed when submitting edited segment for CurrentSegmentInfobox
server/src/remie/static/remie/css/markers.css
server/src/remie/static/remie/metadataplayer/CurrentSegmentInfobox.js
server/src/remie/static/remie/metadataplayer/Markers.js
--- a/server/src/remie/static/remie/css/markers.css	Tue Sep 08 15:25:32 2015 +0200
+++ b/server/src/remie/static/remie/css/markers.css	Tue Sep 08 16:01:55 2015 +0200
@@ -164,6 +164,7 @@
     background-color: #1abacc;
     border-color: #1abacc;
     font-weight: bold;
+    overflow: hidden;
 }
 .Ldt-Markers-Screen.Ldt-Markers-ScreenMain .Ldt-Markers-RoundButton.Ldt-Markers-Delete{
     font-size: 80px;
--- a/server/src/remie/static/remie/metadataplayer/CurrentSegmentInfobox.js	Tue Sep 08 15:25:32 2015 +0200
+++ b/server/src/remie/static/remie/metadataplayer/CurrentSegmentInfobox.js	Tue Sep 08 16:01:55 2015 +0200
@@ -255,6 +255,7 @@
             if(_this.editable_segments&&_this.currentSegment){
                 _this.$.find(".Ldt-CurrentSegmentInfobox").click(_this.functionWrapper("enableEditMode"));             
             }
+            _this.$.toggleClass("editing", false);
             _this.player.trigger("AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */
         },
         error: function(_xhr, _error, _thrown) {
--- a/server/src/remie/static/remie/metadataplayer/Markers.js	Tue Sep 08 15:25:32 2015 +0200
+++ b/server/src/remie/static/remie/metadataplayer/Markers.js	Tue Sep 08 16:01:55 2015 +0200
@@ -168,6 +168,7 @@
 }
 
 IriSP.Widgets.Markers.prototype.sendDelete = function(){
+    _this = this;
     _url = Mustache.to_html(this.api_endpoint_template_delete, {annotation_id: this.selectedMarker ? this.selectedMarker.id : ""});
     IriSP.jQuery.ajax({
         url: _url,
@@ -175,27 +176,19 @@
         contentType: 'application/json',
         success: function(_data) {
             _this.showScreen('DeleteSuccess'); /* Si l'appel a fonctionné, on affiche l'écran "Annotation enregistrée" */
-            window.setTimeout(function(){
-                _this.showScreen("Main");
-                _this.cancelEdit();
-            },
-            (_this.after_send_timeout || 5000));
+            window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 5000));
             if (_this.pause_on_write && _this.media.getPaused()) {
                 _this.media.play();
             }
             _this.markers.removeElement(_this.selectedMarker);
             _this.selectedMarker = false
-            _this.cancelEdit();
             _this.player.trigger("AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */
             _this.player.trigger("Markers.refresh");
         },
         error: function(_xhr, _error, _thrown) {
             IriSP.log("Error when sending annotation", _thrown);
             _this.showScreen('Failure');
-            window.setTimeout(function(){
-                _this.showScreen("Main");
-            },
-            (_this.after_send_timeout || 5000));
+            window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 5000));
         }
     });
     this.showScreen("Sending")
@@ -272,6 +265,13 @@
         .siblings().hide();
 }
 
+IriSP.Widgets.Markers.prototype.revertToMainScreen = function(){
+    if (this.$.find(".Ldt-Markers-ScreenMain").is(":hidden")){
+        this.showScreen("Main");
+        this.cancelEdit();
+    }
+}
+
 IriSP.Widgets.Markers.prototype.drawMarkers = function(){
     this.$.remove("Ldt-Markers-Marker");
     this.$.find(".Ldt-Markers-List").html("")
@@ -424,11 +424,7 @@
         data: _export.serialize(), /* L'objet Source est sérialisé */
         success: function(_data) {
             _this.showScreen('Success'); /* Si l'appel a fonctionné, on affiche l'écran "Annotation enregistrée" */
-            window.setTimeout(function(){
-                _this.showScreen("Main");
-                _this.cancelEdit();
-            },
-            (_this.after_send_timeout || 5000));
+            window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 5000));
             _export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */
             _export.deSerialize(_data); /* On désérialise les données reçues pour les réinjecter */
             _annotation.id = _data.id;
@@ -438,7 +434,6 @@
             }
             _this.markers.push(_annotation);
             _this.selectedMarker = _annotation;
-            _this.cancelEdit();
             _this.drawMarkers();
             _this.player.trigger("AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */
             _this.player.trigger("Markers.refresh");
@@ -447,10 +442,7 @@
             IriSP.log("Error when sending annotation", _thrown);
             _export.getAnnotations().removeElement(_annotation, true);
             _this.showScreen('Failure');
-            window.setTimeout(function(){
-                _this.showScreen("Main");
-            },
-            (_this.after_send_timeout || 5000));
+            window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 5000));
         }
     });
     this.showScreen('Sending');