82 lines
3.1 KiB
Plaintext
82 lines
3.1 KiB
Plaintext
import Widget from require "lapis.html"
|
|
|
|
import trim from require "lapis.util"
|
|
import Tracks from require "models"
|
|
|
|
class extends Widget
|
|
menu: =>
|
|
div ->
|
|
element "table", ->
|
|
tr ->
|
|
if @page != 1
|
|
td ->
|
|
a href: @url_for("tag", name: @params.name, order: @order, asc_desc: @asc_desc, page: 1), "<<"
|
|
td ->
|
|
a href: @url_for("tag", name: @params.name, order: @order, asc_desc: @asc_desc, page: @page - 1), "<"
|
|
else
|
|
td "<<"
|
|
td "<"
|
|
if @page != @last_page
|
|
td ->
|
|
a href: @url_for("tag", name: @params.name, order: @order, asc_desc: @asc_desc, page: @page + 1), ">"
|
|
td ->
|
|
a href: @url_for("tag", name: @params.name, order: @order, asc_desc: @asc_desc, page: @last_page), ">>"
|
|
else
|
|
td ">"
|
|
td ">>"
|
|
|
|
content: =>
|
|
@menu!
|
|
div ->
|
|
element "table", ->
|
|
tr ->
|
|
th "Artist"
|
|
th "Title"
|
|
th "Album"
|
|
th "Genre"
|
|
th "Mood"
|
|
th "Link"
|
|
th "Status"
|
|
th "Quality"
|
|
th "✓"
|
|
th "Tags"
|
|
|
|
for track in *@tracks
|
|
tr class: Tracks.statuses[track.status], ->
|
|
form {
|
|
action: @url_for "tag", name: @params.name, order: @order, asc_desc: @asc_desc, page: @page
|
|
method: "POST"
|
|
enctype: "multipart/form-data"
|
|
}, ->
|
|
td -> input type: "text", name: "artist", value: track.artist
|
|
td -> input type: "text", name: "title", value: track.title
|
|
td -> input type: "text", name: "album", value: track.album
|
|
td -> input type: "text", name: "genre", value: track.genre
|
|
td -> input type: "text", name: "mood", value: track.mood
|
|
td ->
|
|
if track.link and #track.link > 0
|
|
a href: track.link, "*"
|
|
else
|
|
text "+"
|
|
text " "
|
|
input type: "text", name: "link", value: track.link
|
|
td ->
|
|
element "select", name: "status", ->
|
|
for status_name in *Tracks.statuses
|
|
if status_name == Tracks.statuses[track.status]
|
|
option value: Tracks.statuses[status_name], selected: true, status_name
|
|
else
|
|
option value: Tracks.statuses[status_name], status_name
|
|
td ->
|
|
element "select", name: "quality", ->
|
|
for quality_name in *Tracks.qualities
|
|
if quality_name == Tracks.qualities[track.quality]
|
|
option value: Tracks.qualities[quality_name], selected: true, quality_name
|
|
else
|
|
option value: Tracks.qualities[quality_name], quality_name
|
|
td ->
|
|
input type: "hidden", name: "id", value: track.id
|
|
input type: "submit", value: "Update"
|
|
td -> input type: "text", name: "tags", value: trim(track.tags)
|
|
@menu!
|