Module: Engine2::MetaFormSupport
Instance Method Summary
collapse
#action_defined, #get_type_info, #hide_pk, #show_pk, #unsupported_association
#config, #decorate, #field_filter, #hide_fields, #info, #info!, #loc!, #reload_routes!, #render, #show_fields
#field_tabs, #lazy_tab, #select_tabs
#modal_action, #panel, #panel_class, #panel_footer, #panel_panel_template, #panel_template, #panel_title
#menu, #menu?
#ng_call, #ng_execute, #ng_info!, #ng_record, #ng_record!
#on_change
Instance Method Details
#field_template(template) ⇒ Object
756
757
758
|
# File 'lib/engine2/meta.rb', line 756
def field_template template
panel[:field_template] = template
end
|
#hr_after(field, message = '-') ⇒ Object
820
821
822
|
# File 'lib/engine2/meta.rb', line 820
def hr_after field, message = '-'
info! field, hr: message
end
|
#post_process ⇒ Object
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
|
# File 'lib/engine2/meta.rb', line 776
def post_process
if fields = @meta[:fields]
fields = fields - static.get[:fields] if dynamic?
decorate(fields)
fields.each do |name|
type_info = get_type_info(name)
info[name][:render] ||= begin
renderer = DefaultFormRenderers[type_info[:type]]
raise E2Error.new("No form renderer found for field '#{type_info[:name]}' of type '#{type_info[:type]}'") unless renderer
renderer.(self, type_info)
end
proc = FormRendererPostProcessors[type_info[:type]]
proc.(self, name, type_info) if proc
end
assoc = assets[:assoc]
if assoc && assoc[:type] == :one_to_many
assoc[:keys].each do |key|
info! key, disabled: true if fields.include? key
end
end
end
super
end
|
811
812
813
814
|
# File 'lib/engine2/meta.rb', line 811
def post_run
super
@meta[:primary_fields] = assets[:model].primary_keys
end
|
760
761
762
763
764
765
766
767
768
769
770
771
|
# File 'lib/engine2/meta.rb', line 760
def pre_run
super
panel_template 'scaffold/form'
field_template 'scaffold/fields'
panel_class 'modal-large'
:panel_menu do
option :approve, icon: "ok", disabled: 'action.action_pending()'
option :cancel, icon: "remove"
end
end
|
#record(handler, record) ⇒ Object
773
774
|
# File 'lib/engine2/meta.rb', line 773
def record handler, record
end
|
816
817
818
|
# File 'lib/engine2/meta.rb', line 816
def template
Templates
end
|