kono_utils_bootstrap_view4 0.1.0.pre.rc.3 → 0.1.0.pre.rc.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/app/concepts/kono_utils/object/cell/base.rb +99 -97
  3. data/app/concepts/kono_utils/object/cell/buttons/base.rb +55 -54
  4. data/app/concepts/kono_utils/object/cell/buttons/collapse_search.rb +29 -23
  5. data/app/concepts/kono_utils/object/cell/buttons/create.rb +20 -15
  6. data/app/concepts/kono_utils/object/cell/buttons/delete.rb +29 -24
  7. data/app/concepts/kono_utils/object/cell/buttons/download.rb +22 -16
  8. data/app/concepts/kono_utils/object/cell/buttons/edit.rb +17 -12
  9. data/app/concepts/kono_utils/object/cell/buttons/list.rb +17 -11
  10. data/app/concepts/kono_utils/object/cell/buttons/reset_search.rb +21 -15
  11. data/app/concepts/kono_utils/object/cell/create/base.rb +6 -5
  12. data/app/concepts/kono_utils/object/cell/create/page_title.rb +11 -6
  13. data/app/concepts/kono_utils/object/cell/create/side_title.rb +8 -2
  14. data/app/concepts/kono_utils/object/cell/edits/base.rb +6 -5
  15. data/app/concepts/kono_utils/object/cell/edits/page_title.rb +11 -6
  16. data/app/concepts/kono_utils/object/cell/edits/side_title.rb +9 -3
  17. data/app/concepts/kono_utils/object/cell/form.rb +51 -48
  18. data/app/concepts/kono_utils/object/cell/forms/base.rb +12 -10
  19. data/app/concepts/kono_utils/object/cell/forms/container.rb +22 -18
  20. data/app/concepts/kono_utils/object/cell/forms/containers/layout.rb +14 -10
  21. data/app/concepts/kono_utils/object/cell/forms/containers/modal_layout.rb +10 -4
  22. data/app/concepts/kono_utils/object/cell/forms/containers/search_layout.rb +10 -4
  23. data/app/concepts/kono_utils/object/cell/forms/containers/table_layout.rb +11 -5
  24. data/app/concepts/kono_utils/object/cell/forms/field_selector.rb +68 -64
  25. data/app/concepts/kono_utils/object/cell/forms/field_selectors/layout.rb +9 -4
  26. data/app/concepts/kono_utils/object/cell/forms/field_selectors/modal_layout.rb +10 -4
  27. data/app/concepts/kono_utils/object/cell/forms/field_selectors/table_layout.rb +11 -5
  28. data/app/concepts/kono_utils/object/cell/forms/fields/association.rb +11 -4
  29. data/app/concepts/kono_utils/object/cell/forms/fields/base.rb +21 -16
  30. data/app/concepts/kono_utils/object/cell/forms/fields/bases/layout.rb +24 -17
  31. data/app/concepts/kono_utils/object/cell/forms/fields/bases/modal_layout.rb +14 -4
  32. data/app/concepts/kono_utils/object/cell/forms/fields/bases/table_layout.rb +17 -7
  33. data/app/concepts/kono_utils/object/cell/forms/fields/check_box.rb +14 -6
  34. data/app/concepts/kono_utils/object/cell/forms/fields/collection.rb +20 -12
  35. data/app/concepts/kono_utils/object/cell/forms/fields/date_field.rb +18 -10
  36. data/app/concepts/kono_utils/object/cell/forms/fields/date_time_field.rb +34 -30
  37. data/app/concepts/kono_utils/object/cell/forms/fields/enum.rb +23 -15
  38. data/app/concepts/kono_utils/object/cell/forms/fields/file_field.rb +29 -21
  39. data/app/concepts/kono_utils/object/cell/forms/fields/nested_modal_wrapper.rb +10 -3
  40. data/app/concepts/kono_utils/object/cell/forms/fields/nested_modal_wrappers/forms_container.rb +13 -5
  41. data/app/concepts/kono_utils/object/cell/forms/fields/nested_modal_wrappers/show.rb +19 -10
  42. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrapper.rb +54 -49
  43. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/form.rb +41 -35
  44. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms/layout.rb +17 -8
  45. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms/modal_layout.rb +14 -4
  46. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms/table_layout.rb +14 -4
  47. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb +44 -36
  48. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_containers/layout.rb +17 -10
  49. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_containers/modal_layout.rb +17 -6
  50. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_containers/table_layout.rb +20 -11
  51. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/header.rb +31 -23
  52. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_button.rb +46 -40
  53. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_buttons/layout.rb +14 -7
  54. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_buttons/modal_layout.rb +14 -4
  55. data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_buttons/table_layout.rb +14 -4
  56. data/app/concepts/kono_utils/object/cell/forms/fields/read_only.rb +16 -9
  57. data/app/concepts/kono_utils/object/cell/forms/fields/time_field.rb +14 -7
  58. data/app/concepts/kono_utils/object/cell/forms/layout.rb +8 -4
  59. data/app/concepts/kono_utils/object/cell/forms/submit.rb +21 -16
  60. data/app/concepts/kono_utils/object/cell/index/base.rb +9 -7
  61. data/app/concepts/kono_utils/object/cell/index/page_title.rb +11 -6
  62. data/app/concepts/kono_utils/object/cell/index/row.rb +38 -36
  63. data/app/concepts/kono_utils/object/cell/index/row_buttons.rb +8 -4
  64. data/app/concepts/kono_utils/object/cell/index/row_footer.rb +8 -3
  65. data/app/concepts/kono_utils/object/cell/index/row_header.rb +13 -7
  66. data/app/concepts/kono_utils/object/cell/index/side_title.rb +8 -2
  67. data/app/concepts/kono_utils/object/cell/index/table.rb +12 -9
  68. data/app/concepts/kono_utils/object/cell/inject.rb +103 -102
  69. data/app/concepts/kono_utils/object/cell/modals/base.rb +7 -3
  70. data/app/concepts/kono_utils/object/cell/modals/bodies/layout.rb +9 -4
  71. data/app/concepts/kono_utils/object/cell/modals/body.rb +7 -3
  72. data/app/concepts/kono_utils/object/cell/modals/container.rb +5 -1
  73. data/app/concepts/kono_utils/object/cell/modals/containers/layout.rb +12 -6
  74. data/app/concepts/kono_utils/object/cell/modals/footer.rb +5 -2
  75. data/app/concepts/kono_utils/object/cell/modals/footers/layout.rb +9 -4
  76. data/app/concepts/kono_utils/object/cell/modals/header.rb +6 -3
  77. data/app/concepts/kono_utils/object/cell/modals/headers/layout.rb +9 -4
  78. data/app/concepts/kono_utils/object/cell/search.rb +22 -19
  79. data/app/concepts/kono_utils/object/cell/searches/form.rb +12 -9
  80. data/app/concepts/kono_utils/object/cell/show.rb +25 -20
  81. data/app/concepts/kono_utils/object/cell/shows/base.rb +6 -5
  82. data/app/concepts/kono_utils/object/cell/shows/page_title.rb +11 -6
  83. data/app/concepts/kono_utils/object/cell/shows/side_title.rb +8 -2
  84. data/lib/kono_utils_bootstrap_view4/version.rb +1 -1
  85. metadata +1 -1
