src_js/iconolab-bundle/src/components/editor/AnnotationForm.vue
changeset 427 2a9ce7ec3a29
parent 418 a04c55054afe
child 433 616fc1fad25f
--- a/src_js/iconolab-bundle/src/components/editor/AnnotationForm.vue	Tue Mar 14 13:30:45 2017 +0100
+++ b/src_js/iconolab-bundle/src/components/editor/AnnotationForm.vue	Tue Mar 14 13:41:38 2017 +0100
@@ -34,6 +34,7 @@
                     @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>
             <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>
@@ -45,6 +46,7 @@
     import TagList from '../tagform/TagList.vue'
     import _ from 'lodash'
     import showdown from 'showdown'
+    import moment from 'moment'
 
     const converter = new showdown.Converter()
 
@@ -91,9 +93,15 @@
             }
         },
         computed: {
-            descriptionComputed: function(){
+            descriptionComputed: function() {
               return converter.makeHtml(this.description);
             },
+            lastRevisionText: function() {
+                if (this.annotation) {
+                    var date = moment(this.annotation.created).locale('fr');
+                    return 'Dernière version ' + date.fromNow() + ' par ' + this.annotation.author;
+                }
+            },
             formAction: function() {
                 if (this.annotation) {
                     return this.action.replace(':annotation_guid', this.annotation.annotation_guid);