Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 1.55 KB | None | 0 0
  1. package bootstrap.liftweb
  2.  
  3. import net.liftweb._
  4. import util._
  5. import Helpers._
  6.  
  7. import common._
  8. import http._
  9. import sitemap._
  10. import Loc._
  11. import net.liftmodules.JQueryModule
  12. import net.liftweb.http.js.jquery._
  13.  
  14. /**
  15.  * A class that's instantiated early and run.  It allows the application
  16.  * to modify lift's environment
  17.  */
  18. class Boot {
  19.   def boot {
  20.     // where to search snippet
  21.     LiftRules.addToPackages("code")
  22.  
  23.     // Build SiteMap
  24.     val entries = List(
  25.       Menu.i("Home") / "index", // the simple way to declare a menu
  26.       Menu.i("About") / "about", // <- doesn't work
  27.  
  28.       // more complex because this menu allows anything in the
  29.       // /static path to be visible
  30.       Menu(Loc("Static", Link(List("static"), true, "/static/index"),
  31.            "Static Content")))
  32.  
  33.     // set the sitemap.  Note if you don't want access control for
  34.     // each page, just comment this line out.
  35.     LiftRules.setSiteMap(SiteMap(entries:_*))
  36.  
  37.     //Show the spinny image when an Ajax call starts
  38.     LiftRules.ajaxStart =
  39.       Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd)
  40.  
  41.     // Make the spinny image go away when it ends
  42.     LiftRules.ajaxEnd =
  43.       Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd)
  44.  
  45.     // Force the request to be UTF-8
  46.     LiftRules.early.append(_.setCharacterEncoding("UTF-8"))
  47.  
  48.     //Init the jQuery module, see http://liftweb.net/jquery for more information.
  49.     LiftRules.jsArtifacts = JQueryArtifacts
  50.     JQueryModule.InitParam.JQuery=JQueryModule.JQuery191
  51.     JQueryModule.init()
  52.  
  53.   }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement