Sha256: 23d3495ba77c4fcb5096de023ed813aec58bfa94c3928034885be18ec18d5a68

Contents?: true

Size: 932 Bytes

Versions: 12

Compression:

Stored size: 932 Bytes

Contents

module ExpressUi
  module ApplicationHelper

    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

12 entries across 12 versions & 1 rubygems

Version Path
express_ui-0.5.0 app/helpers/express_ui/application_helper.rb
express_ui-0.4.2 app/helpers/express_ui/application_helper.rb
express_ui-0.4.1 app/helpers/express_ui/application_helper.rb
express_ui-0.4.0 app/helpers/express_ui/application_helper.rb
express_ui-0.3.0 app/helpers/express_ui/application_helper.rb
express_ui-0.2.1 app/helpers/express_ui/application_helper.rb
express_ui-0.2.0 app/helpers/express_ui/application_helper.rb
express_ui-0.1.7 app/helpers/express_ui/application_helper.rb
express_ui-0.1.6 app/helpers/express_ui/application_helper.rb
express_ui-0.1.5 app/helpers/express_ui/application_helper.rb
express_ui-0.1.4 app/helpers/express_ui/application_helper.rb
express_ui-0.1.3 app/helpers/express_ui/application_helper.rb