@@ -1,10 +1,17 @@
1
- module KonoUtils::Object::Cell::Forms::Fields # namespace
2
- ##
3
- # Rappresenta il layout del container del Wrapper
4
- # abbiamo la versione Standard e versione Table
5
- ##
6
- class NestedWrappers::RemoveButtons::Layout < Base
7
-
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Forms # namespace
5
+ module Fields
6
+ ##
7
+ # Rappresenta il layout del container del Wrapper
8
+ # abbiamo la versione Standard e versione Table
9
+ ##
10
+ class NestedWrappers::RemoveButtons::Layout < Base
8
11
 
12
+ end
13
+ end
14
+ end
15
+ end
9
16
  end
10
17
  end
@@ -1,7 +1,17 @@
1
- module KonoUtils::Object::Cell::Forms::Fields::NestedWrappers::RemoveButtons # namespace
2
- class ModalLayout < Layout
3
-
4
-
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Forms # namespace
5
+ module Fields
6
+ module NestedWrappers
7
+ module RemoveButtons # namespace
8
+ class ModalLayout < Layout
5
9
 
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
6
16
  end
7
17
  end
@@ -1,7 +1,17 @@
1
- module KonoUtils::Object::Cell::Forms::Fields::NestedWrappers::RemoveButtons # namespace
2
- class TableLayout < Layout
3
-
4
-
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Forms # namespace
5
+ module Fields
6
+ module NestedWrappers
7
+ module RemoveButtons # namespace
8
+ class TableLayout < Layout
5
9
 
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
6
16
  end
