Class: KonoUtils::Object::Cell::Forms::FieldSelector
- Defined in:
- app/concepts/kono_utils/object/cell/forms/field_selector.rb
Overview
Classe che si occupa di selezionare il campo corretto nella form
il model sarĂ un [KonoUtilsBootstrapView4::EditableField]
Instance Method Summary collapse
-
#get_field ⇒ Object
Questa funzione serve per essere sovrascritta dal field generico nella cella specifica del modello e quindi stampare un determinato campo in modo differente Viene normalizzato il campo in model contenente il KonoUtilsBootstrapView4::EditableField.
- #get_layout(field_ns) ⇒ Object
Methods inherited from Base
#_prefixes, #base_class, #concept, #content_for_layout, #content_for_layout?, #destroy_custom_polymorphic_path, #edit_custom_polymorphic_path, #index_custom_polymorphic_path, #kono_user, #legacy_concept, logger, #model_gender, #new_custom_polymorphic_path, #show_custom_polymorphic_path, #title_del, #title_del_g, #title_edit_g, #title_mod, #title_new, #title_new_g, #title_newa, #title_show_g
Methods included from KonoUtilsBootstrapView4::ApplicationIconHelper
Instance Method Details
#get_field ⇒ Object
Questa funzione serve per essere sovrascritta dal field generico nella cella specifica del modello e quindi stampare un determinato campo in modo differente Viene normalizzato il campo in model contenente il KonoUtilsBootstrapView4::EditableField
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/concepts/kono_utils/object/cell/forms/field_selector.rb', line 14 def get_field logger.debug { "SELECT_FIELD:#{form.object.class.name}->#{model.name}" } if model.is_nested? #devo nestarlo concept("cell/forms/fields/nested_wrapper", model, layout: get_layout('nested_wrappers')) else # decidiamo se renderizzare un'associazione o meno if form.object.class.reflect_on_association(model.name) concept("cell/forms/fields/association", model, layout: get_layout('associations')) else # riconosciamo la tipologia di campo per renderizzare quello corretto case attribute_type when :date concept("cell/forms/fields/date_field", model, layout: get_layout('bases')) when :time concept("cell/forms/fields/time_field", model, layout: get_layout('bases')) when :datetime concept("cell/forms/fields/date_time_field", model, layout: get_layout('bases')) when :file concept("cell/forms/fields/file_field", model, layout: get_layout('bases')) when :enum concept("cell/forms/fields/enum", model, layout: get_layout('bases')) else logger.debug { "TIPO non riconosciuto: #{form.object.class.type_for_attribute(model.name).type} -> #{form.object.class.type_for_attribute(model.name).inspect}" } concept("cell/forms/fields/base", model, layout: get_layout('bases')) end end end end |
#get_layout(field_ns) ⇒ Object
46 47 48 49 |
# File 'app/concepts/kono_utils/object/cell/forms/field_selector.rb', line 46 def get_layout(field_ns) layout = context[:overriden_layout].blank? ? "layout" : context[:overriden_layout] layout_ns("cell/forms/fields/bases/#{layout}") end |