app/helpers/locomotive/base_helper.rb in locomotive_cms-2.0.3 vs app/helpers/locomotive/base_helper.rb in locomotive_cms-2.1.0
- old
+ new
@@ -24,11 +24,11 @@
#
# @return [ String ] The HTML <a> tag
#
def link_to_icon(name, *args, &block)
name = name.is_a?(Symbol) ? "icon-#{name.to_s.dasherize}" : name
- icon = content_tag(:i, '', :class => name)
+ icon = content_tag(:i, '', class: name)
link_to(icon, *args, &block).html_safe
end
# Execute the code only once during the request time. It avoids duplicated
# dom elements in the rendered rails page.
@@ -43,51 +43,51 @@
instance_variable_set(symbol, true)
end
end
def submenu_entry(name, url, options = {}, &block)
- default_options = { :i18n => true, :css => name.dasherize.downcase }
+ default_options = { i18n: true, css: name.dasherize.downcase }
default_options.merge!(options)
css = "#{'on' if name == sections(:sub)} #{options[:css]}"
label_link = default_options[:i18n] ? t("locomotive.shared.menu.#{name}") : name
if block_given?
- popup = content_tag(:div, capture(&block), :class => 'popup', :style => 'display: none')
- text = content_tag(:span, preserve(label_link) + content_tag(:i, '', :class => 'icon-caret-down'))
- link = link_to(text + content_tag(:em), url, :class => css)
- content_tag(:li, link + popup, :class => 'hoverable')
+ popup = content_tag(:div, capture(&block), class: 'popup', style: 'display: none')
+ text = content_tag(:span, preserve(label_link) + content_tag(:i, '', class: 'icon-caret-down'))
+ link = link_to(text + content_tag(:em), url, class: css)
+ content_tag(:li, link + popup, class: 'hoverable')
else
- content_tag(:li, link_to(content_tag(:span, label_link), url, :class => css))
+ content_tag(:li, link_to(content_tag(:span, label_link), url, class: css))
end
end
def local_action_button(text, url, options = {})
text = text.is_a?(Symbol) ? t(".#{text}") : text
icon = options.delete(:icon) || :exclamation_sign
icon = icon.is_a?(Symbol) ? "icon-#{icon.to_s.dasherize}" : icon
link_to(url, options) do
- content_tag(:i, '', :class => icon) + text
+ content_tag(:i, '', class: icon) + text
end
end
def locale_picker_link
if current_site.locales.size > 1 && localized?
- content_tag :div, render('locomotive/shared/locale_picker_link'), :class => 'action'
+ content_tag :div, render('locomotive/shared/locale_picker_link'), class: 'action'
else
nil
end
end
def flash_message
if not flash.empty?
first_key = flash.keys.first
content_tag :div, flash[first_key],
- :id => "flash-#{first_key}",
- :class => 'application-message'
+ id: "flash-#{first_key}",
+ class: 'application-message'
else
''
end
end
@@ -134,15 +134,15 @@
# @param [ String ] size The width x height (by default, 24x24)
#
# @return [ String ] The HTML image tag with the path to the matching flag.
#
def flag_tag(locale, size = '24x24')
- image_tag("locomotive/icons/flags/#{locale}.png", :class => 'flag', :size => size)
+ image_tag("locomotive/icons/flags/#{locale}.png", class: 'flag', size: size)
end
def nocoffee_tag
- link_to 'noCoffee', 'http://www.nocoffee.fr', :id => 'nocoffee'
+ link_to 'noCoffee', 'http://www.nocoffee.fr', id: 'nocoffee'
end
# sites
def application_domain
@@ -163,17 +163,9 @@
Locomotive.config.manage_domains?
end
def multi_sites?
Locomotive.config.multi_sites?
- end
-
- def public_page_url(page, options = {})
- if content = options.delete(:content)
- File.join(current_site_public_url, page.fullpath.gsub('content_type_template', ''), content._slug)
- else
- File.join(current_site_public_url, page.fullpath)
- end
end
# memberships
def options_for_membership_roles(options = {})
\ No newline at end of file