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.5.2.pre.4 lib/generators/avo/filter_generator.rb
avo-2.5.2.pre.3 lib/generators/avo/filter_generator.rb
avo-2.5.2.pre.2 lib/generators/avo/filter_generator.rb
avo-2.5.2.pre.1 lib/generators/avo/filter_generator.rb
avo-2.5.1 lib/generators/avo/filter_generator.rb
avo-2.5.0 lib/generators/avo/filter_generator.rb
avo-2.4.1 lib/generators/avo/filter_generator.rb
avo-2.4.0 lib/generators/avo/filter_generator.rb
avo-2.3.1.pre.6 lib/generators/avo/filter_generator.rb
avo-2.3.1.pre.5 lib/generators/avo/filter_generator.rb
avo-2.3.1.pre.4 lib/generators/avo/filter_generator.rb
avo-2.3.1.pre.3 lib/generators/avo/filter_generator.rb
avo-2.3.1.pre.2 lib/generators/avo/filter_generator.rb
avo-2.3.1.pre.1 lib/generators/avo/filter_generator.rb
avo-2.3.0 lib/generators/avo/filter_generator.rb
avo-2.2.2 lib/generators/avo/filter_generator.rb