2018-04-23 12:22:27 +00:00
|
|
|
import Widget from require "lapis.html"
|
|
|
|
|
|
|
|
class LoggedIn extends Widget
|
|
|
|
content: =>
|
2018-04-25 00:41:51 +00:00
|
|
|
task_item = (task) ->
|
2018-04-24 23:22:50 +00:00
|
|
|
li ->
|
2018-04-25 00:43:00 +00:00
|
|
|
div class: "row", ->
|
|
|
|
div class: "column column-80", ->
|
|
|
|
if task
|
|
|
|
input type: "checkbox", id: "task-#{task.id}", onchange: "check(#{task.id});", checked: task.done
|
|
|
|
text " #{task.content}"
|
|
|
|
else
|
|
|
|
input type: "checkbox"
|
|
|
|
div class: "column column-20", ->
|
|
|
|
button class: "delete", onclick: "delete_item(this);", "x"
|
2018-04-24 23:22:50 +00:00
|
|
|
|
2018-04-24 22:31:19 +00:00
|
|
|
api_key_item = (key="") ->
|
|
|
|
li ->
|
|
|
|
div class: "row", ->
|
2018-04-24 22:56:40 +00:00
|
|
|
div class: "column column-60", ->
|
2018-04-24 22:33:52 +00:00
|
|
|
code key
|
2018-04-24 22:56:40 +00:00
|
|
|
div class: "column column-offset-20 column-20", ->
|
|
|
|
button class: "delete", onclick: "delete_item(this);", "x"
|
2018-04-24 22:31:19 +00:00
|
|
|
|
2018-04-23 12:22:27 +00:00
|
|
|
script src: "/static/index.js"
|
|
|
|
|
2018-04-24 23:22:50 +00:00
|
|
|
script id: "task-template", type: "text/x-custom-template", ->
|
|
|
|
task_item!
|
2018-04-24 22:30:19 +00:00
|
|
|
script id: "api-key-template", type: "text/x-custom-template", ->
|
|
|
|
api_key_item!
|
2018-04-25 01:04:55 +00:00
|
|
|
script id: "error-template", type: "text/x-custom-template", ->
|
|
|
|
li ->
|
2018-04-25 01:09:49 +00:00
|
|
|
div class: "row error", ->
|
2018-04-25 01:04:55 +00:00
|
|
|
div class: "column column-80", ->
|
2018-04-25 01:08:06 +00:00
|
|
|
span class: "error-text"
|
2018-04-25 01:04:55 +00:00
|
|
|
div class: "column column-20", ->
|
|
|
|
button class: "delete", onclick: "delete_item(this);", "x"
|
2018-04-24 22:30:19 +00:00
|
|
|
|
2018-04-24 17:26:17 +00:00
|
|
|
ul style: "list-style: none;", ->
|
2018-04-23 12:22:27 +00:00
|
|
|
if @tasks
|
|
|
|
for task in *@tasks
|
2018-04-24 23:22:50 +00:00
|
|
|
task_item task
|
|
|
|
|
2018-04-24 05:42:56 +00:00
|
|
|
li id: "new-task", ->
|
2018-04-23 12:22:27 +00:00
|
|
|
form {
|
|
|
|
onsubmit: "return new_task();"
|
|
|
|
}, ->
|
2018-04-24 17:26:17 +00:00
|
|
|
label for: "new-task-input", "New Task"
|
2018-04-24 22:33:52 +00:00
|
|
|
input type: "text", id: "new-task-input", placeholder: "content", autocomplete: "off"
|
2018-04-24 17:26:17 +00:00
|
|
|
input type: "submit", value: "Add Task"
|
|
|
|
|
|
|
|
button class: "collapsible", "API Keys"
|
|
|
|
div class: "content", ->
|
|
|
|
ul style: "list-style: none;", ->
|
|
|
|
if @keys
|
|
|
|
for key in *@keys
|
2018-04-24 22:30:19 +00:00
|
|
|
api_key_item key.key
|
2018-04-24 23:22:50 +00:00
|
|
|
|
2018-04-24 17:26:17 +00:00
|
|
|
li id: "new-api-key", ->
|
|
|
|
button onclick: "new_api_key()", "New API Key"
|