7
17
  end
@@ -1,15 +1,22 @@
1
- module KonoUtils::Object::Cell::Forms::Fields # namespace
2
- # Campo per readonly
3
- class ReadOnly < Base
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Forms # namespace
5
+ module Fields
6
+ # Campo per readonly
7
+ class ReadOnly < Base
4
8
 
9
+ def field_options
10
+ super.merge({ disabled: true })
11
+ end
5
12
 
6
- def field_options
7
- super.merge({disabled: true})
8
- end
13
+ def show(&block)
14
+ render "forms/fields/base"
15
+ end
9
16
 
10
- def show(&block)
11
- render "forms/fields/base"
17
+ end
18
+ end
19
+ end
12
20
  end
13
-
14
21
  end
15
22
  end
@@ -1,11 +1,18 @@
1
- module KonoUtils::Object::Cell::Forms::Fields # namespace
2
- # La cella base dei componenti della form contiene sempre la form come model
3
- class TimeField < DateTimeField
4
-
5
- def input_picker_format
6
- "LT"
7
- end
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Forms # namespace
5
+ module Fields
6
+ # La cella base dei componenti della form contiene sempre la form come model
7
+ class TimeField < DateTimeField
8
8
 
9
+ def input_picker_format
10
+ "LT"
11
+ end
9
12
 
13
+ end
14
+ end
15
+ end
16
+ end
10
17
  end
11
18
  end
@@ -1,7 +1,11 @@
1
- module KonoUtils::Object::Cell::Forms # namespace
2
- # Layout base della form
3
- class Layout < Base
4
-
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Forms # namespace # Layout base della form
5
+ class Layout < Base
5
6
 
7
+ end
8
+ end
9
+ end
6
10
  end
7
11
  end
@@ -1,22 +1,27 @@
1
- module KonoUtils::Object::Cell::Forms # namespace
2
- # La cella base dei componenti della form contiene sempre la form come model
3
- class Submit < Base
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Forms # namespace
5
+ # La cella base dei componenti della form contiene sempre la form come model
6
+ class Submit < Base
4
7
 
5
- def btn_status_class
6
- 'btn-primary'
7
- end
8
+ def btn_status_class
9
+ 'btn-primary'
10
+ end
8
11
 
9
- def btn_options
10
- {
11
- class: btn_status_class,
12
- :disable_with => t('wait', default: 'Wait...')
13
- }
14
- end
15
-
16
- def show
17
- form.button :submit, btn_options
18
- end
12
+ def btn_options
13
+ {
14
+ class: btn_status_class,
15
+ :disable_with => t('wait', default: 'Wait...')
16
+ }
17
+ end
19
18
 
19
+ def show
20
+ form.button :submit, btn_options
21
+ end
20
22
 
23
+ end
24
+ end
25
+ end
21
26
  end
22
27
  end
@@ -1,12 +1,14 @@
1
- module KonoUtils::Object::Cell # namespace
2
- class Index::Base < Base
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ class Index::Base < Base
3
5
 
6
+ # @return [Array<Symbol>] elenco delle colonne da mostrare
7
+ def table_columns
8
+ policy(base_class.new).show_attributes
9
+ end
4
10
 
5
-
6
- # @return [Array<Symbol>] elenco delle colonne da mostrare
7
- def table_columns
8
- policy(base_class.new).show_attributes
11
+ end
9
12
  end
10
-
11
13
  end
12
14
  end
@@ -1,10 +1,15 @@
1
- module KonoUtils::Object::Cell::Index # namespace
2
- class PageTitle < Base
3
-
4
- def show
5
- base_class.mnp
6
- end
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Index # namespace
5
+ class PageTitle < Base
7
6
 
7
+ def show
8
+ base_class.mnp
9
+ end
8
10
 
11
+ end
12
+ end
13
+ end
9
14
  end
10
15
  end
@@ -1,40 +1,42 @@
1
- module KonoUtils::Object::Cell::Index # namespace
2
- class Row < Base # class
3
-
4
- #@!attribute [ActiveRecord::Base] model -> record della riga che stiamo stampando
5
-
6
-
7
-
8
- ##
9
- # Questa funzione serve per essere sovrascritta nell'helper specializzato del controller
10
- # @param [Symbol] field campo da renderizzare
11
- # @return [Object] valore da visualizzare nella colonna
12
- def print_column(field)
13
- model.send(field)
14
- end
15
-
16
-
17
-
18
- ##
19
- # Questa funzione serve per generare la colonna della tabella
20
- #
21
- # @param [String] field campo che mi identifica il valore del record
22
- # @param [Symbol] column tipo di colonna (:td,:th)
23
- # @yieldparam column_class [String] stringa contenente la classe della colonna
24
- # @yieldparam column_id [String] stringa contenente l'id generato aggiunto cul tag della colonna
25
- # @yieldreturn [String] contenuto da inserire nella colonna
26
- def column_builder(field, column)
27
- column_class = "column_#{field}"
28
- column_id = ''
29
- if model
30
- column_id = "#{column_class}-#{dom_id(model)}"
31
- end
32
- content_tag column, class: column_class, id: column_id do
33
- capture do
34
- yield column_class, column_id
35
- end.html_safe
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Index # namespace
5
+ class Row < Base # class
6
+
7
+ #@!attribute [ActiveRecord::Base] model -> record della riga che stiamo stampando
8
+
9
+ ##
10
+ # Questa funzione serve per essere sovrascritta nell'helper specializzato del controller
11
+ # @param [Symbol] field campo da renderizzare
12
+ # @return [Object] valore da visualizzare nella colonna
13
+ def print_column(field)
14
+ model.send(field)
15
+ end
16
+
17
+ ##
18
+ # Questa funzione serve per generare la colonna della tabella
19
+ #
20
+ # @param [String] field campo che mi identifica il valore del record
21
+ # @param [Symbol] column tipo di colonna (:td,:th)
22
+ # @yieldparam column_class [String] stringa contenente la classe della colonna
23
+ # @yieldparam column_id [String] stringa contenente l'id generato aggiunto cul tag della colonna
24
+ # @yieldreturn [String] contenuto da inserire nella colonna
25
+ def column_builder(field, column)
26
+ column_class = "column_#{field}"
27
+ column_id = ''
28
+ if model
29
+ column_id = "#{column_class}-#{dom_id(model)}"
30
+ end
31
+ content_tag column, class: column_class, id: column_id do
32
+ capture do
33
+ yield column_class, column_id
34
+ end.html_safe
35
+ end
36
+ end
37
+
38
+ end
36
39
  end
37
40
  end
38
-
39
41
  end
40
42
  end
@@ -1,7 +1,11 @@
1
- module KonoUtils::Object::Cell::Index # namespace
2
- class RowButtons < Base # class
3
-
4
-
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Index # namespace
5
+ class RowButtons < Base # class
5
6
 
7
+ end
8
+ end
9
+ end
6
10
  end
7
11
  end
@@ -1,6 +1,11 @@
1
- module KonoUtils::Object::Cell::Index # namespace
2
- class RowFooter < Row # class
3
-
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Index # namespace
5
+ class RowFooter < Row # class
4
6
 
7
+ end
8
+ end
9
+ end
5
10
  end
6
11
  end
@@ -1,11 +1,17 @@
1
- module KonoUtils::Object::Cell::Index # namespace
2
- class RowHeader < Row # class
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Index # namespace
5
+ class RowHeader < Row # class
3
6
 
4
- ##
5
- # Questa funzione serve per stampare il contenuto dell'header
6
- def print_column(field)
7
- block_given? ? capture { yield(field) } : base_class.han(field)
8
- end
7
+ ##
8
+ # Questa funzione serve per stampare il contenuto dell'header
9
+ def print_column(field)
10
+ block_given? ? capture { yield(field) } : base_class.han(field)
11
+ end
9
12
 
13
+ end
14
+ end
15
+ end
10
16
  end
11
17
  end
@@ -1,5 +1,11 @@
1
- module KonoUtils::Object::Cell::Index # namespace
2
- class SideTitle < Base
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Index # namespace
5
+ class SideTitle < Base
3
6
 
7
+ end
8
+ end
9
+ end
4
10
  end
5
11
  end
@@ -1,15 +1,18 @@
1
- module KonoUtils::Object::Cell::Index # namespace
2
- class Table < Base
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Index # namespace
5
+ class Table < Base
3
6
 
7
+ def pagination
8
+ paginate(model)
9
+ end
4
10
 
11
+ alias_method :pagination_top, :pagination
12
+ alias_method :pagination_bottom, :pagination
5
13
 
6
-
7
- def pagination
8
- paginate(model)
14
+ end
15
+ end
9
16
  end
10
-
11
- alias_method :pagination_top, :pagination
12
- alias_method :pagination_bottom, :pagination
13
-
14
17
  end
