Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated all scaffold related views so it uses I18n.

  • Loading branch information...
commit 525f19116d763b1de16b2a4b84f5b5c9beac3132 1 parent 911c229
Thorbjørn Hermansen thhermansen authored committed
11 README.markdown
View
@@ -1,10 +1,15 @@
-# Rails 3 HAML Scaffold Generator
+# Information about this fork
+
+This for is no longer following the normal scaffolding layout of Rails.
+It uses I18n backend for headings, model attributes names etc in it's views.
+
+## Rails 3 HAML Scaffold Generator
Essentially just a copy of the Rails 3 ERB generator with HAML replacements for the templates.
Original idea from [Paul Barry's article on custom genrators][OriginalIdea]
-## Installation
+### Installation
1. Generate your new rails application:
@@ -55,4 +60,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
8 scaffold/templates/edit.html.haml
View
@@ -1,5 +1,5 @@
-%h1 Editing <%= singular_name %>
-
+%h1= t '.title'
+%p
+ = link_to t('back'), <%= plural_name %>_path
+ = link_to t('show'), @<%= singular_name %>
= render 'form'
-
-== #{ link_to 'Show', @<%= singular_name %> } | #{ link_to 'Back', <%= plural_name %>_path }
14 scaffold/templates/index.html.haml
View
@@ -1,10 +1,11 @@
-%h1 Listing <%= plural_name %>
+%h1= t('.title')
+%p= link_to t('.new_<%= singular_name %>'), new_<%= singular_name %>_path
%table
%thead
%tr
<% for attribute in attributes -%>
- %th <%= attribute.human_name %>
+ %th= <%= class_name %>.human_attribute_name :<%= attribute %>
<% end -%>
%th{ :colspan => 3 }
@@ -14,9 +15,6 @@
<% for attribute in attributes -%>
%td= <%= 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
-
-%br
-= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path
+ %td.action= link_to t('show'), <%= singular_name %>
+ %td.action= link_to t('edit'), edit_<%= singular_name %>_path(<%= singular_name %>)
+ %td.action= link_to t('destroy'), <%= singular_name %>, :confirm => t('are_you_sure'), :method => :delete
6 scaffold/templates/new.html.haml
View
@@ -1,5 +1,3 @@
-%h1 New <%= singular_name %>
-
+%h1= t '.title'
+%p= link_to t('back'), <%= plural_name %>_path
= render 'form'
-
-= link_to 'Back', <%= plural_name %>_path
13 scaffold/templates/show.html.haml
View
@@ -1,7 +1,10 @@
-<% for attribute in attributes -%>
+%h1= t '.title'
%p
- %strong <%= attribute.human_name %>:
- = @<%= singular_name %>.<%= attribute.name %>
-<% end -%>
+ = link_to t('back'), <%= plural_name %>_path
+ = link_to t('edit'), edit_<%= singular_name %>_path(@<%= singular_name %>)
-== #{ link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>) } | #{ link_to 'Back', <%= plural_name %>_path }
+%dl
+<% for attribute in attributes -%>
+ %dt= <%= class_name %>.human_attribute_name :<%= attribute %>
+ %dd= @<%= singular_name %>.<%= attribute.name %>
+<% end -%>
Please sign in to comment.
Something went wrong with that request. Please try again.