module ActionView::Helpers::TextHelper
def concat(string)
# will either display "Logged in!" or a login link
end
concat link_to('login', :action => login)
else
concat "Logged in!"
if logged_in
# is the equivalent of <%= "hello" %>
concat "hello"
<%
==== Examples
output text within a non-output code block (i.e., <% %>), you can use the concat method.
do not operate as expected in an eRuby code block. If you absolutely must
<%= "text" %> eRuby syntax. The regular _puts_ and _print_ methods
The preferred method of outputting text in your views is to use the
def concat(string) output_buffer << string end
def current_cycle(name = "default")
<%= item %>
">
<% @items.each do |item| %>
@items = [1,2,3,4]
# Alternate background colors
==== Example
the current cycle string in more than one place.
for complex table highlighting or any other design need which requires
Returns the current cycle string after a cycle has been started. Useful
<% @items.each do |item| %>
@items = [1,2,3,4]
# Alternate background colors
==== Example
the current cycle string in more than one place.
for complex table highlighting or any other design need which requires
Returns the current cycle string after a cycle has been started. Useful
def current_cycle(name = "default") cycle = get_cycle(name) cycle.current_value if cycle end
def cycle(first_value, *values)
<% reset_cycle("colors") %>
<% end %>
<%= value %>
"colors") -%>">
<%# Create a named cycle "colors" %>
<% item.values.each do |value| %>
<% @items.each do |item| %>
{:first => 'June', :middle => 'Dae', :last => 'Jones'}]
{:first => 'Emily', :middle => 'Shannon', :maiden => 'Pike', :last => 'Hicks'},
@items = x = [{:first => 'Robert', :middle => 'Daniel', :last => 'James'},
# Cycle CSS classes for rows, and text colors for values within each row
<% end %>
<% @items.each do |item| %>
<% end %>
<% reset_cycle("colors") %>
<% end %>
<%= value %>
"colors") -%>">
<% item.each do |value| %>
<% @items.each do |item| %>