src/widgets/Tagger.js
branchnew-model
changeset 932 48dac21e086f
parent 931 0fdce6e14748
child 957 4da0a5740b6c
equal deleted inserted replaced
931:0fdce6e14748 932:48dac21e086f
     5 IriSP.Widgets.Tagger.prototype = new IriSP.Widgets.Widget();
     5 IriSP.Widgets.Tagger.prototype = new IriSP.Widgets.Widget();
     6 
     6 
     7 IriSP.Widgets.Tagger.prototype.defaults = {
     7 IriSP.Widgets.Tagger.prototype.defaults = {
     8     created_annotation_type: "Contributions",
     8     created_annotation_type: "Contributions",
     9     creator_name: 'anonymous',
     9     creator_name: 'anonymous',
    10     api_endpoint: "/metadataplayer/test/post-test.php",
    10     api_endpoint: "",
    11     api_method: "PUT",
    11     api_method: "PUT",
    12     pause_on_write : true,
    12     pause_on_write : true,
    13     api_serializer: "ldt_annotate",
    13     api_serializer: "ldt_annotate",
       
    14     tags: false
    14 }
    15 }
    15 
    16 
    16 IriSP.Widgets.Tagger.prototype.messages = {
    17 IriSP.Widgets.Tagger.prototype.messages = {
    17     en: {
    18     en: {
    18         add_a_tag: "Add a tag",
    19         add_a_tag: "Add a tag",
    28     '<form class="Ldt-Tagger"><input class="Ldt-Tagger-Input" placeholder="{{l10n.add_a_tag}}" />'
    29     '<form class="Ldt-Tagger"><input class="Ldt-Tagger-Input" placeholder="{{l10n.add_a_tag}}" />'
    29     + '<input class="Ldt-Tagger-Submit" type="submit" value="{{l10n.submit}}" /></form>';
    30     + '<input class="Ldt-Tagger-Submit" type="submit" value="{{l10n.submit}}" /></form>';
    30 
    31 
    31 IriSP.Widgets.Tagger.prototype.draw = function() {
    32 IriSP.Widgets.Tagger.prototype.draw = function() {
    32     this.renderTemplate();
    33     this.renderTemplate();
    33     var _tags = this.source.getTags().getTitles(),
    34     var _tags = this.tags || this.source.getTags().getTitles(),
    34         _this = this,
    35         _this = this,
    35         _input = this.$.find(".Ldt-Tagger-Input");
    36         _input = this.$.find(".Ldt-Tagger-Input");
    36     _input.autocomplete({
    37     _input.autocomplete({
    37         source: _tags
    38         source: _tags
    38     });
    39     });
    82                 if (_annotations.length) {
    83                 if (_annotations.length) {
    83                     _pilotAnnotation = _annotations[0];
    84                     _pilotAnnotation = _annotations[0];
    84                 }
    85                 }
    85             }
    86             }
    86             if (_pilotAnnotation) {
    87             if (_pilotAnnotation) {
    87                 console.log(_pilotAnnotation);
       
    88                 _annotation.setBegin(_pilotAnnotation.begin);
    88                 _annotation.setBegin(_pilotAnnotation.begin);
    89                 _annotation.setEnd(_pilotAnnotation.end);
    89                 _annotation.setEnd(_pilotAnnotation.end);
    90                 /* Id du média annoté */
    90                 /* Id du média annoté */
    91                 _annotation.setMedia(_pilotAnnotation.getMedia().id);
    91                 _annotation.setMedia(_pilotAnnotation.getMedia().id);
    92             } else {
    92             } else {