--- a/src/iconolab/static/iconolab/js/iconolab-bundle/src/components/typeahead/Typeahead.vue Mon Jul 04 10:36:43 2016 +0200
+++ b/src/iconolab/static/iconolab/js/iconolab-bundle/src/components/typeahead/Typeahead.vue Mon Jul 04 11:59:18 2016 +0200
@@ -115,7 +115,7 @@
tagItem.tag_label = item;
var link = urlsList[index];
link = link.replace("https://fr.wikipedia.org/wiki/", "http://fr.dbpedia.org/resource/");
- tagItem.tag_link = link;
+ tagItem.tag_link = decodeURI(link);
tagItem.accuracy = 1;
tagItem.relevancy = 1;
results.push(tagItem);
@@ -125,30 +125,16 @@
},
prepareResponseData (data) {
- var data = (typeof data === 'string') ? JSON.parse(data): data;
- var results = [];
-
+ var responseData = (typeof data === 'string') ? JSON.parse(data): data;
+
if(this.datasource === "wikipedia") {
- return this.prepareWikipediaResponse(data);
+ responseData = this.prepareWikipediaResponse(responseData);
}
- if (data && data.hasOwnProperty('results')) {
- var rawResults = data.results;
- rawResults.map(function (item) {
- var tagItem = {};
- tagItem.tag_label = item.label;
- tagItem.tag_link = item.uri;
- tagItem.accuracy = 1;
- tagItem.relevancy = 1;
- results.push(tagItem);
- });
- data = results;
- }
-
- if (data && !data.length) {
+ if (Array.isArray(responseData) && !responseData.length) {
this.showAddButton = true;
}
- return data;
+ return responseData;
},
addTag () {
--- a/src/iconolab/static/iconolab/js/iconolab-bundle/src/components/typeahead/template.html Mon Jul 04 10:36:43 2016 +0200
+++ b/src/iconolab/static/iconolab/js/iconolab-bundle/src/components/typeahead/template.html Mon Jul 04 11:59:18 2016 +0200
@@ -12,7 +12,7 @@
@keydown.esc="reset"
@keyup="update"/>
- <a style="border: 1px solid red" @click="addTag" v-show="showAddButton"><i class="fa fa-plus"></i> Créer ce tag</a>
+ <a @click="addTag" v-show="showAddButton"><i class="fa fa-plus"></i> Créer ce tag</a>
<!-- the list -->
<ul v-show="hasItems || !readOnly">