Sha256: 292f464905db91893172d7bee9b54cd81716a43b370b8d746e7da5c3352db68b

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

module Hobo
  class AdminSubsiteGenerator < Rails::Generators::NamedBase
    source_root File.expand_path('../templates', __FILE__)

    # overrides the default
    argument :name, :type => :string, :default => 'admin', :optional => true

    include Generators::Hobo::InviteOnly
    include Generators::HoboSupport::EvalTemplate

    def self.banner
      "rails generate hobo:admin_subsite [NAME=admin] [options]"
    end

    def generate_admin_css
      template "admin.css", File.join("public/stylesheets/#{file_name}.css")
    end

    def generate_admin_user_controller
      invoke "hobo:controller", ["#{file_name}/#{options[:user_resource_name].pluralize.underscore}"], options
      template "users_index.dryml", "app/views/#{file_name}/#{options[:user_resource_name].pluralize.underscore}/index.dryml"
    end

    def generate_site_taglib
      invoke 'hobo:subsite_taglib', [name], options.merge(:admin => true)
    end

    def append_admin_tag_into_application_taglib
      destination = File.join(Rails.root, "app/views/taglibs/application.dryml")
      append_file(destination) { eval_template('admin_tag_injection.erb') }
    end

    include Generators::Hobo::Subsite

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hobo-1.3.3 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.2 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.1 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.RC4 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.RC3 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.RC2 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.RC1 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb