[ANN] HAML 0.2: The Bomb

1 view
Skip to first unread message

hca...@gmail.com

unread,
Oct 18, 2006, 9:16:24 AM10/18/06
to Ruby on Rails: Talk
---FIRST---

I want to thank everyone for the tremendous response to HAML. I'm
absolutely amazed at the sheer number of sites that have switched over
to HAML. I am honestly shocked at the emails I get. This started as a
passion of mine and has grown into the passion of others. Special
thanks for this release goes to Nathan Wiesenbaum who gives new meaning
to prolific.

---THE DEAL---

After nearly a 90% code-base rewrite, we find our selves with a
new-and-improved HAML... codenamed The Bomb. And its features are ready
to *drop*!

We have many, many new features available including...

- Multi-class Handling
- Multi-single-lines with the - character.
- Blocks via Silent Scripting
- Proper Error Reporting

Read all about the new features at:

http://hamptoncatlin.com/2006/haml-0-2-the-bomb

Or, just update your code off the haml trunk:

svn://hamptoncatlin.com/haml/trunk

The README file is far more complete now and is almost a tutorial. So,
give that a read-through to find new features.

-hampton.

Larry Kelly

unread,
Oct 18, 2006, 12:15:51 PM10/18/06
to rubyonra...@googlegroups.com
Exciting! I read the tantalizing apetizers on your blog and trac
site. Can't wait for the main course to be served. Will the trac
tutorial be expanded soon?

How does HAML handle if-else-then constructs? I use them to
selectively show menu options, for example.

<% if current_user.has_permission?('admin') %>
<%= link_to "admin menu", :controller => "admin", :action => "menu" %>
<% else %>
<%= link_to "normal menu", :controller => "welcome", :action => "menu" %>
<% end %>
-Larry


--
Best Regards,
-Larry
"Work, work, work...there is no satisfactory alternative."
--- E.Taft Benson

hca...@gmail.com

unread,
Oct 18, 2006, 4:11:50 PM10/18/06
to Ruby on Rails: Talk
Ok, thanks (or blames to) silent-scripting, you can convert this to...


- if current_user.has_permission?('admin')


= link_to "admin menu", :controller => "admin", :action => "menu"

- else


= link_to "normal menu", :controller => "welcome", :action => "menu"

But, my personal style-preference is doing this with menus.

File: _admin.haml
.admin.menu


= link_to "admin menu", :controller => "admin", :action => "menu"

File: _guest.haml
.guest.menu


= link_to "normal menu", :controller => "welcome", :action => "menu"

Then, do....

= render :partial => (current_user.has_permission?('admin') ? 'admin' :
'guest')

Keeps it a little more D.R.Y. ... and obviously you usually have more
than a link-difference in a menu.

Though, that's a personal style-choice.

-hampton.
Then, back in your o

On Oct 18, 12:15 pm, "Larry Kelly" <ldk2...@gmail.com> wrote:
> Exciting! I read the tantalizing apetizers on your blog and trac
> site. Can't wait for the main course to be served. Will the trac
> tutorial be expanded soon?
>
> How does HAML handle if-else-then constructs? I use them to
> selectively show menu options, for example.
>
> <% if current_user.has_permission?('admin') %>
> <%= link_to "admin menu", :controller => "admin", :action => "menu" %>
> <% else %>
> <%= link_to "normal menu", :controller => "welcome", :action => "menu" %>
> <% end %>
> -Larry
>

Larry Kelly

unread,
Oct 27, 2006, 12:49:00 PM10/27/06
to rubyonra...@googlegroups.com
Thanks for the reply. And add a little bit more to my understanding,
how would a dropselect tag be written in HAML? Assuming:
lookup model = Service ( with id, and name)
Current model = Company[service_id]

Also, what is the best way to contact you about HAML, is there a
mailing list, or is posting to the RubyRails list the best place?

Thanks for your help.
-Larry

On 10/18/06, hca...@gmail.com <hca...@gmail.com> wrote:
>


--

hca...@gmail.com

unread,
Oct 28, 2006, 3:03:49 PM10/28/06
to Ruby on Rails: Talk
Actually, we recently created a google-group called "haml"... so that's
the best place.

What kind of select tag do you mean? There are rails helpers for the
basic kinds, unless you have some specific need.

-hampton.

Larry Kelly

unread,
Oct 28, 2006, 3:16:18 PM10/28/06
to rubyonra...@googlegroups.com
Nothing special. This is what I had in mind.
<table>
<tr>
<td><%= label_for 'model', 'attribute' %></td>
<td><%= select 'model', 'attribute', @droplist %></td>
<tr>
</table>

Is there a tutorial, and/or a reference for the HAML DSL someplace. I
didn't see anything an the plugin.
-Larry

Hampton

unread,
Oct 29, 2006, 7:42:46 AM10/29/06
to rubyonra...@googlegroups.com
There is a file in the Haml trunk called "REFERENCE". Its also one of
the documents on the Haml google-group.

%table
%tr
%td= label_for :model, :attribute
%td= select :model, :attribute, @droplist


That'd be the Haml for that.

-hampton.

Larry Kelly

unread,
Oct 30, 2006, 1:29:35 PM10/30/06
to rubyonra...@googlegroups.com
Thanks for the sample and the reference. My somewhat jaded mind is
having a hard time accepting that HAML might just possibly be as easy
as it looks. These code samples help a lot.
-Larry
Reply all
Reply to author
Forward
0 new messages