2019-04-18 06:23:16 +00:00
|
|
|
import Widget from require "lapis.html"
|
|
|
|
|
|
|
|
import trim from require "lapis.util"
|
|
|
|
|
|
|
|
import Tracks from require "models"
|
|
|
|
|
|
|
|
class extends Widget
|
2019-04-18 06:43:26 +00:00
|
|
|
menu: =>
|
|
|
|
div ->
|
2019-06-13 16:42:23 +00:00
|
|
|
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 ">"
|
2019-04-18 06:43:26 +00:00
|
|
|
|
2019-04-18 06:23:16 +00:00
|
|
|
content: =>
|
2019-04-18 06:43:26 +00:00
|
|
|
@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: "
|
2019-06-13 16:42:23 +00:00
|
|
|
textarea rows: 8, name: "tags", placeholder: "untagged", trim(@track.tags)
|
2019-04-18 06:43:26 +00:00
|
|
|
br!
|
|
|
|
input type: "submit", value: "Update"
|
|
|
|
@menu!
|