module ActionView::Helpers::TextHelper
def concat(string)
<% end %>
<%= link_to "Sign In", action: :sign_in %>
<% unless signed_in? %>
is equivalent to
%>
end
concat link_to("Sign In", action: :sign_in)
unless signed_in?
<%
<% concat "hello" %> is equivalent to <%= "hello" %>
can use the +concat+ method.
output text within a non-output code block (i.e., <% %>), you
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 %>
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 %>
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 cut_excerpt_part(part_position, part, separator, options)
def cut_excerpt_part(part_position, part, separator, options) return "", "" unless part radius = options.fetch(:radius, 100) omission = options.fetch(:omission, "...") if separator != "" part = part.split(separator) part.delete("") end affix = part.length > radius ? omission : "" part = if part_position == :first part.last(radius) else part.first(radius) end if separator != "" part = part.join(separator) end return affix, part end
def cycle(first_value, *values)
<% reset_cycle("colors") %>
<% end %>
<%= value %>
">
<%# 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" },
{ first: "Robert", middle: "Daniel", last: "James" },
<% @items = [
<%# Cycle CSS classes for rows, and text colors for values within each row %>
<% end %>
<% @items.each do |item| %>
<% end %>
<% reset_cycle("colors") %>
<% end %>
<%= value %>
">
<% item.each do |value| %>
<% @items.each do |item| %>