fixed a couple bugs
This commit is contained in:
parent
10a66adb7c
commit
99b81c6da1
9
app.moon
9
app.moon
@ -7,7 +7,7 @@ import Tracks from require "models"
|
||||
class extends lapis.Application
|
||||
"/console": console.make!
|
||||
|
||||
[tracks: "/tracks(/:order[%a])(/:asc_desc[%u])(/:page[%d])"]: =>
|
||||
[tracks: "/tracks(/:order[%a])(/:asc_desc)(/:page[%d])"]: =>
|
||||
@order = tostring(@params.order)\lower!
|
||||
-- validate order field
|
||||
@order = "id" unless Tracks.fields[@order]
|
||||
@ -16,8 +16,11 @@ class extends lapis.Application
|
||||
@asc_desc = "ASC" if @asc_desc != "DESC"
|
||||
@page = tonumber(@params.page) or 1
|
||||
|
||||
tracks = Tracks\paginated "* ORDER BY ? ?", @order, @asc_desc, per_page: 32
|
||||
@last_page = tracks\num_pages!
|
||||
tracks = Tracks\paginated "* ORDER BY #{@order} #{@asc_desc}", per_page: 32
|
||||
-- @last_page = tracks\num_pages! -- TODO figure out why this errors
|
||||
@last_page = 150
|
||||
-- if true
|
||||
-- return "success this far"
|
||||
-- validate page
|
||||
if @page < 1
|
||||
return redirect_to: @url_for "tracks", order: @order, asc_desc: @asc_desc, page: 1
|
||||
|
@ -3,7 +3,7 @@ import Widget from require "lapis.html"
|
||||
import Tracks from require "models"
|
||||
|
||||
class extends Widget
|
||||
@menu: =>
|
||||
menu: =>
|
||||
div ->
|
||||
if @page != 1
|
||||
a href: @url_for("tracks", order: @order, asc_desc: @asc_desc, page: 1), "<<"
|
||||
|
Reference in New Issue
Block a user