Sha256: b37d4712b2f790a0507e5fa55bc9ec5443c8342357d167e397da35e2a23e5b33

Contents?: true

Size: 986 Bytes

Versions: 4

Compression:

Stored size: 986 Bytes

Contents

module ApplicationHelper
  def title(page_title, show_title = true)
    content_for(:title) { page_title.to_s }
    @show_title = show_title
  end
  
  def show_title?
    @show_title
  end
  
  def stylesheet(*args)
    content_for(:head) { stylesheet_link_tag(*args) }
  end
  
  def javascript(*args)
    content_for(:head) { javascript_include_tag(*args) }
  end
  
  def flash_messages
    flash.collect do |key, value|
      content_tag(:div, value, :class=>"flash_messages #{key}")
    end
  end 
  
  def analytics(site_id)
    html = <<-ANALYTICS
    <script>
     var _gaq = [['_setAccount', '#{site_id}'], ['_trackPageview']];
     (function(d, t) {
      var g = d.createElement(t),
      s = d.getElementsByTagName(t)[0];
      g.async = true;
      g.src = '//www.google-analytics.com/ga.js';
      s.parentNode.insertBefore(g, s);
      })(document, 'script');
    </script>
    ANALYTICS
    
    html.html_safe
  end   
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flexi_generators-0.2.3 lib/generators/flexi_prepare/templates/application_helper.rb
flexi_generators-0.2.2 lib/generators/flexi_prepare/templates/application_helper.rb
flexi_generators-0.2.1 lib/generators/flexi_prepare/templates/application_helper.rb
flexi_generators-0.2.0 lib/generators/flexi_prepare/templates/application_helper.rb