Module: Admin::ApplicationHelper

Includes:
Bigmouth::ApplicationHelper
Defined in:
app/helpers/bigmouth/admin/application_helper.rb

Instance Method Summary collapse

Methods included from Bigmouth::ApplicationHelper

#alert_class_for, #author, #summary

Instance Method Details



14
15
16
17
# File 'app/helpers/bigmouth/admin/application_helper.rb', line 14

def sidebar_activate(sidebar_link_url)
  current_url = request.headers["SCRIPT_NAME"] + request.headers["PATH_INFO"]
  current_url.match(sidebar_link_url) ? ' class="active"' : ""
end


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/helpers/bigmouth/admin/application_helper.rb', line 19

def sidebar_list_items
  items = [
    { text: "Articles", path: admin_articles_path },
    { text: "Images", path: admin_images_path }
  ]

  html = ""
  items.each do |item|
    text = item[:text]
    path = item[:path]
    html += %(<li#{sidebar_activate(path)}><a href="#{path}">#{text}</a></li>)
  end

  html.html_safe
end

#uploaded_by(image) ⇒ Object



6
7
8
9
10
11
12
# File 'app/helpers/bigmouth/admin/application_helper.rb', line 6

def uploaded_by(image)
  if image.user.present?
    image.user[Bigmouth.config.username_key.to_sym] || "Guest"
  else
    "Guest"
  end
end