# HG changeset patch # User Harris Baptiste # Date 1467626358 -7200 # Node ID 9b448d5307afa20b18ee64b1cc092506f2a7b3e1 # Parent ddb2d089b7d2b85b939aa715a909009652635e36 fixing tag editor diff -r ddb2d089b7d2 -r 9b448d5307af src/iconolab/static/iconolab/js/iconolab-bundle/src/components/typeahead/Typeahead.vue --- 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 () { diff -r ddb2d089b7d2 -r 9b448d5307af src/iconolab/static/iconolab/js/iconolab-bundle/src/components/typeahead/template.html --- 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"/> - Créer ce tag + Créer ce tag