Happy new year!
Yes, you’ve heard right. It’s been that long since i’ve blogged! Anyway, i didn’t spend my time scratching my balls, i used it wisely - yes imagine that for a change. ;)
So what’s the 411 you might ask..
Lift-Bootstrap and Lift-BHtml
What it is? BHtml is a nice wrapper for MappedField and SHtml. It also does Mapper’s validation and produces nice Popovers with Twitter’s amazing Bootstrap Kit.
So what was i unhappy about Liftweb’s Helpers and things? Short answer: Nothing! It has been perfect all the way. It’s flexible, robust and not nearly as much code as you’d expect. So why did it need wrapping?
This is still too much code, also it has 0 validation in the form of feedback. Now since i am one lazy ass guy, i’ve written myself these BHtml wrappers to make it even more comfortable.
And yes, i am not that lazy, so i wrote a few ways to use it:
This will make the onBlur set the field in the Object, it will not auto-save the record if this field changes (so you can make a separate save-button), and it will display validation-errors on Blur as well as on Submit using a Twitter BootstrapJS Popover (3rd example on the Page).
Now don’t be amazed, that wasn’t even half of it! But i won’t dig any deeper into BHtml, since it is Open Source and for everyone to explore at my Github Repo named Lift-BHtml.
I even spent my Sunday morning writing a ScalaDoc API, so at least be sure to check it out before dismissing it. ;)
So i hear you’ve got another big thing going? Yes, you’ve heard (or read) right. It is something called Lift-Bootstrap and it provides a basic project with User- and Customer-Models as well as basic Twitter Bootstrap integration for validation. Yes, it sounds heavy and much, but it really is not. Once you get the hang of it, it’s all easy peasy ;)
The basic idea behind this was, that i sometimes want to draw up a rough project over night, not having to worry about Lift’s very unique and basic default layout, and having some guideline on how to style my forms and objects. Getting this basic rough draft is often driving me nuts, since i often just want to copy most of the view-code (HTML) and change a few bits on the form and be done with it. So Twitter Bootstrap gives me a good approach on how to clearly handly those things - but that’s just me.
Yes, i know you’re eager to check it out, so i won’t be holding you back any longer. I proudly present, the Lift-Bootstrap Demo.
Simply Sign Up, there is no Listing of Users, just hypothetical Customers, and check out the Validation- and Notification-Feature.
It is not meant to be perfect! It was designed to get you up and running fast.
So where is the source-code? Right here on my Lift-Bootstrap Github Repo.
A few last thoughts:
- the Sign Up page is being processed by ProtoUser, i didn’t debug into validation there, since i usually add my Users by hand for most things.
- to disable User-Registration, simply uncomment the line in User.scala
That’s it for tonight
I will be improving this, since this is going to be my base for future projects.
Thanks again to David Pollak and the whole Liftweb Community!