diff --git a/controllers/ProvideAutoSuggest.php b/controllers/ProvideAutoSuggest.php index c0bd6a4..fc10474 100644 --- a/controllers/ProvideAutoSuggest.php +++ b/controllers/ProvideAutoSuggest.php @@ -41,8 +41,9 @@ class ProvideAutoSuggest extends JSONController $results = Tag::matchPeople($data); foreach ($results as $id_tag => $tag) $this->payload['items'][] = [ - 'label' => $tag, + 'label' => $tag['tag'], 'id_tag' => $id_tag, + 'url' => BASEURL . '/' . $tag['slug'] . '/', ]; } } diff --git a/controllers/ViewPhoto.php b/controllers/ViewPhoto.php index 6c15130..cff5ed6 100644 --- a/controllers/ViewPhoto.php +++ b/controllers/ViewPhoto.php @@ -98,8 +98,19 @@ class ViewPhoto extends HTMLController } // We are! - $photo->linkTags([(int) $_POST['id_tag']]); - echo json_encode(['success' => true]); - exit; + if (!isset($_POST['delete'])) + { + $photo->linkTags([(int) $_POST['id_tag']]); + echo json_encode(['success' => true]); + exit; + } + + // ... deleting, that is. + else + { + $photo->unlinkTags([(int) $_POST['id_tag']]); + echo json_encode(['success' => true]); + exit; + } } } diff --git a/models/Tag.php b/models/Tag.php index dfc9e93..ce66363 100644 --- a/models/Tag.php +++ b/models/Tag.php @@ -335,8 +335,8 @@ class Tag if (!is_array($tokens)) $tokens = explode(' ', $tokens); - return Registry::get('db')->queryPair(' - SELECT id_tag, tag + return Registry::get('db')->queryPairs(' + SELECT id_tag, tag, slug FROM tags WHERE LOWER(tag) LIKE {string:tokens} AND kind = {string:person} diff --git a/public/css/default.css b/public/css/default.css index 9fbf28e..861d257 100644 --- a/public/css/default.css +++ b/public/css/default.css @@ -588,14 +588,16 @@ a#previous_photo:hover, a#next_photo:hover { } #sub_photo #tag_list li { display: inline; + padding-right: 0.75em; } -#sub_photo #tag_list li:after { - content: ', '; +#tag_list .delete-tag { + opacity: 0.25; } -#sub_photo #tag_list li:last-child:after { - content: ''; +#tag_list .delete-tag:hover { + opacity: 1.0; } + #photo_exif_box { background: #fff; box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); diff --git a/public/js/autosuggest.js b/public/js/autosuggest.js index 9d6b6a3..066ea1b 100644 --- a/public/js/autosuggest.js +++ b/public/js/autosuggest.js @@ -158,8 +158,6 @@ TagAutoSuggest.prototype.fillContainer = function(response) { var self = this; node.addEventListener('click', function(event) { self.createNewTag(function(response) { - console.log('Nieuwe tag!!'); - console.log(response); self.appendCallback(response); }); self.closeContainer(); diff --git a/templates/PhotoPage.php b/templates/PhotoPage.php index c695c64..91ed7dc 100644 --- a/templates/PhotoPage.php +++ b/templates/PhotoPage.php @@ -148,8 +148,14 @@ class PhotoPage extends SubTemplate foreach ($this->photo->getTags() as $tag) { echo ' -