Version 1, last updated by awouda at 20 Jan 03:18 UTC
Modal window using jquery's UIblock
To create a confirmation dialog for a deletion one can find an example in the Liftweb group which shows a snippet method like this:
def deleteRhodeIsland() = SHtml.ajaxButton(Text("Delete?"),
() => JsRaw("$.blockUI({ message: " + (</p><h1><br />
Do you want to delete Rhode Island?
{
SHtml.ajaxButton("yes", () => { println("deleted Rhode Island...");JsRaw("$.unblockUI();").cmd })
}
<button onclick="$.unblockUI()">no</button></h1><p>).toString.encJs +
" });").cmd) }
When using this, you need to incorporate the jquery.blockui.js file which can be downloaded here:
https://raw.github.com/malsup/blockui/master/jquery.blockUI.js
Apart from that you should add this resource in /src/main/resources/toserve and allow access to it using (in Boot.scala)
ResourceServer.allow {
case "jquery.blockui.js" :: Nil => true
}
After adding the file like this
<script id="jquery-blockui" src="/classpath/jquery.blockui.js" type="text/javascript" />
in the page (good place would be default.html) the above code should work.