src_js/iconolab-bundle/src/components/editor/AnnotationForm.vue
author Alexandre Segura <mex.zktk@gmail.com>
Tue, 14 Mar 2017 17:02:43 +0100
changeset 433 616fc1fad25f
parent 427 2a9ce7ec3a29
child 482 b71475c27159
permissions -rw-r--r--
Toggle annotation on click.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
323
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
     1
<template>
339
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
     2
    <div>
385
d0465086d8d2 Allow editing/commenting only for authenticated users.
Alexandre Segura <mex.zktk@gmail.com>
parents: 356
diff changeset
     3
        <button v-if="annotation && isAuthenticated" @click="readonly = !readonly"
339
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
     4
            class="btn btn-xs pull-right"
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
     5
            v-bind:class="{ 'btn-primary': readonly, 'btn-warning': !readonly }">
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
     6
            <i class="fa fa-edit" v-if="readonly"></i>
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
     7
            <span v-if="readonly">Modifier</span>
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
     8
            <i class="fa fa-ban" v-if="!readonly"></i>
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
     9
            <span v-if="!readonly">Annuler</span>
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    10
        </button>
356
a45f7dac4789 Change wordings, align text.
Alexandre Segura <mex.zktk@gmail.com>
parents: 351
diff changeset
    11
        <div v-if="!annotation" class="alert alert-warning text-center">
433
616fc1fad25f Toggle annotation on click.
Alexandre Segura <mex.zktk@gmail.com>
parents: 427
diff changeset
    12
            Aucune annotation sélectionnée
323
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    13
        </div>
339
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    14
        <form v-bind:action="formAction" method="post">
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    15
            <slot>
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    16
                <!-- CSRF token -->
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    17
            </slot>
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    18
            <input type="hidden" name="fragment" v-model="fragment">
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    19
            <div v-if="annotation" class="form-group form-group-sm">
402
376158f6d760 hides title and description if there is none
duong tam kien <tk@deveha.com>
parents: 400
diff changeset
    20
                <label v-if="!readonly || title" class="small text-muted">Titre</label>
339
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    21
                <input type="text" class="form-control" name="title" v-model="title" v-if="!readonly">
402
376158f6d760 hides title and description if there is none
duong tam kien <tk@deveha.com>
parents: 400
diff changeset
    22
                <p v-if="readonly && title" v-bind:class="{ 'text-muted': !title }">{{ title || 'Pas de titre' }}</p>
339
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    23
            </div>
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    24
            <div v-if="annotation" class="form-group form-group-sm">
402
376158f6d760 hides title and description if there is none
duong tam kien <tk@deveha.com>
parents: 400
diff changeset
    25
                <label v-if="!readonly || description" class="small text-muted">Description</label>
339
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    26
                <textarea class="form-control" name="description" v-model="description" v-if="!readonly" placeholder="Décrivez ce que vous voyez"></textarea>
403
0ed5207089ee adds formatting (markdown) to annotation description
duong tam kien <tk@deveha.com>
parents: 402
diff changeset
    27
                <p v-if="readonly && description" v-bind:class="{ 'text-muted': !description }" v-html="descriptionComputed">{{ descriptionComputed || 'Pas de description' }}</p>
339
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    28
            </div>
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    29
            <div v-if="annotation" class="form-group form-group-sm">
400
c85505149eea orthographe mots-cléS + css
duong tam kien <tk@deveha.com>
parents: 385
diff changeset
    30
                <label class="small text-muted">Mots-clés</label>
339
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    31
                <tag-list ref="taglist"
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    32
                    v-bind:original-tags="annotation.tags"
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    33
                    v-bind:readonly="readonly"
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    34
                    @change="onTagsChange($event.tags)"></tag-list>
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    35
                <input type="hidden" name="tags" v-model="serializedTags">
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    36
            </div>
427
2a9ce7ec3a29 Display date & author of last revision.
Alexandre Segura <mex.zktk@gmail.com>
parents: 418
diff changeset
    37
            <p class="small text-center text-muted" v-show="readonly">{{ lastRevisionText }}</p>
339
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    38
            <button type="submit" v-if="annotation &amp;&amp; !readonly" v-bind:class="{ disabled: !hasChanged }"
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    39
                class="btn btn-block btn-sm btn-primary">Enregistrer une nouvelle version</button>
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    40
        </form>
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    41
    </div>
323
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    42
</template>
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    43
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    44
<script>
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    45
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    46
    import TagList from '../tagform/TagList.vue'
333
625ac8b8bb87 Improve change detection in TagList.
Alexandre Segura <mex.zktk@gmail.com>
parents: 327
diff changeset
    47
    import _ from 'lodash'
