Sha256: d88c24b9fb53e09f264a7d47391458468c4669ff48972dd4e48299e1deec4327

Contents?: true

Size: 1.26 KB

Versions: 11

Compression:

Stored size: 1.26 KB

Contents

module BiolaFrontend
  module Rails
    module FrontendToolkitHelper

      def show_environment
        unless ::Rails.env.match(/prod/i)
          content_tag :span, ::Rails.env, class: 'label label-danger'
        end
      end

      def yield_or(name, or_content=nil, &block)
        if content_for?(name)
          content_for(name)
        elsif or_content
          or_content
        elsif block_given?
          yield(block)
        else
          ''
        end
      end

      def app_dropdown_link(dropdown, &block)
        link_options = {'class'=>'dropdown-toggle'}
        link_options = {'class'=>'dropdown-toggle', 'area-hidden'=>'true', 'data-toggle'=>'dropdown'} if dropdown
        link_to (dropdown ? '#' : BiolaFrontendToolkit.config.relative_root), link_options do
          yield if block_given?
        end
      end

      def app_link(app)
        icon_string = app[:icon].present? ? "#{fa_icon(app[:icon])} " : ''
        link_to app[:url] do
          (icon_string + app[:title]).html_safe
        end
      end

      # Replaces http:// and https:// with just //
      def strip_scheme(url)
        url.to_s.gsub(/\Ahttps?:/, '')
      end

      def schemeless_image_tag(url, options={})
        image_tag(strip_scheme(url), options)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
biola_frontend_toolkit-0.6.4 app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb
biola_frontend_toolkit-0.6.2 app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb
biola_frontend_toolkit-0.6.1 app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb
biola_frontend_toolkit-0.6.0 app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb
biola_frontend_toolkit-0.5.7 app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb
biola_frontend_toolkit-0.5.6 app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb
biola_frontend_toolkit-0.5.5 app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb
biola_frontend_toolkit-0.5.4 app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb
biola_frontend_toolkit-0.5.3 app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb
biola_frontend_toolkit-0.5.2 app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb
biola_frontend_toolkit-0.5.1 app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb