Module: Engine2::ActionFormSupport
Instance Method Summary
collapse
#get_type_info, #hide_pk, #node_defined, #show_pk, #unsupported_association
#config, #decorate, #field_filter, #hide_fields, #info, #info!, #loc!, #render, #show_fields
#lazy_tab, #select_tabs
#modal_action, #panel, #panel_class, #panel_footer, #panel_header, #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_tabs(hash) ⇒ Object
959
960
961
962
|
# File 'lib/engine2/action.rb', line 959
def field_tabs hash
super
panel_template 'scaffold/form_tabs'
end
|
#field_template(template) ⇒ Object
942
943
944
|
# File 'lib/engine2/action.rb', line 942
def field_template template
panel[:field_template] = template
end
|
#hr_after(field, message = '-') ⇒ Object
1011
1012
1013
|
# File 'lib/engine2/action.rb', line 1011
def hr_after field, message = '-'
info! field, hr: message
end
|
#post_process ⇒ Object
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
|
# File 'lib/engine2/action.rb', line 967
def post_process
if fields = @meta[:fields]
fields = fields - static.meta[: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
|
1002
1003
1004
1005
|
# File 'lib/engine2/action.rb', line 1002
def post_run
super
@meta[:primary_fields] = assets[:model].primary_keys
end
|
946
947
948
949
950
951
952
953
954
955
956
957
|
# File 'lib/engine2/action.rb', line 946
def pre_run
super
panel_template 'scaffold/form'
field_template 'scaffold/fields'
panel_class 'modal-large'
top = node.parent.parent == nil
:panel_menu do
option :approve, icon: "ok", disabled: "action.action_pending()" option :cancel, icon: "remove" unless top end
end
|
#record(handler, record) ⇒ Object
964
965
|
# File 'lib/engine2/action.rb', line 964
def record handler, record
end
|
1007
1008
1009
|
# File 'lib/engine2/action.rb', line 1007
def template
Templates
end
|