Skip to content

Commit

Permalink
Fixes for I18n in view files.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepycat committed Feb 25, 2011
1 parent 89439d1 commit c53ef5e
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
12 changes: 10 additions & 2 deletions README.markdown
@@ -1,6 +1,10 @@
# Rails 3 HAML Scaffold Generator

Essentially just a copy of the Rails 3 ERB generator with HAML replacements for the templates.
Essentially just a copy of the Rails 3 ERB generator with HAML replacements for the templates.

#This fork
This fork aims to clean up the Internationalization and other annoyances in that vein.


Original idea from [Paul Barry's article on custom genrators][OriginalIdea]

Expand Down Expand Up @@ -33,10 +37,14 @@ Original idea from [Paul Barry's article on custom genrators][OriginalIdea]

6. Either

git clone git://github.com/sleepycat/haml-rails.git lib/generators/haml
(or grab the original)
git clone git://github.com/psynix/rails3_haml_scaffold_generator.git lib/generators/haml

...or...

git submodule add git://github.com/sleepycat/haml-rails.git lib/generators/haml
(or grab the original)
git submodule add git://github.com/psynix/rails3_haml_scaffold_generator.git lib/generators/haml

7. Create stuff with:
Expand All @@ -55,4 +63,4 @@ Original idea from [Paul Barry's article on custom genrators][OriginalIdea]

* Gemify (?)

[OriginalIdea]: http://paulbarry.com/articles/2010/01/13/customizing-generators-in-rails-3
[OriginalIdea]: http://paulbarry.com/articles/2010/01/13/customizing-generators-in-rails-3
2 changes: 1 addition & 1 deletion scaffold/templates/_form.html.haml
Expand Up @@ -9,4 +9,4 @@
<% end -%>

.actions
= f.submit
= f.submit t('submit')
4 changes: 2 additions & 2 deletions scaffold/templates/edit.html.haml
@@ -1,5 +1,5 @@
%h1 Editing <%= singular_name %>
%h1 t('<%= singular_name %>.edit.title')

= render 'form'

== #{ link_to 'Show', @<%= singular_name %> } | #{ link_to 'Back', <%= plural_name %>_path }
== #{ link_to t('show'), @<%= singular_name %> } | #{ link_to t('back'), <%= plural_name %>_path }
15 changes: 8 additions & 7 deletions scaffold/templates/index.html.haml
@@ -1,22 +1,23 @@
%h1 Listing <%= plural_name %>
%h1 t('<%= plural_name %>.index.title')

%table
%thead
%tr
<% for attribute in attributes -%>
%th <%= attribute.human_name %>
%th
=t('activerecord.attributes.<%= singular_name %>.<%= attribute.name %>')
<% end -%>
%th{ :colspan => 3 }

%tbody
- for <%= singular_name %> in @<%= plural_name %>
%tr{ :class => cycle(:odd, :even) }
<% for attribute in attributes -%>
%td= <%= singular_name %>.<%= attribute.name %>
%td= t('activerecord.attributes.<%= singular_name %>.<%= attribute.name %>')
<% end -%>
%td= link_to 'Show', <%= singular_name %>
%td= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>)
%td= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete
%td= link_to t('show'), <%= singular_name %>
%td= link_to t('edit'), edit_<%= singular_name %>_path(<%= singular_name %>)
%td= link_to t('destroy'), <%= singular_name %>, :confirm => I18n.t('confirm_delete'), :method => :delete

%br
= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path
= link_to t('<%= singular_name %>.new'), new_<%= singular_name %>_path
4 changes: 2 additions & 2 deletions scaffold/templates/new.html.haml
@@ -1,5 +1,5 @@
%h1 New <%= singular_name %>
%h1 t('<%= singular_name %>.new')

= render 'form'

= link_to 'Back', <%= plural_name %>_path
= link_to t('back'), <%= plural_name %>_path
4 changes: 2 additions & 2 deletions scaffold/templates/show.html.haml
@@ -1,7 +1,7 @@
<% for attribute in attributes -%>
%p
%strong <%= attribute.human_name %>:
%strong t('activerecord.attributes.<%= singular_name %>.<%= attribute.name %>')
= @<%= singular_name %>.<%= attribute.name %>
<% end -%>

== #{ link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>) } | #{ link_to 'Back', <%= plural_name %>_path }
== #{ link_to t('edit'), edit_<%= singular_name %>_path(@<%= singular_name %>) } | #{ link_to t('back'), <%= plural_name %>_path }

0 comments on commit c53ef5e

Please sign in to comment.