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