Sha256: 0c86299272a77e9f47a8f0fa971a5d20b3d6983ff140cf0862b577888b0f43e0

Contents?: true

Size: 988 Bytes

Versions: 13

Compression:

Stored size: 988 Bytes

Contents

require 'rails/generators'

module PixelforceCms
  module Generators
    class ContactUsGenerator < Rails::Generators::Base
      source_root File.expand_path("../templates", __FILE__)

      def create_model
        copy_file "contact_us.rb", "app/models/contact_us.rb"
        copy_file "contacts_controller.rb", "app/controllers/contacts_controller.rb"
        template  "notification.rb", 'app/mailers/notification.rb'
        create_file "app/views/notification/notify_us.text.haml"
        route_config = %q(
  get  '/contact', to: 'contacts#new', as: :conatct
  post '/contact', to: 'contacts#create'
        )
        inject_into_file 'config/routes.rb', "\n#{route_config}\n", { :after => '::Application.routes.draw do', :verbose => false }
      end

      def application_name
        if defined?(Rails) && Rails.application
          Rails.application.class.name.split('::').first.underscore
        else
          "application"
        end
      end
      
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
pixelforce_cms-2.6 lib/generators/pixelforce_cms/contact_us_generator.rb
pixelforce_cms-2.5 lib/generators/pixelforce_cms/contact_us_generator.rb
pixelforce_cms-2.4 lib/generators/pixelforce_cms/contact_us_generator.rb
pixelforce_cms-2.3 lib/generators/pixelforce_cms/contact_us_generator.rb
pixelforce_cms-2.2 lib/generators/pixelforce_cms/contact_us_generator.rb
pixelforce_cms-2.0 lib/generators/pixelforce_cms/contact_us_generator.rb
pixelforce_cms-1.0 lib/generators/pixelforce_cms/contact_us_generator.rb
pixelforce_cms-0.9.9.9 lib/generators/pixelforce_cms/contact_us_generator.rb
pixelforce_cms-0.9.9.8 lib/generators/pixelforce_cms/contact_us_generator.rb
pixelforce_cms-0.9.9.7 lib/generators/pixelforce_cms/contact_us_generator.rb
pixelforce_cms-0.9.9.6 lib/generators/pixelforce_cms/contact_us_generator.rb
pixelforce_cms-0.9.9.5 lib/generators/pixelforce_cms/contact_us_generator.rb
pixelforce_cms-0.9.9.4 lib/generators/pixelforce_cms/contact_us_generator.rb