Module: ApplicationHelper
- Includes:
- Localization
- Defined in:
- app/helpers/application_helper.rb
Constant Summary
Localization::LOCALIZED_STRINGS
Instance Method Summary
collapse
#l, load_localized_strings, #valid_language?
Instance Method Details
#back_or_link_to(title, options) ⇒ Object
24
25
26
27
28
29
30
|
# File 'app/helpers/application_helper.rb', line 24
def back_or_link_to(title, options)
if session[:detours]
options = {:return_from_detour => true}.update(session[:detours].last)
puts "linked return from detour: #{options}"
end
link_to title, options
end
|
#detour_to(title, options, html_options = nil) ⇒ Object
14
15
16
|
# File 'app/helpers/application_helper.rb', line 14
def detour_to(title, options, html_options = nil)
link_to title, options.update({:detour => params.reject {|k, v| [:detour, :return_from_detour].include? k.to_sym}}), html_options
end
|
#h(object) ⇒ Object
36
37
38
39
40
41
42
|
# File 'app/helpers/application_helper.rb', line 36
def h(object)
if object.is_a? Time
object.strftime '%Y-%m-%d %H:%M:%S'
else
super object
end
end
|
7
8
9
10
11
12
|
# File 'app/helpers/application_helper.rb', line 7
def image_button_to(image_source, title, options)
html = ''
html += image_submit_tag image_source, :class => 'image-submit', :alt => title, :title => title,
:id => "#{title}_#{options[:id]}", :name => title,
:onclick => "form.action='#{url_for(options)}'"
end
|
#image_detour_to(image_source, title, url_options, image_options = nil, post = false) ⇒ Object
18
19
20
21
22
|
# File 'app/helpers/application_helper.rb', line 18
def image_detour_to(image_source, title, url_options, image_options = nil, post = false)
image_options ||= {:class => 'image-submit'}
image_options.update :alt => title, :title => title
detour_to image_tag(image_source, image_options), url_options, :method => post ? :post : :get
end
|
#t(time_as_float) ⇒ Object
32
33
34
|
# File 'app/helpers/application_helper.rb', line 32
def t(time_as_float)
"#{time_as_float.to_i}:#{'%02d' % (time_as_float.frac * 60).to_i}"
end
|