Sha256: 31fc8e8093ca4566bbb1b39ef458bd119a5ec9d91864e617e24ce59fccdbc94b

Contents?: true

Size: 737 Bytes

Versions: 3

Compression:

Stored size: 737 Bytes

Contents

class <%= user_role.capitalize %>::<%= class_name %>Form < Tramway::ApplicationForm
  properties <%= form_attributes.map{ |a| ":#{a}" }.join(', ') %>

  def initialize(object)
    super(object).tap do
      # Here is the mapping from model attributes to simple_form inputs.
      # form_properties title: :string,
      #   logo: :file,
      #   description: :ckeditor,
      #   games: :association,
      #   date: :date_picker,
      #   text: :text,
      #   birth_date: {
      #     type: :default,
      #     input_options: {
      #       hint: 'It should be more than 18'
      #     }
      #   }
      form_properties <%= form_attributes.map{ |attr| "#{attr}: :#{form_type(attr)}"}.join(",\n        ") %>
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tramway-0.1.2 lib/tramway/generators/templates/form.rb.erb
tramway-0.1.1.1 lib/tramway/generators/templates/form.rb.erb
tramway-0.1.1 lib/tramway/generators/templates/form.rb.erb