Created
March 2, 2011 13:52
-
-
Save joa/850954 to your computer and use it in GitHub Desktop.
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 characters
//lift version 2.3-M1 | |
object ErrorSnippet extends DispatchSnippet { | |
val showBug = true | |
def dispatch = { | |
case _ => bug | |
} | |
def bug = { | |
val id = nextFuncName | |
def process() = { | |
JqJsCmds.AppendHtml(id, generateMarkup()) | |
} | |
"*" #> | |
<div id={id}> | |
{SHtml.a(process _, Text("Update"))} | |
{generateMarkup()} | |
</div> | |
} | |
private def generateMarkup() = | |
if(showBug) { | |
<div><script type="text/javascript">{Unparsed("window.alert('works')")}</script>Buggy content</div> | |
} else { | |
<div>Simple content</div> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment