This repository has been archived on 2024-09-20. You can view files and clone it, but cannot push or open issues or pull requests.
musicapp/views/tracks.moon
2019-04-17 23:43:26 -07:00

46 lines
1.3 KiB
Plaintext

import Widget from require "lapis.html"
import Tracks from require "models"
class extends Widget
menu: =>
div ->
if @page != 1
a href: @url_for("tracks", order: @order, asc_desc: @asc_desc, page: 1), "<<"
raw "&nbsp;"
a href: @url_for("tracks", order: @order, asc_desc: @asc_desc, page: @page - 1), "<"
raw "&nbsp;"
if @page != @last_page
a href: @url_for("tracks", order: @order, asc_desc: @asc_desc, page: @page + 1), ">"
raw "&nbsp;"
a href: @url_for("tracks", order: @order, asc_desc: @asc_desc, page: @last_page), ">>"
content: =>
@menu!
div ->
element "table", ->
tr ->
th "Title"
th "Artist"
th "Genre"
th "Mood"
th "Album"
th "Link"
th "Status"
th "Quality"
for track in *@tracks
tr ->
td ->
a href: @url_for("track", id: track.id), track.title
td track.artist
td track.genre
td track.mood
td track.album
td ->
if track.link and #track.link > 0
a href: track.link, track.link
td Tracks.statuses[track.status]
td Tracks.qualities[track.quality]
@menu!