displaying all tags for logged in users, not applying nsfp list
This commit is contained in:
parent
4260a7429a
commit
0c96c258ab
@ -1,7 +1,5 @@
|
||||
import db from "../../inc/sql.mjs";
|
||||
import cfg from "../../inc/config.mjs";
|
||||
import lib from "../../inc/lib.mjs";
|
||||
import f0cklib from "../routeinc/f0cklib.mjs";
|
||||
|
||||
export default (router, tpl) => {
|
||||
router.get(/^\/tags$/, async (req, res) => {
|
||||
@ -20,9 +18,21 @@ export default (router, tpl) => {
|
||||
LIMIT 500
|
||||
;
|
||||
`;
|
||||
|
||||
const toptags_regged = await db`
|
||||
SELECT t.id, t.tag, COUNT(DISTINCT ta.item_id) AS total_items
|
||||
FROM tags t
|
||||
LEFT JOIN tags_assign ta ON t.id = ta.tag_id
|
||||
GROUP BY t.id, t.tag
|
||||
ORDER BY total_items DESC
|
||||
LIMIT 500
|
||||
;
|
||||
`;
|
||||
|
||||
res.reply({
|
||||
body: tpl.render('tags', {
|
||||
toptags,
|
||||
toptags_regged,
|
||||
phrase,
|
||||
tmp: null
|
||||
}, req)
|
||||
|
@ -3,15 +3,25 @@
|
||||
<div class="container">
|
||||
<h3 style="text-align: center;">☯</h3>
|
||||
<div class="tags">
|
||||
@each(toptags as toptag)
|
||||
@if(session)
|
||||
@each(toptags_regged as toptag)
|
||||
<div class="tag badge badge-light mr-2">
|
||||
|
||||
<div class="tagbox-body">
|
||||
<span class="toptag_id">{!! toptag.tag !!}</span>
|
||||
<span class="toptag_tag"><a href="/tag/{!! toptag.tag !!}">{{ toptag.total_items }}</a></span>
|
||||
</div>
|
||||
</div>
|
||||
@endeach
|
||||
@else
|
||||
@each(toptags as toptag)
|
||||
<div class="tag badge badge-light mr-2">
|
||||
<div class="tagbox-body">
|
||||
<span class="toptag_id">{!! toptag.tag !!}</span>
|
||||
<span class="toptag_tag"><a href="/tag/{!! toptag.tag !!}">{{ toptag.total_items }}</a></span>
|
||||
</div>
|
||||
</div>
|
||||
@endeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user