src/widgets/CurrentSegmentInfobox.js
changeset 1060 3a4f2217a04f
parent 1052 c8fd9dbf3804
child 1062 f8adaa2caecb
equal deleted inserted replaced
1059:8158421193e3 1060:3a4f2217a04f
    17     new_tag_button: true,
    17     new_tag_button: true,
    18 };
    18 };
    19 
    19 
    20 IriSP.Widgets.CurrentSegmentInfobox.prototype.template = 
    20 IriSP.Widgets.CurrentSegmentInfobox.prototype.template = 
    21       '<div class="Ldt-CurrentSegmentInfobox">'
    21       '<div class="Ldt-CurrentSegmentInfobox">'
       
    22     +     '{{#editable_segments}}<div class="Ldt-CurrentSegmentInfobox-EditButton">{{edit}}</div>{{/editable_segments}}'
    22     +     '<div class="Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Title">{{title}}</div>'
    23     +     '<div class="Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Title">{{title}}</div>'
    23     +     '<div class="Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Description">{{description}}</div>' 
    24     +     '<div class="Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Description">{{description}}</div>' 
    24     +     '<div class="Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Tags">'
    25     +     '<div class="Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Tags">'
    25     +         '{{#tags.length}}'
    26     +         '{{#tags.length}}'
    26     +         '<ul class="Ldt-CurrentSegmentInfobox-Tags-Ul">'
    27     +         '<ul class="Ldt-CurrentSegmentInfobox-Tags-Ul">'
    66     
    67     
    67 IriSP.Widgets.CurrentSegmentInfobox.prototype.messages = {
    68 IriSP.Widgets.CurrentSegmentInfobox.prototype.messages = {
    68     fr : {
    69     fr : {
    69         submit : "Soumettre",
    70         submit : "Soumettre",
    70         cancel : "Annuler",
    71         cancel : "Annuler",
       
    72         edit : "Editer",
    71         new_tag : "Nouveau tag",
    73         new_tag : "Nouveau tag",
    72         delete_tag : "Supprimer",
    74         delete_tag : "Supprimer",
    73         empty : "Le player vidéo ne lit actuellement aucun segment"
    75         empty : "Le player vidéo ne lit actuellement aucun segment"
    74     },
    76     },
    75     en: {
    77     en: {
    76         submit : "Submit",
    78         submit : "Submit",
    77         cancel : "Cancel",
    79         cancel : "Cancel",
       
    80         edit : "Edit",
    78         new_tag : "New tag",
    81         new_tag : "New tag",
    79         delete_tag : "Delete tag",
    82         delete_tag : "Delete tag",
    80         empty : "The player currently doesn't read any segment"
    83         empty : "The player currently doesn't read any segment"
    81     }
    84     }
    82 }    
    85 }    
    98         if (_list.length >0){
   101         if (_list.length >0){
    99             _this.$.toggleClass("editing", false);
   102             _this.$.toggleClass("editing", false);
   100             if (_this.currentSegment.id != _list[0].id){
   103             if (_this.currentSegment.id != _list[0].id){
   101                 _this.currentSegment = _list[0];
   104                 _this.currentSegment = _list[0];
   102                 _data = {
   105                 _data = {
   103                     title: _this.currentSegment.title,
   106                         editable_segments: _this.editable_segments,
   104                     description : _this.currentSegment.description,
   107                         edit: _this.l10n.edit,
   105                     tags : _this.currentSegment.getTagTexts()
   108                         title: _this.currentSegment.title,
       
   109                         description : _this.currentSegment.description,
       
   110                         tags : _this.currentSegment.getTagTexts()
   106                 }
   111                 }
   107                 _this.$.html(Mustache.to_html(_this.template, _data))
   112                 _this.$.html(Mustache.to_html(_this.template, _data))
   108                 if(_this.editable_segments&&_this.currentSegment){
   113                 if(_this.editable_segments&&_this.currentSegment){
   109                     _this.$.find(".Ldt-CurrentSegmentInfobox").click(_this.functionWrapper("enableEditMode"));            
   114                     _this.$.find(".Ldt-CurrentSegmentInfobox").click(_this.functionWrapper("enableEditMode"));            
   110                 }
   115                 }
   143     }
   148     }
   144 }
   149 }
   145 
   150 
   146 IriSP.Widgets.CurrentSegmentInfobox.prototype.disableEditMode = function() {
   151 IriSP.Widgets.CurrentSegmentInfobox.prototype.disableEditMode = function() {
   147     if(this.currentSegment){
   152     if(this.currentSegment){
   148         data = {
   153         _data = {
   149             title: this.currentSegment.title,
   154                 editable_segments: this.editable_segments,
   150             description : this.currentSegment.description,
   155                 edit: this.l10n.edit,
   151             tags : this.currentSegment.getTagTexts()
   156                 title: this.currentSegment.title,
   152         }
   157                 description : this.currentSegment.description,
       
   158                 tags : this.currentSegment.getTagTexts()
       
   159             }
   153         this.$.toggleClass("editing", false);
   160         this.$.toggleClass("editing", false);
   154         this.$.html(Mustache.to_html(this.template, _data));
   161         this.$.html(Mustache.to_html(this.template, _data));
   155         this.$.find(".Ldt-CurrentSegmentInfobox").click(this.functionWrapper("enableEditMode")); 
   162         this.$.find(".Ldt-CurrentSegmentInfobox").click(this.functionWrapper("enableEditMode")); 
   156     }
   163     }
   157 }
   164 }
   246                 }
   253                 }
   247             })
   254             })
   248             _this.segments.push(_annotation)
   255             _this.segments.push(_annotation)
   249             _this.currentSegment = _annotation
   256             _this.currentSegment = _annotation
   250             _data = {
   257             _data = {
   251                 title: _this.currentSegment.title,
   258                     editable_segments: _this.editable_segments,
   252                 description : _this.currentSegment.description,
   259                     edit: _this.l10n.edit,
   253                 tags : _this.currentSegment.getTagTexts()
   260                     title: _this.currentSegment.title,
   254             }
   261                     description : _this.currentSegment.description,
       
   262                     tags : _this.currentSegment.getTagTexts()
       
   263                 }
   255             _this.$.html(Mustache.to_html(_this.template, _data))
   264             _this.$.html(Mustache.to_html(_this.template, _data))
   256             if(_this.editable_segments&&_this.currentSegment){
   265             if(_this.editable_segments&&_this.currentSegment){
   257                 _this.$.find(".Ldt-CurrentSegmentInfobox").click(_this.functionWrapper("enableEditMode"));             
   266                 _this.$.find(".Ldt-CurrentSegmentInfobox").click(_this.functionWrapper("enableEditMode"));             
   258             }
   267             }
   259             _this.$.toggleClass("editing", false);
   268             _this.$.toggleClass("editing", false);
   275         
   284         
   276         if (_list.length > 0){
   285         if (_list.length > 0){
   277             if (this.currentSegment.id != _list[0].id){
   286             if (this.currentSegment.id != _list[0].id){
   278                 this.currentSegment = _list[0];
   287                 this.currentSegment = _list[0];
   279                 _data = {
   288                 _data = {
       
   289                     editable_segments: this.editable_segments,
       
   290                     edit: this.l10n.edit,
   280                     title: this.currentSegment.title,
   291                     title: this.currentSegment.title,
   281                     description : this.currentSegment.description,
   292                     description : this.currentSegment.description,
   282                     tags : this.currentSegment.getTagTexts()
   293                     tags : this.currentSegment.getTagTexts()
   283                 }
   294                 }
   284                 this.$.html(Mustache.to_html(this.template, _data))
   295                 this.$.html(Mustache.to_html(this.template, _data))