403
0ed5207089ee adds formatting (markdown) to annotation description
duong tam kien <tk@deveha.com>
parents: 402
diff changeset
    48
    import showdown from 'showdown'
427
2a9ce7ec3a29 Display date & author of last revision.
Alexandre Segura <mex.zktk@gmail.com>
parents: 418
diff changeset
    49
    import moment from 'moment'
403
0ed5207089ee adds formatting (markdown) to annotation description
duong tam kien <tk@deveha.com>
parents: 402
diff changeset
    50
0ed5207089ee adds formatting (markdown) to annotation description
duong tam kien <tk@deveha.com>
parents: 402
diff changeset
    51
    const converter = new showdown.Converter()
333
625ac8b8bb87 Improve change detection in TagList.
Alexandre Segura <mex.zktk@gmail.com>
parents: 327
diff changeset
    52
625ac8b8bb87 Improve change detection in TagList.
Alexandre Segura <mex.zktk@gmail.com>
parents: 327
diff changeset
    53
    var defaults = {
339
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    54
        title: '',
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    55
        description: '',
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    56
        fragment: '',
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    57
        tags: [],
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    58
        readonly: true,
333
625ac8b8bb87 Improve change detection in TagList.
Alexandre Segura <mex.zktk@gmail.com>
parents: 327
diff changeset
    59
    }
