Added drill-down in lists.
This commit is contained in:
parent
e879b8b628
commit
40fc3a99cc
|
@ -281,7 +281,8 @@
|
|||
" ||', '|| "
|
||||
(compose-convenience-entity-field field entity application))
|
||||
" AS "
|
||||
(field-name field)))
|
||||
(field-name field)
|
||||
"_expanded"))
|
||||
|
||||
|
||||
(defn emit-convenience-view
|
||||
|
@ -308,14 +309,17 @@
|
|||
"SELECT "
|
||||
(s/join
|
||||
",\n\t"
|
||||
(flatten
|
||||
(map
|
||||
#(if
|
||||
(= (:type (:attrs %)) "entity")
|
||||
(list
|
||||
(emit-convenience-entity-field % entity application)
|
||||
(str (safe-name entity) "." (field-name %)))
|
||||
(str (safe-name entity) "." (field-name %)))
|
||||
(filter
|
||||
#(not (= (:type (:attrs %)) "link"))
|
||||
(all-properties entity) ))))
|
||||
(all-properties entity) )))))
|
||||
(str
|
||||
"FROM " (s/join ", " (set (compose-convenience-view-select-list entity application true))))
|
||||
(if
|
||||
|
|
|
@ -362,6 +362,7 @@
|
|||
taken from this `application`. If `page` is nil, generate a default page
|
||||
template for the entity."
|
||||
[page entity application]
|
||||
;; TODO
|
||||
)
|
||||
|
||||
|
||||
|
@ -416,7 +417,21 @@
|
|||
:value "Search"}}]})))}]})
|
||||
|
||||
|
||||
(defn- list-tbody
|
||||
(defn edit-link
|
||||
[entity application parameters]
|
||||
(str
|
||||
(editor-name entity application)
|
||||
"?"
|
||||
(s/join
|
||||
"&"
|
||||
(map
|
||||
#(let [n (:name (:attrs %1))]
|
||||
(str n "={{ record." %2 " }}"))
|
||||
(key-names entity)
|
||||
parameters))))
|
||||
|
||||
|
||||
(defn list-tbody
|
||||
"Return a table body element for the list view for this `list-spec` of this `entity` within
|
||||
this `application`."
|
||||
[list-spec entity application]
|
||||
|
@ -430,22 +445,26 @@
|
|||
(concat
|
||||
(map
|
||||
(fn [field]
|
||||
{:tag :td :content [(str "{{ record." (:property (:attrs field)) " }}")]})
|
||||
{:tag :td :content
|
||||
(let
|
||||
[p (first (filter #(= (:name (:attrs %)) (:property (:attrs field))) (all-properties entity)))
|
||||
e (first
|
||||
(filter
|
||||
#(= (:name (:attrs %)) (:entity (:attrs p)))
|
||||
(children-with-tag application :entity)))
|
||||
c (str "{{ record." (:property (:attrs field)) " }}")]
|
||||
(if
|
||||
(= (:type (:attrs p)) "entity")
|
||||
[{:tag :a
|
||||
:attrs {:href (edit-link e application (list (:name (:attrs p))))}
|
||||
:content [(str "{{ record." (:property (:attrs field)) "_expanded }}")]}]
|
||||
[c]))})
|
||||
(fields list-spec))
|
||||
[{:tag :td
|
||||
:content
|
||||
[{:tag :a
|
||||
:attrs
|
||||
{:href
|
||||
(str
|
||||
(editor-name entity application)
|
||||
"?"
|
||||
(s/join
|
||||
"&"
|
||||
(map
|
||||
#(let [n (:name (:attrs %))]
|
||||
(str n "={{ record." n "}}"))
|
||||
(children (first (filter #(= (:tag %) :key) (children entity)))))))}
|
||||
{:href (edit-link entity application (key-names entity))}
|
||||
:content ["View"]}]}]))}
|
||||
"{% endfor %}"]})
|
||||
|
||||
|
|
Loading…
Reference in a new issue