Module ApplicationHelper
In: app/helpers/application_helper.rb

Methods added to this helper will be available to all templates in the application.

Methods

Included Modules

TagsHelper WhiteListHelper

Public Instance methods

[Source]

    # File app/helpers/application_helper.rb, line 63
63:   def enet_contact_form_lang_code(lang)
64:     Document::LANGUAGES.index(lang) + 1
65:   end

Example: <% for_every_locale do |code, lang| %>

  <%= content_tag(:li, link_to("Nuevo documento en #{lang}", self.send("new_admin_document_path", {:lang => code}))) %>

<% end %>

[Source]

    # File app/helpers/application_helper.rb, line 21
21:   def for_every_locale(*args, &block)
22:     locales.each_pair do |code, lang|
23:       yield(*args + [code, lang])
24:     end    
25:   end

[Source]

    # File app/helpers/application_helper.rb, line 54
54:   def header_links
55:     {"es" => {:accesibilidad => "http://www.euskadi.net/r33-2288/es/contenidos/informacion/cabecera_accesibilidad/es_6144/politica_accesibilidad.html",
56:               :gestiones => "https://www6.euskadi.net/s06-9512x/eu/r02nConsultationSistemWar/consultation/r02nExpedientList.do"},
57:      "eu" => {:accesibilidad => "http://www.euskadi.net/r33-2288/eu/contenidos/informacion/cabecera_accesibilidad/eu_6144/erabilerraztasuna.html",
58:               :gestiones => "https://www6.euskadi.net/s06-9512x/es/r02nConsultationSistemWar/consultation/r02nExpedientList.do"},
59:      "en" => {:accesibilidad => "http://www.basques.euskadi.net/t32-2286/en/contenidos/informacion/cabecera_accesibilidad/", 
60:              :gestiones => "http://www.basques.euskadi.net/t32-2286/en/contenidos/informacion/cabecera_identificarse/"}}    
61:   end

Request from an iPhone or iPod touch? (Mobile Safari user agent)

[Source]

    # File app/helpers/application_helper.rb, line 41
41:   def iphone_user_agent?
42:     request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(Mobile\/.+Safari)/]
43:   end

Example: <%= link_to_in_every_locale "Nuevo documento", "new_admin_document_path", :content_tag => :li %>

[Source]

    # File app/helpers/application_helper.rb, line 8
 8:   def link_to_in_every_locale(text, link, options = {})
 9:     options.reverse_merge(:content_tag => :li)
10:     output = ""
11:     locales.each_pair do |code, lang|
12:       output << content_tag(options[:content_tag], link_to("#{text} en #{lang}", self.send(link, {:lang => code})))
13:     end
14:     return output
15:   end

[Source]

    # File app/helpers/application_helper.rb, line 28
28:   def menu_link_class(tab)
29:     @current_tab.eql?(tab) ? "active" : "passive"
30:   end

[Source]

    # File app/helpers/application_helper.rb, line 50
50:   def multimedia_content_dir_format
51:     'Sólo letras sin tildes, números y "_". "/" para indicar directorios.'
52:   end

Returns true if a fetured video o streming is defined.

[Source]

    # File app/helpers/application_helper.rb, line 46
46:   def video_or_streaming?
47:     @featured_video.present? || @streaming.present?
48:   end

[Validate]