323
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    60
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    61
    export default {
339
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    62
        props: {
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    63
            action: String,
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    64
            annotation: {
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    65
                type: Object,
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    66
                default: function () {
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    67
                    return null;
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    68
                }
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    69
            },
385
d0465086d8d2 Allow editing/commenting only for authenticated users.
Alexandre Segura <mex.zktk@gmail.com>
parents: 356
diff changeset
    70
            isAuthenticated: {
d0465086d8d2 Allow editing/commenting only for authenticated users.
Alexandre Segura <mex.zktk@gmail.com>
parents: 356
diff changeset
    71
                type: Boolean,
d0465086d8d2 Allow editing/commenting only for authenticated users.
Alexandre Segura <mex.zktk@gmail.com>
parents: 356
diff changeset
    72
                default: false
d0465086d8d2 Allow editing/commenting only for authenticated users.
Alexandre Segura <mex.zktk@gmail.com>
parents: 356
diff changeset
    73
            }
339
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
    74
        },
323
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    75
        components: {
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    76
            'tag-list': TagList
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    77
        },
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    78
        data() {
333
625ac8b8bb87 Improve change detection in TagList.
Alexandre Segura <mex.zktk@gmail.com>
parents: 327
diff changeset
    79
            return defaults;
325
8f158a4c7759 Use props to update annotation in components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 323
diff changeset
    80
        },
418
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
    81
        mounted() {
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
    82
            if (this.annotation) {
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
    83
                this.loadAnnotation(this.annotation);
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
    84
            }
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
    85
        },
325
8f158a4c7759 Use props to update annotation in components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 323
diff changeset
    86
        watch: {
8f158a4c7759 Use props to update annotation in components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 323
diff changeset
    87
            annotation: function(annotation) {
8f158a4c7759 Use props to update annotation in components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 323
diff changeset
    88
                if (annotation) {
418
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
    89
                    this.loadAnnotation(annotation);
325
8f158a4c7759 Use props to update annotation in components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 323
diff changeset
    90
                } else {
8f158a4c7759 Use props to update annotation in components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 323
diff changeset
    91
                    this.reset();
8f158a4c7759 Use props to update annotation in components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 323
diff changeset
    92
                }
323
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    93
            }
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    94
        },
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
    95
        computed: {
427
2a9ce7ec3a29 Display date & author of last revision.
Alexandre Segura <mex.zktk@gmail.com>
parents: 418
diff changeset
    96
            descriptionComputed: function() {
403
0ed5207089ee adds formatting (markdown) to annotation description
duong tam kien <tk@deveha.com>
parents: 402
diff changeset
    97
              return converter.makeHtml(this.description);
0ed5207089ee adds formatting (markdown) to annotation description
duong tam kien <tk@deveha.com>
parents: 402
diff changeset
    98
            },
427
2a9ce7ec3a29 Display date & author of last revision.
Alexandre Segura <mex.zktk@gmail.com>
parents: 418
diff changeset
    99
            lastRevisionText: function() {
2a9ce7ec3a29 Display date & author of last revision.
Alexandre Segura <mex.zktk@gmail.com>
parents: 418
diff changeset
   100
                if (this.annotation) {
2a9ce7ec3a29 Display date & author of last revision.
Alexandre Segura <mex.zktk@gmail.com>
parents: 418
diff changeset
   101
                    var date = moment(this.annotation.created).locale('fr');
2a9ce7ec3a29 Display date & author of last revision.
Alexandre Segura <mex.zktk@gmail.com>
parents: 418
diff changeset
   102
                    return 'Dernière version ' + date.fromNow() + ' par ' + this.annotation.author;
2a9ce7ec3a29 Display date & author of last revision.
Alexandre Segura <mex.zktk@gmail.com>
parents: 418
diff changeset
   103
                }
2a9ce7ec3a29 Display date & author of last revision.
Alexandre Segura <mex.zktk@gmail.com>
parents: 418
diff changeset
   104
            },
323
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   105
            formAction: function() {
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   106
                if (this.annotation) {
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   107
                    return this.action.replace(':annotation_guid', this.annotation.annotation_guid);
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   108
                }
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   109
            },
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   110
            serializedTags: function() {
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   111
                var tags = this.tags.map(function(tag) {
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   112
                    return {
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   113
                        tag_input: (typeof tag.tag_link === "string" && tag.tag_link.length) ? tag.tag_link : tag.tag_label,
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   114
                        tag_label: tag.tag_label,
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   115
                        accuracy: tag.accuracy,
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   116
                        relevancy: tag.relevancy
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   117
                    }
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   118
                });
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   119
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   120
                return JSON.stringify(tags);
333
625ac8b8bb87 Improve change detection in TagList.
Alexandre Segura <mex.zktk@gmail.com>
parents: 327
diff changeset
   121
            },
625ac8b8bb87 Improve change detection in TagList.
Alexandre Segura <mex.zktk@gmail.com>
parents: 327
diff changeset
   122
            hasChanged: function() {
625ac8b8bb87 Improve change detection in TagList.
Alexandre Segura <mex.zktk@gmail.com>
parents: 327
diff changeset
   123
                if (!this.annotation) { return false; }
625ac8b8bb87 Improve change detection in TagList.
Alexandre Segura <mex.zktk@gmail.com>
parents: 327
diff changeset
   124
625ac8b8bb87 Improve change detection in TagList.
Alexandre Segura <mex.zktk@gmail.com>
parents: 327
diff changeset
   125
                return this.title !== this.annotation.title
625ac8b8bb87 Improve change detection in TagList.
Alexandre Segura <mex.zktk@gmail.com>
parents: 327
diff changeset
   126
                    || this.description !== this.annotation.description
625ac8b8bb87 Improve change detection in TagList.
Alexandre Segura <mex.zktk@gmail.com>
parents: 327
diff changeset
   127
                    || !_.isEqual(this.annotation.tags, this.tags);
323
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   128
            }
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   129
        },
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   130
        methods: {
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   131
            onTagsChange: function(tags) {
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   132
                this.tags = tags;
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   133
            },
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   134
            reset: function() {
333
625ac8b8bb87 Improve change detection in TagList.
Alexandre Segura <mex.zktk@gmail.com>
parents: 327
diff changeset
   135
                Object.assign(this, defaults);
323
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   136
            },
418
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
   137
            loadAnnotation(annotation) {
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
   138
                // Make sure we have an actual copy
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
   139
                Object.assign(this, {
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
   140
                    title: annotation.title,
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
   141
                    description: annotation.description,
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
   142
                    fragment: annotation.fragment,
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
   143
                    tags: annotation.tags.slice(),
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
   144
                    readonly: true,
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
   145
                });
a04c55054afe Introduce display of all annotations at the same time.
Alexandre Segura <mex.zktk@gmail.com>
parents: 403
diff changeset
   146
            }
323
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   147
        }
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   148
    }
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   149
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   150
</script>
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   151
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   152
<style scoped>
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   153
form {
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   154
    margin-bottom: 20px;
339
ba89f767b091 Introduce readonly prop in AnnotationForm & child components.
Alexandre Segura <mex.zktk@gmail.com>
parents: 333
diff changeset
   155
    clear: both;
323
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   156
}
400
c85505149eea orthographe mots-cléS + css
duong tam kien <tk@deveha.com>
parents: 385
diff changeset
   157
c85505149eea orthographe mots-cléS + css
duong tam kien <tk@deveha.com>
parents: 385
diff changeset
   158
label {
c85505149eea orthographe mots-cléS + css
duong tam kien <tk@deveha.com>
parents: 385
diff changeset
   159
  font-weight: normal;
c85505149eea orthographe mots-cléS + css
duong tam kien <tk@deveha.com>
parents: 385
diff changeset
   160
}
323
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents:
diff changeset
   161
</style>