Sha256: 56d6cbef47d4ce64cd834854d9323da76aaff792c2bc7d40d45d734893bb19d3

Contents?: true

Size: 656 Bytes

Versions: 22

Compression:

Stored size: 656 Bytes

Contents

module Cms
  module Generators
    class TemplateGenerator < Rails::Generators::NamedBase

      source_root File.expand_path('../templates', __FILE__)
      class_option :mobile, :type => :boolean, :default => false, :desc => "mobile?"

      def create_template
        if mobile?
          subdir = 'mobile'
        else
          subdir = 'templates'
        end
        template_dir = "app/views/layouts/#{subdir}"
        template 'template.erb', File.join(template_dir, "#{template_name}.html.erb")
      end

      private

      def mobile?
        options[:mobile]
      end

      def template_name
        file_name
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
browsercms-artirix-4.0.4 lib/generators/cms/template/template_generator.rb
browsercms-artirix-4.0.3.3 lib/generators/cms/template/template_generator.rb
browsercms-artirix-4.0.3.2 lib/generators/cms/template/template_generator.rb
browsercms-artirix-4.0.3.1 lib/generators/cms/template/template_generator.rb
browsercms-artirix-4.0.3 lib/generators/cms/template/template_generator.rb
browsercms-artirix-4.0.2 lib/generators/cms/template/template_generator.rb
browsercms-artirix-4.0.1.1 lib/generators/cms/template/template_generator.rb
browsercms-artirix-4.0.0.rc1.art4 lib/generators/cms/template/template_generator.rb
browsercms-4.0.0.rc1 lib/generators/cms/template/template_generator.rb
browsercms-4.0.0.beta lib/generators/cms/template/template_generator.rb
browsercms-4.0.0.alpha lib/generators/cms/template/template_generator.rb
browsercms-3.5.7 lib/generators/cms/template/template_generator.rb
browsercms-3.5.6 lib/generators/cms/template/template_generator.rb
browsercms-3.5.5 lib/generators/cms/template/template_generator.rb
browsercms-3.5.4 lib/generators/cms/template/template_generator.rb
browsercms-3.5.3 lib/generators/cms/template/template_generator.rb
browsercms-3.5.2 lib/generators/cms/template/template_generator.rb
browsercms-3.5.1 lib/generators/cms/template/template_generator.rb
browsercms-3.5.0 lib/generators/cms/template/template_generator.rb
browsercms-3.5.0.rc3 lib/generators/cms/template/template_generator.rb