You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to enf...@googlegroups.com
Hey,
I would like to have a transform that leaves the content in the template alone if the value passed to the transform is nil. How should I go about implementing this?
Example:
(defaction foo [text]
["#bar"] (em/maybe-content text)
So if text is nil the content in #bar is left alone.
Thanks in advance,
Toni
Creighton Kirkendall
unread,
Oct 18, 2012, 9:03:40 AM10/18/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to enf...@googlegroups.com
I think I would create a nil transform that does nothing.
(defn maybe-content[val]
(if
(em/trans[pnod] ))
(defaction foo [text]
["#bar"] (if (nil? text)
(nil-trans)
(em-context
--
ckirkendall
unread,
Oct 18, 2012, 9:08:39 AM10/18/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to enf...@googlegroups.com
Sorry hit enter on accident.
(defn maybe-content [val]
(if (nil? val)
(em/trans [pnod] )
(em/content val)))
Note: em/trans is a macro for creating custom transforms, by passing an empty body basically you are creating nil transform.
CK
Toni Tuominen
unread,
Oct 18, 2012, 9:20:50 AM10/18/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to enf...@googlegroups.com
Thanks, worked like a charm. Also thanks for writing enfocus, it's awesome.