Added preliminary files
This commit is contained in:
parent
2c54418d76
commit
1353a0581c
9 changed files with 129 additions and 5 deletions
16
src/adl_support/core.clj
Normal file
16
src/adl_support/core.clj
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
(ns adl-support.core
|
||||
(:require [clojure.string :refer [split]]))
|
||||
|
||||
|
||||
(defn query-string-to-map
|
||||
[query-string]
|
||||
(reduce
|
||||
merge
|
||||
(map
|
||||
#(let [pair (split % #"=")
|
||||
value (try
|
||||
(read-string (nth pair 1))
|
||||
(catch Exception _
|
||||
(nth pair 1)))]
|
||||
(hash-map (keyword (first pair) (nth pair 1))))
|
||||
(split query-string #"\&"))))
|
||||
34
src/adl_support/tags.clj
Normal file
34
src/adl_support/tags.clj
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
(ns adl-support.tags
|
||||
(:require selmer.node
|
||||
[selmer.filter-parser :refer [split-filter-val
|
||||
safe-filter
|
||||
compile-filter-body
|
||||
fix-accessor
|
||||
get-accessor]]
|
||||
[selmer.filters :refer [filters]]
|
||||
[selmer.util :refer :all]
|
||||
[json-html.core :refer [edn->html]])
|
||||
(:import [selmer.node INode TextNode FunctionNode]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;
|
||||
;;;; adl-support.tags: selmer tags required by ADL selmer views.
|
||||
;;;;
|
||||
;;;; This program is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the MIT-style licence provided; see LICENSE.
|
||||
;;;;
|
||||
;;;; This program is distributed in the hope that it will be useful,
|
||||
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;;;; License for more details.
|
||||
;;;;
|
||||
;;;; Copyright (C) 2018 Simon Brooke
|
||||
;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
(defn if-writable-handler [params tag-content render rdr]
|
||||
"If the current element is writable by the current user, emit the content of
|
||||
the if clause; else emit the content of the else clause."
|
||||
(let [{if-tags :ifwritable else-tags :else} (tag-content rdr :ifwritable :else :endifwritable)]
|
||||
params))
|
||||
Loading…
Add table
Add a link
Reference in a new issue