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 "Title"
|
|
th "Link"
|
|
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: "title", value: track.title
|
|
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 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: "title", placeholder: "title"
|
|
td ->
|
|
raw " "
|
|
input type: "text", name: "link", placeholder: "link"
|
|
td ->
|
|
element "select", name: "status", ->
|
|
for status in *Tracks.statuses
|
|
option value: Tracks.statuses[status], status
|
|
td -> input type: "submit", value: "Submit"
|