src_js/iconolab-bundle/src/components/editor/AnnotationForm.vue
changeset 482 b71475c27159
parent 433 616fc1fad25f
child 483 dce041bc57a9
--- a/src_js/iconolab-bundle/src/components/editor/AnnotationForm.vue	Fri Apr 28 11:17:15 2017 +0200
+++ b/src_js/iconolab-bundle/src/components/editor/AnnotationForm.vue	Fri Apr 28 11:29:47 2017 +0200
@@ -34,7 +34,11 @@
                     @change="onTagsChange($event.tags)"></tag-list>
                 <input type="hidden" name="tags" v-model="serializedTags">
             </div>
-            <p class="small text-center text-muted" v-show="readonly">{{ lastRevisionText }}</p>
+            <p class="small text-center text-muted" v-show="annotation">
+                <a v-bind:href="revisionsUrlComputed">Dernière version</a>
+                <span>{{ dateComputed }} par</span>
+                <a v-bind:href="authorUrlComputed">{{ annotation.author }}</a>
+            </p>
             <button type="submit" v-if="annotation &amp;&amp; !readonly" v-bind:class="{ disabled: !hasChanged }"
                 class="btn btn-block btn-sm btn-primary">Enregistrer une nouvelle version</button>
         </form>
@@ -70,7 +74,9 @@
             isAuthenticated: {
                 type: Boolean,
                 default: false
-            }
+            },
+            revisionsUrl: String,
+            authorUrl: String
         },
         components: {
             'tag-list': TagList
@@ -102,6 +108,21 @@
                     return 'Dernière version ' + date.fromNow() + ' par ' + this.annotation.author;
                 }
             },
+            revisionsUrlComputed: function() {
+                if (this.annotation) {
+                    return this.revisionsUrl.replace(':annotation_guid', this.annotation.annotation_guid);
+                }
+            },
+            authorUrlComputed: function() {
+                if (this.annotation) {
+                    return this.authorUrl.replace('--username--', this.annotation.author);
+                }
+            },
+            dateComputed: function() {
+                if (this.annotation) {
+                    return moment(this.annotation.created).locale('fr').fromNow();
+                }
+            },
             formAction: function() {
                 if (this.annotation) {
                     return this.action.replace(':annotation_guid', this.annotation.annotation_guid);