src_js/iconolab-bundle/src/components/editor/AnnotationForm.vue
changeset 482 b71475c27159
parent 433 616fc1fad25f
child 483 dce041bc57a9
equal deleted inserted replaced
481:ca1c0a625d70 482:b71475c27159
    32                     v-bind:original-tags="annotation.tags"
    32                     v-bind:original-tags="annotation.tags"
    33                     v-bind:readonly="readonly"
    33                     v-bind:readonly="readonly"
    34                     @change="onTagsChange($event.tags)"></tag-list>
    34                     @change="onTagsChange($event.tags)"></tag-list>
    35                 <input type="hidden" name="tags" v-model="serializedTags">
    35                 <input type="hidden" name="tags" v-model="serializedTags">
    36             </div>
    36             </div>
    37             <p class="small text-center text-muted" v-show="readonly">{{ lastRevisionText }}</p>
    37             <p class="small text-center text-muted" v-show="annotation">
       
    38                 <a v-bind:href="revisionsUrlComputed">Dernière version</a>
       
    39                 <span>{{ dateComputed }} par</span>
       
    40                 <a v-bind:href="authorUrlComputed">{{ annotation.author }}</a>
       
    41             </p>
    38             <button type="submit" v-if="annotation &amp;&amp; !readonly" v-bind:class="{ disabled: !hasChanged }"
    42             <button type="submit" v-if="annotation &amp;&amp; !readonly" v-bind:class="{ disabled: !hasChanged }"
    39                 class="btn btn-block btn-sm btn-primary">Enregistrer une nouvelle version</button>
    43                 class="btn btn-block btn-sm btn-primary">Enregistrer une nouvelle version</button>
    40         </form>
    44         </form>
    41     </div>
    45     </div>
    42 </template>
    46 </template>
    68                 }
    72                 }
    69             },
    73             },
    70             isAuthenticated: {
    74             isAuthenticated: {
    71                 type: Boolean,
    75                 type: Boolean,
    72                 default: false
    76                 default: false
    73             }
    77             },
       
    78             revisionsUrl: String,
       
    79             authorUrl: String
    74         },
    80         },
    75         components: {
    81         components: {
    76             'tag-list': TagList
    82             'tag-list': TagList
    77         },
    83         },
    78         data() {
    84         data() {
    98             },
   104             },
    99             lastRevisionText: function() {
   105             lastRevisionText: function() {
   100                 if (this.annotation) {
   106                 if (this.annotation) {
   101                     var date = moment(this.annotation.created).locale('fr');
   107                     var date = moment(this.annotation.created).locale('fr');
   102                     return 'Dernière version ' + date.fromNow() + ' par ' + this.annotation.author;
   108                     return 'Dernière version ' + date.fromNow() + ' par ' + this.annotation.author;
       
   109                 }
       
   110             },
       
   111             revisionsUrlComputed: function() {
       
   112                 if (this.annotation) {
       
   113                     return this.revisionsUrl.replace(':annotation_guid', this.annotation.annotation_guid);
       
   114                 }
       
   115             },
       
   116             authorUrlComputed: function() {
       
   117                 if (this.annotation) {
       
   118                     return this.authorUrl.replace('--username--', this.annotation.author);
       
   119                 }
       
   120             },
       
   121             dateComputed: function() {
       
   122                 if (this.annotation) {
       
   123                     return moment(this.annotation.created).locale('fr').fromNow();
   103                 }
   124                 }
   104             },
   125             },
   105             formAction: function() {
   126             formAction: function() {
   106                 if (this.annotation) {
   127                 if (this.annotation) {
   107                     return this.action.replace(':annotation_guid', this.annotation.annotation_guid);
   128                     return this.action.replace(':annotation_guid', this.annotation.annotation_guid);