layout added
This commit is contained in:
parent
5149d15c04
commit
9d6b5f7f5e
4
app.moon
4
app.moon
@ -9,6 +9,7 @@ import process_tags from require "helpers"
|
|||||||
import Tracks from require "models"
|
import Tracks from require "models"
|
||||||
|
|
||||||
class extends lapis.Application
|
class extends lapis.Application
|
||||||
|
layout: "layout"
|
||||||
"/console": console.make!
|
"/console": console.make!
|
||||||
|
|
||||||
[track: "/track/:id[%d]"]: respond_to {
|
[track: "/track/:id[%d]"]: respond_to {
|
||||||
@ -61,8 +62,7 @@ class extends lapis.Application
|
|||||||
@page = tonumber(@params.page) or 1
|
@page = tonumber(@params.page) or 1
|
||||||
|
|
||||||
tracks = Tracks\paginated "* ORDER BY #{escape_identifier @order} #{@asc_desc}", per_page: 32
|
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 -- tracks\num_pages! errors for an unknown reason
|
||||||
@last_page = 1 + math.floor Tracks\count("true") / 32
|
|
||||||
-- validate page
|
-- validate page
|
||||||
if @page < 1
|
if @page < 1
|
||||||
return redirect_to: @url_for "tracks", order: @order, asc_desc: @asc_desc, page: 1
|
return redirect_to: @url_for "tracks", order: @order, asc_desc: @asc_desc, page: 1
|
||||||
|
12
views/layout.moon
Normal file
12
views/layout.moon
Normal 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"
|
Reference in New Issue
Block a user