kono_utils_bootstrap_view4 0.1.0.pre.rc.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/concepts/kono_utils/object/cell/base.rb +102 -96
- data/app/concepts/kono_utils/object/cell/buttons/base.rb +55 -54
- data/app/concepts/kono_utils/object/cell/buttons/collapse_search.rb +29 -23
- data/app/concepts/kono_utils/object/cell/buttons/create.rb +20 -15
- data/app/concepts/kono_utils/object/cell/buttons/delete.rb +29 -24
- data/app/concepts/kono_utils/object/cell/buttons/download.rb +22 -16
- data/app/concepts/kono_utils/object/cell/buttons/edit.rb +17 -12
- data/app/concepts/kono_utils/object/cell/buttons/list.rb +17 -11
- data/app/concepts/kono_utils/object/cell/buttons/reset_search.rb +21 -15
- data/app/concepts/kono_utils/object/cell/create/base.rb +6 -5
- data/app/concepts/kono_utils/object/cell/create/page_title.rb +11 -6
- data/app/concepts/kono_utils/object/cell/create/side_title.rb +8 -2
- data/app/concepts/kono_utils/object/cell/edits/base.rb +6 -5
- data/app/concepts/kono_utils/object/cell/edits/page_title.rb +11 -6
- data/app/concepts/kono_utils/object/cell/edits/side_title.rb +9 -3
- data/app/concepts/kono_utils/object/cell/form.rb +51 -48
- data/app/concepts/kono_utils/object/cell/forms/base.rb +12 -10
- data/app/concepts/kono_utils/object/cell/forms/container.rb +22 -18
- data/app/concepts/kono_utils/object/cell/forms/containers/layout.rb +14 -10
- data/app/concepts/kono_utils/object/cell/forms/containers/modal_layout.rb +10 -4
- data/app/concepts/kono_utils/object/cell/forms/containers/search_layout.rb +10 -4
- data/app/concepts/kono_utils/object/cell/forms/containers/table_layout.rb +11 -5
- data/app/concepts/kono_utils/object/cell/forms/field_selector.rb +68 -64
- data/app/concepts/kono_utils/object/cell/forms/field_selectors/layout.rb +9 -4
- data/app/concepts/kono_utils/object/cell/forms/field_selectors/modal_layout.rb +10 -4
- data/app/concepts/kono_utils/object/cell/forms/field_selectors/table_layout.rb +11 -5
- data/app/concepts/kono_utils/object/cell/forms/fields/association.rb +11 -4
- data/app/concepts/kono_utils/object/cell/forms/fields/base.rb +21 -16
- data/app/concepts/kono_utils/object/cell/forms/fields/bases/layout.rb +24 -17
- data/app/concepts/kono_utils/object/cell/forms/fields/bases/modal_layout.rb +14 -4
- data/app/concepts/kono_utils/object/cell/forms/fields/bases/table_layout.rb +17 -7
- data/app/concepts/kono_utils/object/cell/forms/fields/check_box.rb +14 -6
- data/app/concepts/kono_utils/object/cell/forms/fields/collection.rb +20 -12
- data/app/concepts/kono_utils/object/cell/forms/fields/date_field.rb +18 -10
- data/app/concepts/kono_utils/object/cell/forms/fields/date_time_field.rb +34 -30
- data/app/concepts/kono_utils/object/cell/forms/fields/enum.rb +23 -15
- data/app/concepts/kono_utils/object/cell/forms/fields/file_field.rb +29 -21
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_modal_wrapper.rb +10 -3
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_modal_wrappers/forms_container.rb +13 -5
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_modal_wrappers/show.rb +19 -10
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrapper.rb +54 -49
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/form.rb +41 -35
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms/layout.rb +17 -8
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms/modal_layout.rb +14 -4
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms/table_layout.rb +14 -4
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb +44 -36
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_containers/layout.rb +17 -10
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_containers/modal_layout.rb +17 -6
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_containers/table_layout.rb +20 -11
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/header.rb +31 -23
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_button.rb +46 -40
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_buttons/layout.rb +14 -7
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_buttons/modal_layout.rb +14 -4
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_buttons/table_layout.rb +14 -4
- data/app/concepts/kono_utils/object/cell/forms/fields/read_only.rb +16 -9
- data/app/concepts/kono_utils/object/cell/forms/fields/time_field.rb +14 -7
- data/app/concepts/kono_utils/object/cell/forms/layout.rb +8 -4
- data/app/concepts/kono_utils/object/cell/forms/submit.rb +21 -16
- data/app/concepts/kono_utils/object/cell/index/base.rb +9 -7
- data/app/concepts/kono_utils/object/cell/index/page_title.rb +11 -6
- data/app/concepts/kono_utils/object/cell/index/row.rb +38 -36
- data/app/concepts/kono_utils/object/cell/index/row_buttons.rb +8 -4
- data/app/concepts/kono_utils/object/cell/index/row_footer.rb +8 -3
- data/app/concepts/kono_utils/object/cell/index/row_header.rb +13 -7
- data/app/concepts/kono_utils/object/cell/index/side_title.rb +8 -2
- data/app/concepts/kono_utils/object/cell/index/table.rb +12 -9
- data/app/concepts/kono_utils/object/cell/inject.rb +103 -102
- data/app/concepts/kono_utils/object/cell/modals/base.rb +7 -3
- data/app/concepts/kono_utils/object/cell/modals/bodies/layout.rb +9 -4
- data/app/concepts/kono_utils/object/cell/modals/body.rb +7 -3
- data/app/concepts/kono_utils/object/cell/modals/container.rb +5 -1
- data/app/concepts/kono_utils/object/cell/modals/containers/layout.rb +12 -6
- data/app/concepts/kono_utils/object/cell/modals/footer.rb +5 -2
- data/app/concepts/kono_utils/object/cell/modals/footers/layout.rb +9 -4
- data/app/concepts/kono_utils/object/cell/modals/header.rb +6 -3
- data/app/concepts/kono_utils/object/cell/modals/headers/layout.rb +9 -4
- data/app/concepts/kono_utils/object/cell/search.rb +22 -19
- data/app/concepts/kono_utils/object/cell/searches/form.rb +12 -9
- data/app/concepts/kono_utils/object/cell/show.rb +25 -20
- data/app/concepts/kono_utils/object/cell/shows/base.rb +6 -5
- data/app/concepts/kono_utils/object/cell/shows/page_title.rb +11 -6
- data/app/concepts/kono_utils/object/cell/shows/side_title.rb +8 -2
- data/app/views/kono_utils/base_editing/edit.html.erb +3 -3
- data/app/views/kono_utils/base_editing/edit.inject.erb +1 -1
- data/app/views/kono_utils/base_editing/index.html.erb +4 -4
- data/app/views/kono_utils/base_editing/new.html.erb +3 -3
- data/app/views/kono_utils/base_editing/new.inject.erb +1 -1
- data/app/views/kono_utils/base_editing/show.html.erb +3 -3
- data/app/views/kono_utils/base_editing/success_create_show.inject.erb +1 -1
- data/app/views/kono_utils/base_editing/success_update_show.inject.erb +1 -1
- data/lib/kono_utils_bootstrap_view4.rb +14 -8
- data/lib/kono_utils_bootstrap_view4/engine.rb +0 -3
- data/lib/kono_utils_bootstrap_view4/version.rb +1 -1
- metadata +10 -18
data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_buttons/layout.rb
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
module KonoUtils
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_buttons/modal_layout.rb
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
module KonoUtils
|
|
2
|
-
|
|
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
|
data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_buttons/table_layout.rb
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
module KonoUtils
|
|
2
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
def show(&block)
|
|
14
|
+
render "forms/fields/base"
|
|
15
|
+
end
|
|
9
16
|
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
12
20
|
end
|
|
13
|
-
|
|
14
21
|
end
|
|
15
22
|
end
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
module KonoUtils
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
def btn_status_class
|
|
9
|
+
'btn-primary'
|
|
10
|
+
end
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
2
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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,11 +1,17 @@
|
|
|
1
|
-
module KonoUtils
|
|
2
|
-
|
|
1
|
+
module KonoUtils
|
|
2
|
+
module Object
|
|
3
|
+
module Cell
|
|
4
|
+
module Index # namespace
|
|
5
|
+
class RowHeader < Row # class
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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,15 +1,18 @@
|
|
|
1
|
-
module KonoUtils
|
|
2
|
-
|
|
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
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
def form_layout
|
|
26
|
+
layout_ns("cell/forms/fields/nested_wrappers/forms/#{nested_layout}")
|
|
27
|
+
end
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
39
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
+
kono_user: context[:kono_user]
|
|
50
|
+
}.merge(remote_context)
|
|
51
|
+
)
|
|
51
52
|
|
|
52
|
-
|
|
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
|
-
|
|
55
|
+
container
|
|
84
56
|
|
|
85
|
-
|
|
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
|
+
kono_user: context[:kono_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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
def inject_as_modal
|
|
107
|
+
params.dig(:kono_utils, :inject_as_modal)
|
|
108
|
+
end
|
|
109
109
|
|
|
110
|
+
private
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
def nested_layout
|
|
113
|
+
remote_context[:nested_layout].blank? ? "layout" : remote_context[:nested_layout]
|
|
114
|
+
end
|
|
112
115
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
def inject_as_modal?
|
|
117
|
+
!inject_as_modal.blank?
|
|
118
|
+
end
|
|
116
119
|
|
|
117
|
-
|
|
118
|
-
!inject_as_modal.blank?
|
|
120
|
+
end
|
|
119
121
|
end
|
|
120
|
-
|
|
121
122
|
end
|
|
122
123
|
end
|