Sha256: d2e6480adb8714458d1c49f8a16803de680d7f5a37a56299999a755965acd60b

Contents?: true

Size: 961 Bytes

Versions: 2

Compression:

Stored size: 961 Bytes

Contents

module ExpressUi
  module ApplicationHelper
    include ChecksForTesting

    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

    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

    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

    # 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.
    def user_role_classes
      return "role-user" if defined?(current_user) && current_user.present?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
express_ui-0.5.2 app/helpers/express_ui/application_helper.rb
express_ui-0.5.1 app/helpers/express_ui/application_helper.rb