Better form titles, progress on menus

This commit is contained in:
Simon Brooke 2018-10-02 18:35:33 +01:00
parent 2df3444090
commit dc4937dfa2

View file

@ -96,7 +96,8 @@
[property application]
;; TODO: doesn't handle the case of type="link"
(case (-> property :attrs :type)
"entity" (if-let [e (child-with-tag
("entity" "link" "list")
(if-let [e (child-with-tag
application
:entity
#(= (-> % :attrs :name)
@ -111,18 +112,18 @@
(keyword (-> property :attrs :farkey))
(list (keyword (-> property :attrs :name)) 'params)))
{})
"link" (list
'do
(list
'comment
"Can't yet handle link properties")
{})
"list" (list
'do
(list
'comment
"Can't yet handle link properties")
{})
;; "link" (list
;; 'do
;; (list
;; 'comment
;; "Can't yet handle link properties")
;; {})
;; "list" (list
;; 'do
;; (list
;; 'comment
;; "Can't yet handle link properties")
;; {})
(list
'do
(list
@ -187,7 +188,16 @@
(list
'reduce
'merge
{:error (list :warnings 'record)
{:title (list
'form-title
'record
(capitalise (:name (:attrs f)))
(apply
vector
(map
#(keyword (safe-name %))
(user-distinct-properties e))))
:error (list :warnings 'record)
:record (list 'dissoc 'record :warnings)}
(cons
'list
@ -302,15 +312,18 @@
(vector 'request)
(list 'let (vector
'params
(list
'merge
(property-defaults e)
(list 'support/massage-params 'request)))
(list 'support/massage-params 'request))
(list
'l/render
(list 'support/resolve-template (str (path-part f e a) ".html"))
(list 'merge
{:title (capitalise (:name (:attrs f)))
{:title (case (:tag f)
:list
(str "List " (pretty-name e))
:form
(str "Add a " (singularise (pretty-name e)))
:page
(singularise (pretty-name e)))
:params 'params}
(case (:tag f)
:form (make-form-get-handler-content f e a n)
@ -330,6 +343,8 @@
(let
[create-name (query-name e :create)
update-name (query-name e :update)]
;; NOTE! Default values should be specified on database fields. They
;; should NOT be inserted by application layer code.
(list
'let
(vector
@ -387,7 +402,8 @@
(list 'merge 'params
(list :body 'result))
:message
(list 'str "Record created")(list :body 'result))
(list 'str "Record created")
(list :body 'result))
(list
'catch 'Exception 'x
{:message "Record created"