hide properties if none exist

integration-tests
Josha von Gizycki 6 years ago
parent acc9280f8a
commit 71ff06e3ca

@ -48,18 +48,20 @@
[:small (h (:name instance))]]
[:p [:small [:a {:href (path :instance-edit-form instance)}
"Edit Instance"]]]
[:h2 "Properties"]
(for [prop (:properties instance)
:let [attr (:attribute prop)
type (:type attr)
render-fn (case type
"date" #(str (prettify-dt %))
"markdown" md/md-to-html-string
:else #(str "<p>" % "</p>"))]]
(list [:h3 (h (:name attr))]
[:div {:class (str "instance-content "
"attr-type-" type)}
(render-fn (:value prop))]))
(when-not (empty? (:properties instance))
[:section.properties
[:h2 "Properties"]
(for [prop (:properties instance)
:let [attr (:attribute prop)
type (:type attr)
render-fn (case type
"date" #(str (prettify-dt %))
"markdown" md/md-to-html-string
:else #(str "<p>" % "</p>"))]]
(list [:h3 (h (:name attr))]
[:div {:class (str "instance-content "
"attr-type-" type)}
(render-fn (:value prop))]))])
(when-not (empty? (:links-out instance))
[:section.links
[:h2 "Outgoing Links"]

Loading…
Cancel
Save