Sha256: a7e23f3f7aed969599973754897d79fda0bae13ee4ae7963f8418608ec8fb4c3

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

# Application template recipe for the rails3_devise_wizard. Check for a newer version here:
# https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/application_layout.rb

after_bundler do

  # Set up the default application layout
  if recipes.include? 'haml'
    remove_file 'app/views/layouts/application.html.erb'
    # There is Haml code in this script. Changing the indentation is perilous between HAMLs.
    create_file 'app/views/layouts/application.html.haml' do <<-HAML
!!!
%html
  %head
    %title #{app_name}
    = stylesheet_link_tag :all
    = javascript_include_tag :defaults
    = csrf_meta_tag
  %body
    - flash.each do |name, msg|
      = content_tag :div, msg, :id => "flash_\#{name}" if msg.is_a?(String)
    = yield
HAML
    end
  else
    inject_into_file 'app/views/layouts/application.html.erb', :after => "<body>\n" do
  <<-ERB
  <%- flash.each do |name, msg| -%>
    <%= content_tag :div, msg, :id => "flash_\#{name}" if msg.is_a?(String) %>
  <%- end -%>
ERB
    end
  end

end

__END__

name: ApplicationLayout
description: "Add a default application layout with flash messages."
author: fortuity

category: other
tags: [utilities, configuration]

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails3_devise_wizard-0.2.4 recipes/application_layout.rb
rails3_devise_wizard-0.2.3 recipes/application_layout.rb
rails3_devise_wizard-0.2.2 recipes/application_layout.rb
rails3_devise_wizard-0.2.1 recipes/application_layout.rb
rails3_devise_wizard-0.2 recipes/application_layout.rb