If anyone is interested. Here is the my templates/haml/scaffold/
index.html.haml file
Note: I used tabs instead of double space indenting.
------------
%h1 <%= plural_table_name.capitalize %>

%table
        %tr
        <% for attribute in attributes -%>
        %th <%= attribute.human_name %>
        <% end -%>

                %th
                %th
                %th

        - @<%= plural_table_name %>.each do |<%= singular_table_name %>|
                %tr
        <% for attribute in attributes -%>
                %td= <%= singular_table_name %>.<%= attribute.name %>
        <% end -%>

                        %td= link_to 'Show', <%= singular_table_name %>
                        %td= link_to 'Edit', edit_<%= singular_table_name 
%>_path(<%=
singular_table_name %>)
                        %td= link_to 'Destroy', <%= singular_table_name %>, 
:confirm =>
'Are you sure?', :method => :delete

%br
= link_to 'New <%= human_name %>', new_<%= singular_table_name %>_path
--------

It took some tinkering to get the %th and %td indents to line up
correctly in the output file.

Hope this helps anyone else trying to create their own rails3
templates.

Doug K.

On Nov 4, 9:59 am, dkuyven <d...@vencor.ca> wrote:
> That link didn't exist, but I did find a few other
> haml_scaffold_generators in github. Tinkering around with them I found
> the haml syntax that I needed. The following syntax worked for my /lib/
> templates/haml/scaffold/new.html.haml file
>
> ---------
> %h1 New <%= singular_table_name.capitalize %>
> = render 'form'
> = link_to 'Back', <%= index_helper %>_path
> ---------
>
> Thanks for the help.
>
> On Nov 4, 4:30 am, koulikoff <koulik...@gmail.com> wrote:
>
>
>
> >https://github.com/dima4p/rails3_haml_scaffold_generator.git
>
> > On Nov 4, 5:35 am, dkuyven <d...@vencor.ca> wrote:
>
> > > I wish to create a template file which "rails g scaffold.." will use
> > > to create the view files.
>
> > > I created a file in /lib/templates/haml/scaffold/new.html.haml and the
> > > template file is being used, but I'm having trouble figuring out haml
> > > syntax for the template file.
>
> > > Here is the erb template file which I need to convert to a haml
> > > template file:
> > > ------------
> > > <h1>New <%= singular_table_name %></h1>
>
> > > <%%= render 'form' %>
>
> > > <%%= link_to 'Back', <%= index_helper %>_path %>
> > > ------------
>
> > > Can anyone help me with the syntax I need to use to get haml to insert
> > > the actual "singular_table_name"  and the "index_helper" into the
> > > generated file?

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to h...@googlegroups.com.
To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to