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/track.moon

72 lines
2.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 ->
td ->
if @previous
a href: @url_for("track", id: @previous.id), "<"
else
text "<"
td ->
if @next
a href: @url_for("track", id: @next.id), ">"
else
text ">"
content: =>
@menu!
div ->
form {
action: @url_for "track", id: @track.id
method: "POST"
enctype: "multipart/form"
}, ->
text "Artist: "
input type: "text", name: "artist", value: @track.artist, placeholder: "Artist"
text " Title: "
input type: "text", name: "title", value: @track.title, placeholder: "Title"
br!
text "Album: "
input type: "text", name: "album", value: @track.album, placeholder: "Album"
text " Link: "
input type: "text", name: "link", value: @track.link, placeholder: "Link"
br!
text "Status: "
element "select", name: "status", ->
statuses = Tracks.statuses
for status in *statuses
if status == statuses[@track.status]
option value: statuses[status], selected: true, status
else
option value: statuses[status], status
text " Quality: "
element "select", name: "quality", ->
qualities = Tracks.qualities
for quality in *qualities
if quality == qualities[@track.quality]
option value: qualities[quality], selected: true, quality
else
option value: qualities[quality], quality
br!
text "Genre: "
input type: "text", name: "genre", value: @track.genre, placeholder: "Genre"
text " Mood: "
input type: "text", name: "mood", value: @track.mood, placeholder: "Mood"
br!
text "Tags: "
textarea rows: 8, name: "tags", placeholder: "untagged", trim(@track.tags)
br!
input type: "submit", value: "Update"
@menu!