Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 10 commits
  • 6 files changed
  • 0 commit comments
  • 3 contributors
Commits on Mar 16, 2012
@mads379 mads379 Added a bit of responsive css using media queries
This is just to get the ball rolling on the responsive design. I
only done a quick smoke-test and the width that activate the change
has been chosen pretty randomly :)

/Mads
1bf7b37
@d6y d6y Added page on deploying to cloud bees. 29731da
@d6y d6y Added more structure to the template as guidance. f738718
@d6y d6y Improved by showing outcome, and clarified the problem and solution. 22f3793
@d6y d6y Explained the effect of lift:Menu.title 0346b9b
@mads379 mads379 CSS Changes
These changes are purely subjective:

- p-tags are now justified and the width is as wide as the enclosing
  tag. This makes text align in a prettier way imo :)
- H2 tags are now smaller. I thought that the h2-header were taking
  up more space than necessary especially due to the short format of
  the documents.

This is how the old css looked http://d.pr/fE08 and this is how it
looks now http://d.pr/GMI4
8e878ea
@jonoabroad jonoabroad developing using eclipse. 5e12119
@jonoabroad jonoabroad logging email rather than sending it. d3bcd5c
@d6y d6y Edited for phrasing, and added note on downloading Lift source and im…
…porting project files into Eclipse.
c7d5fd1
@d6y d6y Shortened the example code, and noted that the default in testMode is…
… to not send email.
9cd6d45
View
59 docs/0100-Install-and-Running/0300-eclipse-dev-cycle.md
@@ -0,0 +1,59 @@
+Developing using Eclipse
+========================
+
+Problem
+-------
+
+You want to develop your Lift application using the Eclipse IDE, hitting reload in your browser to see changes.
+
+Solution
+---------
+
+You will need to have the [Scala IDE for Eclipse](http://scala-ide.org/) installed. There is a link in the See also section with instructions how to accomplish this.
+
+To create the project files for Eclipse, add the following to `plugins.sbt`, which can be found in the `project` directory:
+
+```scala
+addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0")
+```
+
+You can then create Eclipse project files within SBT by entering the following:
+
+```scala
+eclipse
+```
+
+In Eclipse, navigate to File -> Import.. and select "General > Existing Projects into Workspace". Navigate to and select your Lift project. You are now set up to develop you application in Eclipse.
+
+Run SBT while you are editing to handle reloads of the web container. Start `sbt` from a terminal window outside of Eclipse and enter the following:
+
+```scala
+~; container:start; container:reload /
+```
+
+You can then edit in Eclipse, and in your web browser hit reload to see the change.
+
+Discussion
+----------
+
+You can also force the SBT `eclipse` command to download the Lift source. This will allow you to click through to the Lift source from methods and classes. To achieve this once, run `eclipse with-source=true`, but if you want this to be the default behaviour, add the following to your `build.sbt` file:
+
+```scala
+EclipseKeys.withSource := true
+```
+
+If you find yourself using the plugin frequently, you may wish to set it in your global SBT configuration files: `~/.sbt/plugins/build.sbt` for the module definition and `~/.sbt/user.sbt` for any settings.
+
+The restarting of the web container isn't always as efficient as you'd like. This can often be avoided by using JRebel, which will be the subject of a future recipe.
+
+
+See also
+--------
+
+* [ScalaIDE download](http://scala-ide.org/download/current.html)
+* [Using the sbteclipse plugin](https://github.com/typesafehub/sbteclipse/wiki/Using-sbteclipse)
+* [SBT Triggered Execution](https://github.com/harrah/xsbt/wiki/Triggered-Execution)
+* [SBT Command Line Reference](https://github.com/harrah/xsbt/wiki/Command-Line-Reference)
+* [SBT Web Plugin Commands](https://github.com/siasia/xsbt-web-plugin/wiki)
+* [JRebel](http://zeroturnaround.com/jrebel/)
+
View
12 docs/0200-Html/0410-title.md
@@ -4,21 +4,27 @@ Setting the page title
Problem
-------
-You want to set the `<title>` of the page.
+You want to set the `<title>` of the page from a Lift snippet.
Solution
--------
-Select all the elements of the `title` element:
+Select all the elements of the `title` element and replace them with the text you want:
```scala
"title *" #> "I am different"
```
+Assuming you have a `<title>` tag in your template, the above will result in:
+
+```scala
+<title>I am different</title>
+```
+
Discussion
----------
-It is also possible to set the page title from the contents of `SiteMap`:
+It is also possible to set the page title from the contents of `SiteMap, meaning the title used will be the title you've assigned to the page in the site map:
```scala
<title class="lift:Menu.title"></title>
View
41 docs/0500-Around/0130-Logging-Email.md
@@ -0,0 +1,41 @@
+Logging email rather than sending
+========================
+
+Problem
+-------
+You don't want email sent when developing your Lift application locally, but you do want to see what would have been sent.
+
+
+Solution
+--------
+
+The solution is to use `Mailer.devModeSend` and here is an example for `Boot.scala`:
+
+```scala
+import net.liftweb.util.Mailer._
+import javax.mail.internet.{MimeMessage,MimeMultipart}
+
+def stringify(m: Any) = m match {
+ case mm: MimeMultipart => mm.getBodyPart(0).getContent
+ case otherwise => otherwise.toString
+}
+
+Mailer.devModeSend.default.set( (m: MimeMessage) =>
+ logger.info("Would have sent "+stringify(m.getContent))
+)
+```
+
+This example is changing the behaviour of `Mailer` when your Lift application is in developer mode (which it is by default). We are logging a message only, and using a utility function to get the contents of the first body part of the message. The key part is setting a `MimeMessage => Unit` function on `Mailer.devModeSend`.
+
+Discussion
+----------
+
+When developing an application it is inconvenient to have to worry about setting up an SMTP server or inadvertently sending test messages to users.
+The above is a useful way to know what would have been sent.
+
+You can control how and if mail is sent using the `*ModeSend` functions available for the different Lift RunModes (dev, staging, production, profile, pilot and test). The default is to send email, except for `testModeSend`, which only logs the send.
+
+
+
+
+
View
96 docs/0900-Deployment/0050-Cloudbees.md
@@ -0,0 +1,96 @@
+Deploying to CloudBees
+=======================
+
+Problem
+-------
+
+You have an account with the CloudBees PaaS hosting environment, and you want to deploy your Lift application there.
+
+
+Solution
+--------
+
+Use the SBT `package` command to produce a WAR file that can be deployed to CloudBees, and then use the SDK to configure and deploy your application.
+
+For best performance you will want to ensure the Lift run mode is set to "production". Do this from the CloudBees SDK command line:
+
+```scala
+\$ bees config:set -a myaccount/myapp run.mode=production
+```
+
+This will set the run mode to production for your CloudBees applications identified as ""myaccount/myapp". Omitting the `-a` will set it for your whole CloudBees account.
+
+CloudBees will remember this setting, so you only need to do it once.
+
+You can then deploy:
+
+```scala
+\$ sbt package
+...
+[info] Packaging /Users/richard/myapp/target/scala-2.9.1/myapp.war...
+...
+\$ bees app:deploy ./target/scala-2.9.1/myapp.war
+```
+
+Discussion
+----------
+
+You may find it more convenient to install the SBT CloudBees plugin to deploy directly from SBT. "See Also" provides a link to this plugin and the excellent instructions for installing and configuring it.
+
+If you are deploying a single application to multiple CloudBees instances, be aware that by default CloudBees will round robin requests to each instance. If you use any of Lift's state features you'll want to enable session affinity (sticky sessions).
+
+If you are using a database in your application, you may find it useful to configure this in `src/main/webapp/WEB-INF/cloudbees-web.xml`. For example:
+
+```scala
+<?xml version="1.0"?>
+<cloudbees-web-app xmlns="http://www.cloudbees.com/xml/webapp/1">
+
+<appid>myaccount/myapp</appid>
+
+<resource name="jdbc/mydb" auth="Container" type="javax.sql.DataSource">
+ <param name="username" value="dbuser" />
+ <param name="password" value="dbpassword" />
+ <param name="url" value="jdbc:cloudbees://mydb" />
+
+ <!-- Connection Pool settings:
+ http://commons.apache.org/dbcp/configuration.html
+ -->
+ <param name="maxActive" value="10" />
+ <param name="maxIdle" value="2" />
+ <param name="maxWait" value="15000" />
+ <param name="removeAbandoned" value="true" />
+ <param name="removeAbandonedTimeout" value="300" />
+ <param name="logAbandoned" value="true" />
+
+ <!-- Avoid idle timeouts -->
+ <param name="validationQuery" value="SELECT 1" />
+ <param name="testOnBorrow" value="true" />
+
+ </resource>
+
+</cloudbees-web-app>
+```
+
+The above is a JNDI database configuration, defining a connection to a CloudBees database called "mydb". This will be used by Lift if the JNDI name is referenced in `Boot.scala`:
+
+```scala
+DefaultConnectionIdentifier.jndiName = "jdbc/mydb"
+
+if (!DB.jndiJdbcConnAvailable_?) {
+ // set up alternative local database connection here
+}
+```
+
+Because the JDNI setting is only defined in `cloudbees-web.xml` it will only be available in a CloudBees environment. This means you can develop against a different database locally, and use your CloudBees database when deploying.
+
+
+See Also
+--------
+
+* [CloudBees SDK](http://wiki.cloudbees.com/bin/view/RUN/BeesSDK)
+* [SBT Cloudbees plugin](https://github.com/timperrett/sbt-cloudbees-plugin).
+* [CloudBees Session Affinity](http://wiki.cloudbees.com/bin/view/RUN/Session+Affinity)
+* As an alternative to `bees:config`, you can [set run.mode via a filter](https://github.com/d6y/cloudbees-lift-filter)
+
+
+
View
26 docs/cookbook.css
@@ -8,6 +8,16 @@ code {
font-size: small;
}
+h2 {
+ font-size: 1.5em;
+ margin-bottom: 0.2em;
+}
+
+p {
+ text-align: justify;
+ width: auto;
+}
+
pre {
padding: 0.25em;
border: 1pt solid silver;
@@ -29,4 +39,20 @@ ol.toc li ol.toc {
p + ul {
margin-top: -1.5em;
/*margin-bottom: 0;*/
+}
+
+@media screen and (min-width: 1200px) {
+
+ .container {
+ width: 1000px;
+ }
+
+ .prepend-1, .span-16, .append-1 {
+ width: 920px; /* 1000 - 40 - 40*/
+ }
+
+ p {
+ width: auto;
+ }
+
}
View
13 template.md
@@ -4,12 +4,25 @@ Title
Problem
-------
+You want to…..
+
+
Solution
--------
+Use …
+
+```scala
+val example_goes_here = true
+```
+
+
Discussion
----------
+Further details on the example, description of related concepts or similar issues.
+
+
See Also
--------

No commit comments for this range

Something went wrong with that request. Please try again.