layout added

This commit is contained in:
Tangent 2019-06-13 13:52:22 -07:00
parent 5149d15c04
commit 9d6b5f7f5e
2 changed files with 14 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import process_tags from require "helpers"
import Tracks from require "models"
class extends lapis.Application
layout: "layout"
"/console": console.make!
[track: "/track/:id[%d]"]: respond_to {
@ -61,8 +62,7 @@ class extends lapis.Application
@page = tonumber(@params.page) or 1
tracks = Tracks\paginated "* ORDER BY #{escape_identifier @order} #{@asc_desc}", per_page: 32
-- @last_page = tracks\num_pages! -- this errors (something wrong with Lapis?)
@last_page = 1 + math.floor Tracks\count("true") / 32
@last_page = 1 + math.floor Tracks\count("true") / 32 -- tracks\num_pages! errors for an unknown reason
-- validate page
if @page < 1
return redirect_to: @url_for "tracks", order: @order, asc_desc: @asc_desc, page: 1

12
views/layout.moon Normal file
View File

@ -0,0 +1,12 @@
import Widget from require "lapis.html"
class extends Widget
content: =>
html_5 ->
head ->
if @title
title "#{@title} - musicapp"
else
title "musicapp"
body ->
@content_for "inner"