62 lines
2.0 KiB
Plaintext
62 lines
2.0 KiB
Plaintext
import Widget from require "lapis.html"
|
|
|
|
import Tracks from require "models"
|
|
|
|
class extends Widget
|
|
content: =>
|
|
div ->
|
|
a href: @url_for("index", page: @page - 1), "<"
|
|
raw " "
|
|
a href: @url_for("index", page: @page + 1), ">"
|
|
element "table", ->
|
|
tr ->
|
|
th "Artist"
|
|
th "Name"
|
|
th "URL"
|
|
th "Status"
|
|
th "✓"
|
|
|
|
for track in *@tracks
|
|
tr ->
|
|
form {
|
|
action: @url_for "index", page: @page
|
|
method: "POST"
|
|
enctype: "multipart/form-data"
|
|
}, ->
|
|
td -> input type: "text", name: "artist", value: track.artist
|
|
td -> input type: "text", name: "name", value: track.name
|
|
td ->
|
|
if track.url and #track.url > 0
|
|
a href: track.url, "*"
|
|
else
|
|
text "+"
|
|
text " "
|
|
input type: "text", name: "url", value: track.url
|
|
td ->
|
|
element "select", name: "status", ->
|
|
for status in *Tracks.statuses
|
|
if status == Tracks.statuses[track.status]
|
|
option value: Tracks.statuses[status], selected: true, status
|
|
else
|
|
option value: Tracks.statuses[status], status
|
|
td ->
|
|
input type: "hidden", name: "id", value: track.id
|
|
input type: "submit", value: "Update"
|
|
|
|
tr ->
|
|
form {
|
|
action: @url_for "index", page: @page
|
|
method: "POST"
|
|
enctype: "multipart/form-data"
|
|
}, ->
|
|
td -> input type: "text", name: "artist", placeholder: "artist"
|
|
td -> input type: "text", name: "name", placeholder: "name"
|
|
td ->
|
|
raw " "
|
|
input type: "text", name: "url", placeholder: "url"
|
|
td ->
|
|
element "select", name: "status", ->
|
|
for status in *Tracks.statuses
|
|
option value: Tracks.statuses[status], status
|
|
td -> input type: "submit", value: "Submit"
|