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.1.7 lib/generators/bootstrap/layout/layout_generator.rb
rbootstrap-1.1.2 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.1.6 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.1.5 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.1.4 lib/generators/bootstrap/layout/layout_generator.rb
kube-rails-0.0.1 lib/generators/kube/layout/layout_generator.rb
twitter-bootstrap-turbo-2.1.3 lib/generators/bootstrap/layout/layout_generator.rb
cf-twitter-bootstrap-rails-2.1.3 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.1.3 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.1.2 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.1.1 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-ajax-0.0.1 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.1.0 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.0.9 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.0.8 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.0.7 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.0.6 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.0.5 lib/generators/bootstrap/layout/layout_generator.rb
twitter-bootstrap-rails-2.0.4 lib/generators/bootstrap/layout/layout_generator.rb
fix-twitter-bootstrap-rails-2.0.3 lib/generators/bootstrap/layout/layout_generator.rb