attempted fix of tag pages
This commit is contained in:
parent
5b92aa7510
commit
dbedb15725
5
app.moon
5
app.moon
@ -2,7 +2,7 @@ lapis = require "lapis"
|
||||
console = require "lapis.console"
|
||||
|
||||
import respond_to from require "lapis.application"
|
||||
import escape_identifier from require "lapis.db"
|
||||
import escape_literal, escape_identifier from require "lapis.db"
|
||||
import unescape from require "lapis.util"
|
||||
import create_track, update_track, escape_tag from require "helpers"
|
||||
|
||||
@ -62,7 +62,8 @@ class extends lapis.Application
|
||||
@asc_desc = "ASC"
|
||||
@page = tonumber(@params.page) or 1
|
||||
|
||||
tracks = Tracks\paginated "WHERE tags LIKE ? ORDER BY #{escape_identifier @order} #{@asc_desc}", escape_tag(unescape(@params.name)), per_page: 32
|
||||
tag_pattern = " #{escape_literal unescape(@params.name)} "
|
||||
tracks = Tracks\paginated "WHERE tags LIKE #{tag_pattern} ORDER BY #{escape_identifier @order} #{@asc_desc}", per_page: 32
|
||||
@last_page = 1
|
||||
if tag = Tags\find name: unescape(@params.name)
|
||||
@last_page = 1 + math.floor tag.count / 32
|
||||
|
Reference in New Issue
Block a user