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 " "
a href: @url_for("tracks", order: @order, asc_desc: @asc_desc, page: @page - 1), "<"
if @page != @last_page
a href: @url_for("tracks", order: @order, asc_desc: @asc_desc, page: @page + 1), ">"
a href: @url_for("tracks", order: @order, asc_desc: @asc_desc, page: @last_page), ">>"
content: =>
@menu!
element "table", ->
tr ->
th "Title"
th "Artist"
th "Genre"
th "Mood"
th "Album"
th "Link"
th "Status"
th "Quality"
for track in *@tracks
td ->
a href: @url_for("track", id: track.id), track.title
td track.artist
td track.genre
td track.mood
td track.album
if track.link and #track.link > 0
a href: track.link, track.link
td Tracks.statuses[track.status]
td Tracks.qualities[track.quality]