This repository has been archived on 2024-09-20. You can view files and clone it, but cannot push or open issues or pull requests.
musicapp/views/index.moon
2019-04-17 21:05:33 -07:00

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 "&nbsp;"
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 "&nbsp;&nbsp;&nbsp;"
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"