Delete widget now suppressed unless there's a valid record.

This commit is contained in:
Simon Brooke 2018-08-06 12:15:46 +01:00
parent 7be2225917
commit 9d9a800289

View file

@ -201,28 +201,34 @@
(defn delete-widget (defn delete-widget
"Return an appropriate 'save' widget for this `form` operating on this "Return an appropriate 'save' widget for this `form` operating on this
`entity` taken from this `application`. `entity` taken from this `application`."
TODO: should be suppressed unless member of a group which can delete."
[form entity application] [form entity application]
(wrap-in-if-member-of (flatten
{:tag :p (list
:attrs {:class "widget action-dangerous"} (str "{% if all "
:content [{:tag :label (s/join " " (map #(str "params." %) (key-names entity)))
:attrs {:for "delete-button" " %}")
:class "action-dangerous"}
:content [(str (wrap-in-if-member-of
"To delete this " {:tag :p
(:name (:attrs entity)) :attrs {:class "widget action-dangerous"}
" record")]} :content [{:tag :label
{:tag :input :attrs {:for "delete-button"
:attrs {:id "delete-button" :class "action-dangerous"}
:name "delete-button" :content [(str
:class "action-dangerous" "To delete this "
:type "submit" (:name (:attrs entity))
:value (str "Delete!")}}]} " record")]}
:editable {:tag :input
entity :attrs {:id "delete-button"
application)) :name "delete-button"
:class "action-dangerous"
:type "submit"
:value (str "Delete!")}}]}
:editable
entity
application)
"{% endif %}")))
(defn select-property (defn select-property