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
2019-04-17 23:43:26 -07:00

65 lines
2.0 KiB
Plaintext

import Widget from require "lapis.html"
import trim from require "lapis.util"
import Tracks from require "models"
class extends Widget
menu: =>
div ->
if @previous
a href: @url_for("track", id: @previous.id), "<"
raw "&nbsp;"
if @next
a href: @url_for("track", id: @next.id), ">"
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: "
input type: "text", name: "tags", value: trim(@track.tags), placeholder: "untagged"
br!
input type: "submit", value: "Update"
@menu!