Sha256: d183f8be8508b0178741808eed3a3f7ab6985af3effd1a2f7a64f6431224a2fc

Contents?: true

Size: 1.33 KB

Versions: 11

Compression:

Stored size: 1.33 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::Subsite
    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}"]
      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],
                                    :user_resource_name => options[:user_resource_name],
                                    :admin => true,
                                    :invite_only => invite_only?
    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

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
hobo-1.3.0.pre27 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.pre26 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.pre25 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.pre24 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.pre23 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.pre22 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.pre21 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.pre20 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.pre19 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.pre18 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb
hobo-1.3.0.pre16 lib/generators/hobo/admin_subsite/admin_subsite_generator.rb