Module: ExpressUi::ApplicationHelper

Includes:
ChecksForTesting
Defined in:
app/helpers/express_ui/application_helper.rb

Instance Method Summary collapse

Methods included from ChecksForTesting

#for_testing?

Instance Method Details

#code_block_in_code_element(code_block) ⇒ Object



23
24
25
26
27
# File 'app/helpers/express_ui/application_helper.rb', line 23

def code_block_in_code_element(code_block)
   :code, class: "ae-code-block prettyprint" do
    code_block.strip_heredoc.html_safe
  end
end

#highlight_code_block(&block) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'app/helpers/express_ui/application_helper.rb', line 13

def highlight_code_block(&block)
  code_block = capture(&block)

  code_block_in_code_element = code_block_in_code_element(code_block)

   :pre do
    code_block_in_code_element
  end
end


5
6
7
8
9
10
11
# File 'app/helpers/express_ui/application_helper.rb', line 5

def nav_link_to(text, path)
  class_name = current_page?(path) ? 'ae-nav-item active' : 'ae-nav-item'

   :li, class: class_name do
    link_to text, path
  end
end

#user_role_classesObject

This only works for controllers within this engine. (eg test/dummy) Put this method in your application_helper.rb and customize it to your purpose.



32
33
34
# File 'app/helpers/express_ui/application_helper.rb', line 32

def user_role_classes
  return "role-user" if defined?(current_user) && current_user.present?
end