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 22:08:09 -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 "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 "&nbsp;&nbsp;&nbsp;"
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"