Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed a problem with the wizard-all.html template and cleaned up the …

…code
  • Loading branch information...
commit 77307a445074f6c39e181ec7f6e84c7781df68b8 1 parent c2a6875
@dpp dpp authored
View
60 src/main/scala/bootstrap/liftweb/Boot.scala
@@ -1,15 +1,16 @@
package bootstrap.liftweb
-import _root_.net.liftweb.util._
-import _root_.net.liftweb.common._
-import _root_.net.liftweb.http._
-import _root_.net.liftweb.http.provider._
-import _root_.net.liftweb.sitemap._
-import _root_.net.liftweb.sitemap.Loc._
+import net.liftweb._
+import util._
import Helpers._
-import _root_.net.liftweb.mapper.{DB, ConnectionManager, Schemifier, DefaultConnectionIdentifier, StandardDBVendor}
-import _root_.java.sql.{Connection, DriverManager}
-import _root_.code.model._
+
+import common._
+import http._
+import sitemap._
+import Loc._
+import mapper._
+
+import code.model._
/**
@@ -30,41 +31,44 @@ class Boot {
DB.defineConnectionManager(DefaultConnectionIdentifier, vendor)
}
+ // Use Lift's Mapper ORM to populate the database
+ // you don't need to use Mapper to use Lift... use
+ // any ORM you want
+ Schemifier.schemify(true, Schemifier.infoF _, User)
+
// where to search snippet
LiftRules.addToPackages("code")
- Schemifier.schemify(true, Schemifier.infoF _, User)
// Build SiteMap
- val entries = Menu(Loc("Home", List("index"), "Home")) ::
- Menu(Loc("Static", Link(List("static"), true, "/static/index"),
- "Static Content")) ::
+ val entries = List(
+ Menu.i("Home") / "index", // the simple way to declare a menu
+
+ // more complex because this menu allows anything in the
+ // /static path to be visible
+ Menu(Loc("Static", Link(List("static"), true, "/static/index"),
+ "Static Content"))) :::
+ // the User management menu items
User.sitemap
+ // set the sitemap. Note if you don't want access control for
+ // each page, just comment this line out.
LiftRules.setSiteMap(SiteMap(entries:_*))
- /*
- * Show the spinny image when an Ajax call starts
- */
+ //Show the spinny image when an Ajax call starts
LiftRules.ajaxStart =
Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd)
-
- /*
- * Make the spinny image go away when it ends
- */
+
+ // Make the spinny image go away when it ends
LiftRules.ajaxEnd =
Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd)
- LiftRules.early.append(makeUtf8)
+ // Force the request to be UTF-8
+ LiftRules.early.append(_.setCharacterEncoding("UTF-8"))
+ // What is the function to test if a user is logged in?
LiftRules.loggedInTest = Full(() => User.loggedIn_?)
+ // Make a transaction span the whole HTTP request
S.addAround(DB.buildLoanWrapper)
}
-
- /**
- * Force the request to be UTF-8
- */
- private def makeUtf8(req: HTTPRequest) {
- req.setCharacterEncoding("UTF-8")
- }
}
View
10 src/main/webapp/index.html
@@ -1,9 +1,9 @@
<lift:surround with="default" at="content">
<h2>Welcome to your project!</h2>
- <p>
- <lift:helloWorld.howdy>
- <span>Welcome to app at <b:time/></span>
- </lift:helloWorld.howdy>
- </p>
+ <p>
+ <lift:helloWorld.howdy>
+ <span>Welcome to your Lift app at <b:time/></span>
+ </lift:helloWorld.howdy>
+ </p>
</lift:surround>
View
8 src/main/webapp/templates-hidden/wizard-all.html
@@ -1,5 +1,5 @@
<div>
- <div>Page <wizard:screen_number/> of <wizard:total_screens/></div>
+ <wizard:screen_info><div>Page <wizard:screen_number/> of <wizard:total_screens/></div></wizard:screen_info>
<wizard:wizard_top> <div> <wizard:bind/> </div> </wizard:wizard_top>
<wizard:screen_top> <div> <wizard:bind/> </div> </wizard:screen_top>
<wizard:errors> <div> <ul> <wizard:item> <li> <wizard:bind/> </li> </wizard:item> </ul> </div> </wizard:errors>
@@ -8,7 +8,9 @@
<wizard:line>
<tr>
<td>
- <wizard:label error_style="error"/> <wizard:help/> <wizard:field_errors> <ul> <wizard:error> <li> <wizard:bind/> </li> </wizard:error> </ul> </wizard:field_errors>
+ <wizard:label><label wizard:for=""><wizard:bind/></label></wizard:label>
+ <wizard:help><span><wizard:bind/></span></wizard:help>
+ <wizard:field_errors> <ul> <wizard:error> <li> <wizard:bind/> </li> </wizard:error> </ul> </wizard:field_errors>
</td>
<td> <wizard:form/> </td>
</tr>
@@ -18,4 +20,4 @@
<div> <table> <tr> <td> <wizard:prev/> </td> <td> <wizard:cancel/> </td> <td> <wizard:next/> </td> </tr> </table> </div>
<wizard:screen_bottom> <div> <wizard:bind/> </div> </wizard:screen_bottom>
<wizard:wizard_bottom> <div> <wizard:bind/> </div> </wizard:wizard_bottom>
-</div>
+</div>
Please sign in to comment.
Something went wrong with that request. Please try again.