Last active
December 15, 2015 16:59
Revisions
-
eltimn revised this gist
Apr 2, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ class NoVerbatimTransformer extends Transformer with Decorator { override def allowVerbatimXml: Boolean = false } trait MarkdownTypedField extends TextareaTypedField { lazy val transformer = new NoVerbatimTransformer override def asHtml: NodeSeq = valueBox -
eltimn revised this gist
Apr 2, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import net.liftweb.record.field._ import S._ import Helpers._ // https://github.com/chenkelmann/actuarius import eu.henkelmann.actuarius._ class NoVerbatimTransformer extends Transformer with Decorator { -
eltimn created this gist
Apr 2, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ package code.model import scala.xml._ import net.liftweb.util._ import net.liftweb.common._ import net.liftweb.http.S import net.liftweb.record._ import net.liftweb.record.field._ import S._ import Helpers._ import eu.henkelmann.actuarius._ class NoVerbatimTransformer extends Transformer with Decorator { override def deco = this override def allowVerbatimXml: Boolean = false } trait MarkdownTypedField extends TextareaTypedField with LiftExtras { lazy val transformer = new NoVerbatimTransformer override def asHtml: NodeSeq = valueBox .flatMap { v => tryo(XML.loadString("<div>%s</div>".format(transformer(v)))) } .openOr(<div>Error converting text to HTML</div>) } class MarkdownField[OwnerType <: Record[OwnerType]](rec: OwnerType, maxLength: Int) extends StringField(rec, maxLength) with MarkdownTypedField class OptionalMarkdownField[OwnerType <: Record[OwnerType]](rec: OwnerType, maxLength: Int) extends OptionalStringField(rec, maxLength) with MarkdownTypedField