Sha256: 56e3d5c823322ba488b476c7c1a442c1e8afb81f410255cea015775a43d5d1f4
Contents?: true
Size: 1.48 KB
Versions: 5
Compression:
Stored size: 1.48 KB
Contents
module KonoUtils module Object module Cell class Form < Base load('action_view/helpers/form_helper.rb') include ActionView::Helpers::FormHelper include SimpleForm::ActionViewExtensions::FormHelper include ActionView::Helpers::DateHelper include ActionView::Helpers::FormOptionsHelper layout("forms/layout") ## # Metodo che mi ritorna la lista degli argomenti da passare a simple form. # @return [Array] # # ES: # [model] -> model deve essere l'ActiveRecord da utilizzare come oggetto della form # # [model,{ url:helper_path_custom }] -> come secondo parametro abbiamo l'hash delle opzioni da poter passare al form builder # se al concept passiamo form_options come opzione, queste vengono mergiate nelle opzioni standard def forms_options [model, _form_options] end protected def form_id dom_id(model, SecureRandom.uuid) end def container_layout layout = context[:nested_layout].blank? ? "layout" : context[:nested_layout] layout_ns("cell/forms/containers/#{layout}") end private ## # Opzioni aggiuntive per la form def _form_options opts = options[:form_options] || {} html = opts.fetch(:html, { multipart: true }) html[:id] = form_id opts.merge({ html: html }) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems