Sha256: 588321f0056150c995c66eb6ae456168cfde734c49a4ed0fa1a3afc88483ecf6

Contents?: true

Size: 658 Bytes

Versions: 36

Compression:

Stored size: 658 Bytes

Contents

require "rails/generators"

module Generators
  module Avo
    class FilterGenerator < ::Rails::Generators::NamedBase
      source_root File.expand_path("templates", __dir__)
      class_option :multiple_select, type: :boolean
      class_option :select, type: :boolean
      class_option :text, type: :boolean

      namespace "avo:filter"

      def create_resource_file
        type = "boolean"

        type = "multiple_select" if options[:multiple_select]
        type = "select" if options[:select]
        type = "text" if options[:text]

        template "filters/#{type}_filter.tt", "app/avo/filters/#{singular_name}.rb"
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
avo-2.10.2 lib/generators/avo/filter_generator.rb
avo-2.9.2.pre1 lib/generators/avo/filter_generator.rb
avo-2.10.0 lib/generators/avo/filter_generator.rb
avo-2.9.1.pre7 lib/generators/avo/filter_generator.rb
avo-2.9.1.pre6 lib/generators/avo/filter_generator.rb
avo-2.9.1.pre5 lib/generators/avo/filter_generator.rb
avo-2.9.1.pre4 lib/generators/avo/filter_generator.rb
avo-2.9.1.pre3 lib/generators/avo/filter_generator.rb
avo-2.9.1.pre2 lib/generators/avo/filter_generator.rb
avo-2.9.1.pre1 lib/generators/avo/filter_generator.rb
avo-2.9.0 lib/generators/avo/filter_generator.rb
avo-2.8.0 lib/generators/avo/filter_generator.rb
avo-2.7.1.pre.1 lib/generators/avo/filter_generator.rb
avo-2.7.0 lib/generators/avo/filter_generator.rb
avo-2.6.1.pre.2 lib/generators/avo/filter_generator.rb
avo-2.6.1.pre.1 lib/generators/avo/filter_generator.rb
avo-2.6.0 lib/generators/avo/filter_generator.rb
avo-2.5.2.pre.7 lib/generators/avo/filter_generator.rb
avo-2.5.2.pre.6 lib/generators/avo/filter_generator.rb
avo-2.5.2.pre.5 lib/generators/avo/filter_generator.rb