import Widget from require "lapis.html"
import Tracks from require "models"
class extends Widget
menu: =>
div ->
element "table", ->
tr ->
if @page != 1
td ->
a href: @url_for("tracks", order: @order, asc_desc: @asc_desc, page: 1), "<<"
a href: @url_for("tracks", order: @order, asc_desc: @asc_desc, page: @page - 1), "<"
else
td "<<"
td "<"
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), ">>"
td ">"
td ">>"
content: =>
@menu!
th "Title"
th "Artist"
th "Genre"
th "Mood"
th "Album"
th "Link"
th "Status"
th "Quality"
for track in *@tracks
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]