Module: Backable::ViewHelpers

Defined in:
lib/backable/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#backable_form_itemObject



4
5
6
# File 'lib/backable/view_helpers.rb', line 4

def backable_form_item
  hidden_field_tag :back, backable_param
end


9
10
11
12
13
14
15
# File 'lib/backable/view_helpers.rb', line 9

def backable_link_to(name = nil, options = nil, html_options = nil, &block)
  if block_given?
    link_to backable_url_for(name), options, &block
  else
    link_to name, backable_url_for(options), html_options
  end
end


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/backable/view_helpers.rb', line 18

def backable_link_to_back( name = nil, html_options = nil, &block) 
  if block_given?
    arg1 = backable_back_path
    arg2 = name
  else       
    if name.kind_of?(Hash) && !html_options
      arg1 = t('backable.back') 
      arg2 = backable_back_path
      arg3 = name
    else
      arg1 = name
      arg2 = backable_back_path
      arg3 = html_options
    end
  end
  link_to arg1, arg2, arg3, &block
end