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"
<%
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
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'},
@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 %>
">
<% item.each do |value| %>
<% @items.each do |item| %>