Skip to content

Commit

Permalink
Use new ERB block syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosantoniodasilva committed Jul 6, 2010
1 parent 2574e78 commit 65e4777
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ShowFor allows you to quickly show a model information with I18n features.

<% show_for @user do |u| %>
<%= show_for @user do |u| %>
<%= u.attribute :name %>
<%= u.attribute :nickname, :in => :profile %>
<%= u.attribute :confirmed? %>
Expand Down Expand Up @@ -37,7 +37,7 @@ if you want to use it with Rails 2.3 you should check this branch:

ShowFor allows you to quickly show a model information with I18n features.

<% show_for @admin do |a| %>
<%= show_for @admin do |a| %>
<%= a.attribute :name %>
<%= a.attribute :confirmed? %>
<%= a.attribute :created_at, :format => :short %>
Expand Down Expand Up @@ -102,11 +102,11 @@ human_attribute_name lookup and the default wrapping:

a.label :name #=> <strong class="label">Name</strong>
a.label "Name", :id => "my_name" #=> <strong class="label" id="my_name">Name</strong>

Optionally, if you want to wrap the inner part of the label with some text
(e.g. adding a semicolon), you can do so by specifying a proc for ShowFor.label_proc
that will be called with any label text. E.g.:

ShowFor.label_proc = lambda { |l| l + ":" }

When taking this route, you can also skip on a per label basis by passing the
Expand All @@ -116,7 +116,7 @@ When taking this route, you can also skip on a per label basis by passing the

show_for also supports associations.

<% show_for @artwork do |a| %>
<%= show_for @artwork do |a| %>
<%= a.association :artist %>
<%= a.association :artist, :using => :name_with_title %>
<%= a.attribute :name_with_title, :in => :artist %>
Expand Down
4 changes: 2 additions & 2 deletions lib/generators/show_for_install/templates/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%% show_for @<%= singular_name %> do |o| %>
<%%= show_for @<%= singular_name %> do |s| %>
<% attributes.each do |attribute| -%>
<%%= o.<%= attribute.reference? ? :association : :attribute %> :<%= attribute.name %> %>
<%%= s.<%= attribute.reference? ? :association : :attribute %> :<%= attribute.name %> %>
<% end -%>
<%% end %>

Expand Down

0 comments on commit 65e4777

Please sign in to comment.