Module: ExpressUi::ApplicationHelper
- Includes:
- ChecksForTesting
- Defined in:
- app/helpers/express_ui/application_helper.rb
Instance Method Summary collapse
- #code_block_in_code_element(code_block) ⇒ Object
- #highlight_code_block(&block) ⇒ Object
- #nav_link_to(text, path) ⇒ Object
-
#user_role_classes ⇒ Object
This only works for controllers within this engine.
Methods included from ChecksForTesting
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) content_tag :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) content_tag :pre do code_block_in_code_element end end |
#nav_link_to(text, path) ⇒ Object
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' content_tag :li, class: class_name do link_to text, path end end |
#user_role_classes ⇒ Object
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 |