class Basepack::Forms::BulkEdit

Attributes

query_form[RW]

Public Class Methods

new(factory, chain, options = {}) click to toggle source
Calls superclass method Basepack::Forms::Edit::new
# File lib/basepack/forms/bulk_edit.rb, line 6
def initialize(factory, chain, options = {})
  super(factory, chain, options)
  @query_form = options[:query_form]
end

Public Instance Methods

build_from_factory() click to toggle source
# File lib/basepack/forms/bulk_edit.rb, line 20
def build_from_factory
  factory.build_form(self)
end
collection() click to toggle source
# File lib/basepack/forms/bulk_edit.rb, line 11
def collection
  @query_form ? @query_form.collection_without_pagination : []
end
default_partial() click to toggle source
# File lib/basepack/forms/bulk_edit.rb, line 24
def default_partial
  'forms/bulk_edit'
end
path() click to toggle source
# File lib/basepack/forms/bulk_edit.rb, line 15
def path
  @path ||= view.polymorphic_path([:bulk_update, chain].flatten, query_form.params)
end
render_field!(field) click to toggle source
# File lib/basepack/forms/bulk_edit.rb, line 28
def render_field!(field)
  if field.bulk_editable? and !field.read_only? and field.view_helper != :hidden_field
    field.required = false
    if field.bulk_edit_partial.present? and view.lookup_context.template_exists?(field.bulk_edit_partial, '', true)
      #rendering input field with bulk_edit extensions
      view.render field.bulk_edit_partial, form: self, field: field
    else
      #rendering common input field
      view.render field.partial, form: self, field: field
    end
  end
end