Sha256: 3a98de615decb73887f0c58266fc023c42ca14eb8ef2e7c6698908badfa9c697

Contents?: true

Size: 723 Bytes

Versions: 2

Compression:

Stored size: 723 Bytes

Contents

module Para
  class NestedFieldsGenerator < Para::Generators::NamedBase
    include Para::Admin::BaseHelper
    include Para::Generators::FieldHelpers

    source_root File.expand_path("../templates", __FILE__)

    class_option :container, type: :boolean, default: false, :aliases => "-c"

    def generate_fields
      template(
        "_nested_fields.html.haml",
        "app/views/admin/#{ plural_namespaced_path }/_fields.html.haml"
      )
    end

    def generate_fields_container
      template(
        "../../../../../app/views/para/inputs/_nested_many_container.html.haml",
        "app/views/admin/#{ plural_namespaced_path }/_nested_many_container.html.haml"
      ) if options[:container]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
para-0.5.1 lib/generators/para/nested_fields/nested_fields_generator.rb
para-0.5.0 lib/generators/para/nested_fields/nested_fields_generator.rb