import Widget from require "lapis.html" import trim from require "lapis.util" import Tracks from require "models" class extends Widget content: => div -> form { action: @url_for "new_track" method: "POST" enctype: "multipart/form" }, -> text "Artist: " input type: "text", name: "artist", placeholder: "Artist" text " Title: " input type: "text", name: "title", placeholder: "Title" br! text "Album: " input type: "text", name: "album", placeholder: "Album" text " Link: " input type: "text", name: "link", placeholder: "Link" br! text "Status: " element "select", name: "status", -> statuses = Tracks.statuses for status_name in *statuses if status_name == "new" option value: statuses[status_name], selected: true, status_name else option value: statuses[status_name], status_name text " Quality: " element "select", name: "quality", -> qualities = Tracks.qualities for quality_name in *qualities if quality_name == "unavailable" option value: qualities[quality_name], selected: true, quality_name else option value: qualities[quality_name], quality_name br! text "Genre: " input type: "text", name: "genre", placeholder: "Genre" text " Mood: " input type: "text", name: "mood", placeholder: "Mood" br! text "Tags: " textarea rows: 8, name: "tags", placeholder: "untagged" br! input type: "submit", value: "Update"