Created
June 10, 2014 18:47
-
-
Save fmpwizard/25f9ed53a579c0e8221e to your computer and use it in GitHub Desktop.
Bootstrap Lift messages / notices
This file contains 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
val jsNotice = | |
"""$('#lift__noticesContainer___notice li') | |
|.addClass("alert alert-success") | |
|.append('<button type="button" class="close" data-dismiss="alert">×</button>')""".stripMargin | |
val jsWarning = | |
"""$('#lift__noticesContainer___warning li') | |
|.addClass("alert") | |
|.append('<button type="button" class="close" data-dismiss="alert">×</button>')""".stripMargin | |
val jsError = | |
"""$('#lift__noticesContainer___error li') | |
|.addClass("alert alert-error") | |
|.append('<button type="button" class="close" data-dismiss="alert">×</button>')""".stripMargin | |
LiftRules.noticesEffects.default.set( | |
(notice: Box[NoticeType.Value], id: String) => { | |
val js = notice.map( _.title) match{ | |
case Full("Notice") => Full(JE.JsRaw( jsNotice ).cmd) | |
case Full("Warning") => Full(JE.JsRaw( jsWarning ).cmd) | |
case Full("Error") => Full(JE.JsRaw( jsError ).cmd) | |
case _ => Full(JE.JsRaw( jsNotice ).cmd) | |
} | |
js | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment