Skip to content

Commit

Permalink
added README
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Helme authored and Damian Helme committed Feb 8, 2012
1 parent 08a0dd1 commit 48ce102
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
15 changes: 15 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Copyright (c) 2012, Damian Helme
All rights reserved.

Redistribution is permitted without restriction.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
This is a utility to create Twitter Bootstrap styled nav bar with drop down menus from the output of Lift's Menu.builder.

You can see a running example of the code here <TBC>

To use the utility in your own project:

1. download and build the library:

git clone ....

./sbt publish-local

2. In the project in which you want to use the library, add the following to the dependencies in the project's build.sbt:

"com.damianhelme" %% "tbutils" % "0.1.0" % "compile"

3. In Boot.scala, define your menu sitemap with something like:

val entries = List(Menu("Home") / "index",
Menu("Page 1") / "page1",
Menu("Page 2") / "page2",
Menu("Page 3") / "#" >> PlaceHolder submenus (
Menu("Page 3a") / "page3a" ,
Menu("Page 3b") / "page3b" ,
Menu("Page 3c") / "page3c"))

def sitemap = SiteMap(entries: _*)
LiftRules.setSiteMap(sitemap)

Every menu entry with a submenu will the rendered as a menu drop-down. The 'PlaceHolder' is optional, but it's clearer to
other developers to include it.

4) Download the Twitter Bootstrap libraries from http://twitter.github.com/bootstrap/assets/bootstrap.zip and copy into
a subdirectory of /src/main/webapp (e.g. /src/main/webapp/bootstrap/2.0.0)

5) Link to the Bootstrap files in your html:
<link rel="stylesheet" type="text/css" href="/bootstrap/2.0.0/bootstrap.css">
<script id="bootstrap-dropdown" src="/bootstrap/2.0.0/js/bootstrap-dropdown.js" type="text/javascript"></script>


4) In your html, wrap your call to Menu.builder with:
<div class="topbar">
<div class="fill">
<div class="container">
<a class="brand" href="/">My App</a>
<span class="lift:TBNav.menuToTBNav?eager_eval=true">
<span data-lift="lift:Menu.builder?top:class=nav;li_item:class=active;linkToSelf=true;expandAll=true"></span>
</span>
</div>
</div>
</div>




0 comments on commit 48ce102

Please sign in to comment.