15
18
  end
@@ -1,122 +1,123 @@
1
- module KonoUtils::Object::Cell # namespace
2
- ##
3
- # Classe per la gestione dell'inserimento del contenuto e javascript per l'azione inject
4
- # - Options:
5
- # html_manipulation_method: [(:append),:prepend,:replaceWith] -> definisce come deve operare il javascript
6
- # nell'operazione di manipolazione del contenitore
7
- # in cui inserire il contenuto
8
- # inject_show_modal: [Boolean] -> identifica se stiamo visualizzando la show della modal o meno, default a false
9
- class Inject < Base
10
-
11
- load('action_view/helpers/form_helper.rb')
12
- include ActionView::Helpers::FormHelper
13
- include SimpleForm::ActionViewExtensions::FormHelper
14
- include ActionView::Helpers::DateHelper
15
- include ActionView::Helpers::FormOptionsHelper
16
-
17
-
18
- def params
19
- @_p ||= options[:params]
20
- @_p.permit!
21
- @_p
22
- end
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ ##
5
+ # Classe per la gestione dell'inserimento del contenuto e javascript per l'azione inject
6
+ # - Options:
7
+ # html_manipulation_method: [(:append),:prepend,:replaceWith] -> definisce come deve operare il javascript
8
+ # nell'operazione di manipolazione del contenitore
9
+ # in cui inserire il contenuto
10
+ # inject_show_modal: [Boolean] -> identifica se stiamo visualizzando la show della modal o meno, default a false
11
+ class Inject < Base
12
+
13
+ load('action_view/helpers/form_helper.rb')
14
+ include ActionView::Helpers::FormHelper
15
+ include SimpleForm::ActionViewExtensions::FormHelper
16
+ include ActionView::Helpers::DateHelper
17
+ include ActionView::Helpers::FormOptionsHelper
18
+
19
+ def params
20
+ @_p ||= options[:params]
21
+ @_p.permit!
22
+ @_p
23
+ end
23
24
 
24
- def form_layout
25
- layout_ns("cell/forms/fields/nested_wrappers/forms/#{nested_layout}")
26
- end
25
+ def form_layout
26
+ layout_ns("cell/forms/fields/nested_wrappers/forms/#{nested_layout}")
27
+ end
27
28
 
28
- ##
29
- # TODO documentare cosa serve, qual'era il concetto di questo pezzo di codice
30
- def remote_context
31
- params.dig(:kono_utils, :context).to_h.deep_symbolize_keys || {}
32
- end
29
+ ##
30
+ # TODO documentare cosa serve, qual'era il concetto di questo pezzo di codice
31
+ def remote_context
32
+ params.dig(:kono_utils, :context).to_h.deep_symbolize_keys || {}
33
+ end
33
34
 
34
- def form_content
35
- #nel caso stiamo visualizzando il rimpiazzo dell'output delle modals(quando per esempio abbiamo aggiornato od inserito un nuovo record)
36
- if options.fetch(:inject_show_modal, false)
35
+ def form_content
36
+ #nel caso stiamo visualizzando il rimpiazzo dell'output delle modals(quando per esempio abbiamo aggiornato od inserito un nuovo record)
37
+ if options.fetch(:inject_show_modal, false)
37
38
 
38
- container = nil
39
- simple_form_for(model, as: "#{params.dig(:kono_utils, :structure_nested)}[#{Time.now.to_i}]", url: '#') do |form|
39
+ container = nil
40
+ simple_form_for(model, as: "#{params.dig(:kono_utils, :structure_nested)}[#{Time.now.to_i}]", url: '#') do |form|
40
41
 
41
- container = concept("cell/forms/fields/nested_modal_wrappers/show", model,
42
- show_remove_button: true,
43
- layout: layout_ns("cell/forms/fields/nested_wrappers/forms/layout"),
44
- context: {
45
- form: form,
46
- base_class: base_class,
47
- nested_layout: nested_layout,
48
- current_user: context[:current_user]
49
- }.merge(remote_context)
50
- )
42
+ container = concept("cell/forms/fields/nested_modal_wrappers/show", model,
43
+ show_remove_button: true,
44
+ layout: layout_ns("cell/forms/fields/nested_wrappers/forms/layout"),
45
+ context: {
46
+ form: form,
47
+ base_class: base_class,
48
+ nested_layout: nested_layout,
49
+ current_user: context[:current_user]
50
+ }.merge(remote_context)
51
+ )
51
52
 
