Module: Admin::BaseHelper
- Defined in:
- app/helpers/admin/base_helper.rb
Instance Method Summary collapse
Instance Method Details
#clean(url) ⇒ Object
12 13 14 15 |
# File 'app/helpers/admin/base_helper.rb', line 12 def clean(url) uri = URI.parse(url) uri.path.gsub(%r{/+}, '/').gsub(%r{/$}, '') end |
#current_url?(options) ⇒ Boolean
2 3 4 5 6 7 8 9 10 |
# File 'app/helpers/admin/base_helper.rb', line 2 def current_url?() url = case when Hash url_for else .to_s end request.request_uri =~ Regexp.new('^' + Regexp.quote(clean(url))) end |
#nav_link_to(name, options) ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/helpers/admin/base_helper.rb', line 17 def nav_link_to(name, ) if current_url?() %{<strong>#{ link_to name, }</strong>} else link_to name, end end |