forked from Public/pics
Link tags after adding them through autosuggest.
This commit is contained in:
parent
20db3561cf
commit
05c48be785
@ -41,8 +41,9 @@ class ProvideAutoSuggest extends JSONController
|
|||||||
$results = Tag::matchPeople($data);
|
$results = Tag::matchPeople($data);
|
||||||
foreach ($results as $id_tag => $tag)
|
foreach ($results as $id_tag => $tag)
|
||||||
$this->payload['items'][] = [
|
$this->payload['items'][] = [
|
||||||
'label' => $tag,
|
'label' => $tag['tag'],
|
||||||
'id_tag' => $id_tag,
|
'id_tag' => $id_tag,
|
||||||
|
'url' => BASEURL . '/' . $tag['slug'] . '/',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,8 +335,8 @@ class Tag
|
|||||||
if (!is_array($tokens))
|
if (!is_array($tokens))
|
||||||
$tokens = explode(' ', $tokens);
|
$tokens = explode(' ', $tokens);
|
||||||
|
|
||||||
return Registry::get('db')->queryPair('
|
return Registry::get('db')->queryPairs('
|
||||||
SELECT id_tag, tag
|
SELECT id_tag, tag, slug
|
||||||
FROM tags
|
FROM tags
|
||||||
WHERE LOWER(tag) LIKE {string:tokens} AND
|
WHERE LOWER(tag) LIKE {string:tokens} AND
|
||||||
kind = {string:person}
|
kind = {string:person}
|
||||||
|
@ -175,9 +175,14 @@ class PhotoPage extends SubTemplate
|
|||||||
appendCallback: function(item) {
|
appendCallback: function(item) {
|
||||||
var request = new HttpRequest("post", "', $this->photo->getPageUrl(), '",
|
var request = new HttpRequest("post", "', $this->photo->getPageUrl(), '",
|
||||||
"id_tag=" + item.id_tag, function(response) {
|
"id_tag=" + item.id_tag, function(response) {
|
||||||
var newNode = document.createElement("li");
|
var newLink = document.createElement("a");
|
||||||
|
newLink.href = item.url;
|
||||||
|
|
||||||
var newLabel = document.createTextNode(item.label);
|
var newLabel = document.createTextNode(item.label);
|
||||||
newNode.appendChild(newLabel);
|
newLink.appendChild(newLabel);
|
||||||
|
|
||||||
|
var newNode = document.createElement("li");
|
||||||
|
newNode.appendChild(newLink);
|
||||||
|
|
||||||
var list = document.getElementById("tag_list");
|
var list = document.getElementById("tag_list");
|
||||||
list.appendChild(newNode);
|
list.appendChild(newNode);
|
||||||
|
Loading…
Reference in New Issue
Block a user