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), "<"
raw " "
if @page != @last_page
a href: @url_for("tracks", order: @order, asc_desc: @asc_desc, page: @page + 1), ">"
raw " "
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 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!