Sha256: d4cca1a92fc09f25c1be970bea6f1c383a0f046cd3af0b53132260a9a30a024b

Contents?: true

Size: 869 Bytes

Versions: 43

Compression:

Stored size: 869 Bytes

Contents

require 'rails/generators'

module Bootstrap
  module Generators
    class LayoutGenerator < ::Rails::Generators::Base
      source_root File.expand_path("../templates", __FILE__)
      desc "This generator generates layout file with navigation."
      argument :layout_name, :type => :string, :default => "application"
      argument :layout_type, :type => :string, :default => "fixed",
               :banner => "*fixed or fluid"

      attr_reader :app_name, :container_class

      def generate_layout
        app = ::Rails.application
        @app_name = app.class.to_s.split("::").first
        @container_class = layout_type == "fluid" ? "container-fluid" : "container"
        ext = app.config.generators.options[:rails][:template_engine] || :erb
        template "layout.html.#{ext}", "app/views/layouts/#{layout_name}.html.#{ext}"
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 9 rubygems

Version Path
twitter-bootstrap-rails-2.0.3 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.0.1.0 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.0.2 lib/generators/bootstrap/layout/layout_generator.rb