Allow not specifying accuracy & relevancy in tags.
authorAlexandre Segura <mex.zktk@gmail.com>
Tue, 28 Feb 2017 15:50:33 +0100
changeset 399 3d9a9de54bc0
parent 398 380450f0ca00
child 400 c85505149eea
Allow not specifying accuracy & relevancy in tags.
src_js/iconolab-bundle/src/components/tagform/ColorButtons.vue
src_js/iconolab-bundle/src/components/tagform/TagList.vue
src_js/iconolab-bundle/src/components/tagform/TagListItem.vue
src_js/iconolab-bundle/src/components/tagform/Typeahead.vue
--- a/src_js/iconolab-bundle/src/components/tagform/ColorButtons.vue	Mon Feb 27 19:08:52 2017 +0100
+++ b/src_js/iconolab-bundle/src/components/tagform/ColorButtons.vue	Tue Feb 28 15:50:33 2017 +0100
@@ -64,6 +64,9 @@
                         if (this.originalValue === null) {
                             this.value = null;
                         }
+                        if (this.originalValue === 0) {
+                            this.value = 0;
+                        }
                         return;
                     }
 
--- a/src_js/iconolab-bundle/src/components/tagform/TagList.vue	Mon Feb 27 19:08:52 2017 +0100
+++ b/src_js/iconolab-bundle/src/components/tagform/TagList.vue	Tue Feb 28 15:50:33 2017 +0100
@@ -49,6 +49,11 @@
             },
             tags: function(tags) {
                 this.$emit('change', { tags: tags });
+            },
+            readonly: function(readonly) {
+                if (readonly) {
+                    this.hideAll();
+                }
             }
         },
         mounted() {
--- a/src_js/iconolab-bundle/src/components/tagform/TagListItem.vue	Mon Feb 27 19:08:52 2017 +0100
+++ b/src_js/iconolab-bundle/src/components/tagform/TagListItem.vue	Tue Feb 28 15:50:33 2017 +0100
@@ -90,7 +90,7 @@
 
             $(this.$el).find('.collapse').collapse({ toggle: false });
 
-            if (this.isNew) {
+            if (!this.$parent.readonly && this.isNew) {
                 this.$parent.hideAll();
                 this.show();
                 this.$refs.accuracy.animate();
--- a/src_js/iconolab-bundle/src/components/tagform/Typeahead.vue	Mon Feb 27 19:08:52 2017 +0100
+++ b/src_js/iconolab-bundle/src/components/tagform/Typeahead.vue	Tue Feb 28 15:50:33 2017 +0100
@@ -133,8 +133,8 @@
                     var link = urlsList[index];
                     link = link.replace("https://fr.wikipedia.org/wiki/", "http://fr.dbpedia.org/resource/");
                     tagItem.tag_link = decodeURI(link);
-                    tagItem.accuracy = null;
-                    tagItem.relevancy = null;
+                    tagItem.accuracy = 0;
+                    tagItem.relevancy = 0;
                     results.push(tagItem);
                 });
 
@@ -153,8 +153,8 @@
                     return [{
                         tag_label: this.query,
                         tag_link: this.query,
-                        accuracy: null,
-                        relevancy: null
+                        accuracy: 0,
+                        relevancy: 0
                     }];
                 }
                 return responseData;