Substantial improvements
This commit is contained in:
parent
ea9341145e
commit
3320cff4b5
|
@ -165,28 +165,30 @@
|
|||
pretty-name
|
||||
" records having any string field matching the parameter of the same name by substring match")
|
||||
(str "SELECT * FROM lv_" entity-name)
|
||||
"WHERE "
|
||||
(s/join
|
||||
"\n\tOR "
|
||||
"\n\t--~ "
|
||||
(cons
|
||||
"WHERE false"
|
||||
(filter
|
||||
string?
|
||||
(map
|
||||
#(case (:type (:attrs %))
|
||||
("string" "text")
|
||||
#(str
|
||||
"(if (:" (-> % :attrs :name) " params) \"OR "
|
||||
(case (:type (:attrs %))
|
||||
("string" "text" "defined") ;; TODO: 'defined' types may be string or number - more work here
|
||||
(str
|
||||
(safe-name (-> % :attrs :name) :sql)
|
||||
" LIKE '%params."
|
||||
(-> % :attrs :name) "%'")
|
||||
" LIKE '%:" (-> % :attrs :name) "%'")
|
||||
("date" "time" "timestamp")
|
||||
(str
|
||||
(safe-name (-> % :attrs :name) :sql)
|
||||
" = 'params."
|
||||
(-> % :attrs :name) "'")
|
||||
" = ':" (-> % :attrs :name) "'")
|
||||
(str
|
||||
(safe-name (-> % :attrs :name) :sql)
|
||||
" = params."
|
||||
" = :"
|
||||
(-> % :attrs :name)))
|
||||
properties)))
|
||||
"\")")
|
||||
properties))))
|
||||
(order-by-clause entity "lv_")
|
||||
"--~ (if (:offset params) \"OFFSET :offset \")"
|
||||
"--~ (if (:limit params) \"LIMIT :limit\" \"LIMIT 100\")")))})))
|
||||
|
|
|
@ -69,10 +69,7 @@
|
|||
(vector 'r)
|
||||
(list 'let (vector
|
||||
'p
|
||||
(list
|
||||
'merge
|
||||
(list 'support/query-string-to-map (list :query-string 'r))
|
||||
(list :params 'r)))
|
||||
(list 'support/massage-params (list :params 'r)))
|
||||
;; TODO: we must take key params out of just params,
|
||||
;; but we should take all other params out of form-params - because we need the key to
|
||||
;; load the form in the first place, but just accepting values of other params would
|
||||
|
@ -194,7 +191,7 @@
|
|||
(binding [*out* output]
|
||||
(pprint (file-header application))
|
||||
(println)
|
||||
(pprint '(defn admin
|
||||
(pprint '(defn index
|
||||
[r]
|
||||
(l/render
|
||||
(support/resolve-template
|
||||
|
|
|
@ -318,7 +318,18 @@
|
|||
{:id widget-name
|
||||
:name widget-name
|
||||
:type (widget-type property application typedef)
|
||||
:value (str "{{record." widget-name "}}")}
|
||||
:value (str "{{record." widget-name "}}")
|
||||
:maxlength (:size (:attrs property))
|
||||
:size (cond
|
||||
(nil? (:size (:attrs property)))
|
||||
"16"
|
||||
(try
|
||||
(> (read-string
|
||||
(:size (:attrs property))) 60)
|
||||
(catch Exception _ false))
|
||||
"60"
|
||||
true
|
||||
(:size (:attrs property)))}
|
||||
(if
|
||||
(:minimum (:attrs typedef))
|
||||
{:min (:minimum (:attrs typedef))})
|
||||
|
|
Loading…
Reference in a new issue