Module: BiolaFrontend::Rails::FrontendToolkitHelper

Defined in:
app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb

Instance Method Summary collapse

Instance Method Details



23
24
25
26
27
28
29
# File 'app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb', line 23

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


31
32
33
34
35
36
# File 'app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb', line 31

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

#schemeless_image_tag(url, options = {}) ⇒ Object



43
44
45
# File 'app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb', line 43

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

#show_environmentObject



5
6
7
8
9
# File 'app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb', line 5

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

#strip_scheme(url) ⇒ Object

Replaces http:// and https:// with just //



39
40
41
# File 'app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb', line 39

def strip_scheme(url)
  url.to_s.gsub(/\Ahttps?:/, '')
end

#yield_or(name, or_content = nil, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb', line 11

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