52
- end
53
-
54
- container
55
-
56
- else
57
- if inject_as_modal?
58
-
59
- concept("cell/modals/container",
60
- concept("cell/form", model,
61
- form_options: {remote: true},
62
- context: {
63
- nested_layout: nested_layout,
64
- modal_upgraded_target_container: params.dig(:kono_utils, :modal_upgraded_target_container)
65
- }.merge(context)),
66
- layout: model.class.layout_ns("cell/modals/containers/layout")
67
- )
68
-
69
- else
70
- container = nil
71
- simple_form_for(model, as: "#{params.dig(:kono_utils, :structure_nested)}[#{Time.now.to_i}]", url: '#') do |form|
72
-
73
- container = concept("cell/forms/fields/nested_wrappers/form", model,
74
- show_remove_button: !inject_as_modal?, #per le modal non visualizziamo direttamente il bottone
75
- layout: form_layout,
76
- context: {
77
- form: form,
78
- base_class: base_class,
79
- current_user: context[:current_user]
80
- }.merge(remote_context)
81
- )
53
+ end
82
54
 
83
- end
55
+ container
84
56
 
85
- container
57
+ else
58
+ if inject_as_modal?
86
59
 
60
+ concept("cell/modals/container",
61
+ concept("cell/form", model,
62
+ form_options: { remote: true },
63
+ context: {
64
+ nested_layout: nested_layout,
65
+ modal_upgraded_target_container: params.dig(:kono_utils, :modal_upgraded_target_container)
66
+ }.merge(context)),
67
+ layout: model.class.layout_ns("cell/modals/containers/layout")
68
+ )
69
+
70
+ else
71
+ container = nil
72
+ simple_form_for(model, as: "#{params.dig(:kono_utils, :structure_nested)}[#{Time.now.to_i}]", url: '#') do |form|
73
+
74
+ container = concept("cell/forms/fields/nested_wrappers/form", model,
75
+ show_remove_button: !inject_as_modal?, #per le modal non visualizziamo direttamente il bottone
76
+ layout: form_layout,
77
+ context: {
78
+ form: form,
79
+ base_class: base_class,
80
+ current_user: context[:current_user]
81
+ }.merge(remote_context)
82
+ )
83
+
84
+ end
85
+
86
+ container
87
+
88
+ end
89
+ end
87
90
  end
88
- end
89
- end
90
-
91
91
 
92
- def target_container
93
- if options.fetch(:inject_show_modal, false)
94
- "##{params.dig(:kono_utils, :modal_upgraded_target_container)}"
95
- else
96
- params.dig(:kono_utils, :target_container)
97
- end
98
- end
92
+ def target_container
93
+ if options.fetch(:inject_show_modal, false)
94
+ "##{params.dig(:kono_utils, :modal_upgraded_target_container)}"
95
+ else
96
+ params.dig(:kono_utils, :target_container)
97
+ end
98
+ end
99
99
 
100
- def html_manipulation_method
101
- methodo = options.fetch(:html_manipulation_method, :append).to_sym
102
- raise "METODI DI MANIPOLAZIONE ACCETTATI: :append, :prepend, :replaceWith" unless [:append, :prepend, :replaceWith].include?(methodo)
103
- methodo
104
- end
100
+ def html_manipulation_method
101
+ methodo = options.fetch(:html_manipulation_method, :append).to_sym
102
+ raise "METODI DI MANIPOLAZIONE ACCETTATI: :append, :prepend, :replaceWith" unless [:append, :prepend, :replaceWith].include?(methodo)
103
+ methodo
104
+ end
105
105
 
106
- def inject_as_modal
107
- params.dig(:kono_utils, :inject_as_modal)
108
- end
106
+ def inject_as_modal
107
+ params.dig(:kono_utils, :inject_as_modal)
108
+ end
109
109
 
110
+ private
110
111
 
111
- private
112
+ def nested_layout
113
+ remote_context[:nested_layout].blank? ? "layout" : remote_context[:nested_layout]
114
+ end
112
115
 
113
- def nested_layout
114
- remote_context[:nested_layout].blank? ? "layout" : remote_context[:nested_layout]
115
- end
116
+ def inject_as_modal?
117
+ !inject_as_modal.blank?
118
+ end
116
119
 
117
- def inject_as_modal?
118
- !inject_as_modal.blank?
120
+ end
119
121
  end
120
-
121
122
  end
122
123
  end