default order & asc/desc changed for tags

This commit is contained in:
Tangent 2019-06-27 20:26:04 -07:00
parent 674fb60f86
commit 4cede883c5

View File

@ -59,11 +59,11 @@ class extends lapis.Application
-- validate order -- validate order
@order = tostring(@params.order)\lower! @order = tostring(@params.order)\lower!
unless Tags.fields[@order] unless Tags.fields[@order]
@order = "id" @order = "count"
-- validate ascending/descending (ascending default) -- validate ascending/descending (ascending default)
@asc_desc = tostring(@params.asc_desc)\upper! @asc_desc = tostring(@params.asc_desc)\upper!
if @asc_desc != "DESC" and @asc_desc != "ASC" if @asc_desc != "DESC" and @asc_desc != "ASC"
@asc_desc = "ASC" @asc_desc = "DESC"
@page = tonumber(@params.page) or 1 @page = tonumber(@params.page) or 1
tags = Tags\paginated "* ORDER BY #{escape_identifier @order} #{@asc_desc}", per_page: 32 tags = Tags\paginated "* ORDER BY #{escape_identifier @order} #{@asc_desc}", per_page: 32