~pepe/neil

6476e53ca409e8660ab2579477527f2ba7a0a582 — Josef Pospíšil 3 months ago 98c02b1
Add some actions tooltips
1 files changed, 11 insertions(+), 7 deletions(-)

M neil/watch/utils.janet
M neil/watch/utils.janet => neil/watch/utils.janet +11 -7
@@ 106,7 106,8 @@
(defn hx-start-btn [i &opt target]
  (def url (resolve :tasks/start :id i))
  (def attrs @{:hx-target target})
  (hx-post-ebtn "play" url attrs))
  (tooltip :top "start task"
           (hx-post-ebtn "play" url attrs)))

(defn post-btn [icon action]
  (tag "form"


@@ 121,15 122,15 @@

(defn start-btn [i]
  (def url (resolve :tasks/start :id i))
  (post-btn "play" url))
  (tooltip :top "start" (post-btn "play" url)))

(defn pause-btn []
  (def url (resolve :tasks/stop))
  (post-btn "pause" url))
  (tooltip :top "pause" (post-btn "pause" url)))

(defn stop-btn []
  (def url (resolve :tasks/done))
  (post-btn "stop" url))
  (tooltip :top "stop" (post-btn "stop" url)))

(defn hx-pause-btn []
  (def url (resolve :tasks/stop))


@@ 155,7 156,8 @@
  (def url
    (cond-> (resolve :tasks/complete :id i)
            state (. "?state=" state)))
  (hx-post-ebtn "ok" url @{:hx-target target}))
  (tooltip :top "complete task"
           (hx-post-ebtn "ok" url @{:hx-target target})))

(defn complete-project-btn [i]
  (def url (resolve :projects/complete :id i))


@@ 165,13 167,15 @@
  (def url
    (cond-> (resolve :tasks/cancel :id i)
            state (. "?state=" state)))
  (hx-post-ebtn "cancel" url @{:hx-target target}))
  (tooltip :top "cancel task"
           (hx-post-ebtn "cancel" url @{:hx-target target})))

(defn hx-resurrect-task-btn [i target &opt state]
  (def url
    (cond-> (resolve :tasks/resurect :id i)
            state (. "?state=" state)))
  (hx-post-ebtn "undo" url @{:hx-target target}))
  (tooltip :top "resurrect task"
           (hx-post-ebtn "undo" url @{:hx-target target})))

(defn resurrect-project-btn [i]
  (def url (resolve :projects/resurrect :id i))