Module: Geri::AdminHelper

Defined in:
app/helpers/geri/admin_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_path?(path) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'app/helpers/geri/admin_helper.rb', line 4

def current_path?(path)
  url_for(overwrite_params: nil) == path
end


8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/geri/admin_helper.rb', line 8

def sidebar_link(name, path, icon=nil)
  html_options= {}
  html_options[:class] = 'active' if current_path?(path)
  (:li, html_options) do
    content = ''
    if icon
      content << (:i, '', class: "fa fa-#{icon}")
    end
    content = link_to(path) do
      content.html_safe + (:span, name)
    end
    content
  end
end