kono_utils_bootstrap_view4 0.1.0.pre.rc.1
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +21 -0
- data/Rakefile +32 -0
- data/app/assets/config/kono_utils_bootstrap_view4_manifest.js +0 -0
- data/app/assets/javascripts/kono_utils_bootstrap_view4/application.js.erb +12 -0
- data/app/assets/javascripts/kono_utils_bootstrap_view4/kono_utils_bootstrap_view4.js +36 -0
- data/app/assets/stylesheets/kono_utils_bootstrap_view4/application.css.scss.erb +12 -0
- data/app/concepts/kono_utils/object/cell/base.rb +123 -0
- data/app/concepts/kono_utils/object/cell/buttons/base.rb +57 -0
- data/app/concepts/kono_utils/object/cell/buttons/collapse_search.rb +31 -0
- data/app/concepts/kono_utils/object/cell/buttons/create.rb +22 -0
- data/app/concepts/kono_utils/object/cell/buttons/delete.rb +32 -0
- data/app/concepts/kono_utils/object/cell/buttons/download.rb +23 -0
- data/app/concepts/kono_utils/object/cell/buttons/edit.rb +18 -0
- data/app/concepts/kono_utils/object/cell/buttons/list.rb +17 -0
- data/app/concepts/kono_utils/object/cell/buttons/reset_search.rb +21 -0
- data/app/concepts/kono_utils/object/cell/create/base.rb +8 -0
- data/app/concepts/kono_utils/object/cell/create/page_title.rb +10 -0
- data/app/concepts/kono_utils/object/cell/create/side_title.rb +5 -0
- data/app/concepts/kono_utils/object/cell/edits/base.rb +8 -0
- data/app/concepts/kono_utils/object/cell/edits/page_title.rb +10 -0
- data/app/concepts/kono_utils/object/cell/edits/side_title.rb +5 -0
- data/app/concepts/kono_utils/object/cell/form.rb +51 -0
- data/app/concepts/kono_utils/object/cell/forms/base.rb +13 -0
- data/app/concepts/kono_utils/object/cell/forms/container.rb +25 -0
- data/app/concepts/kono_utils/object/cell/forms/containers/layout.rb +16 -0
- data/app/concepts/kono_utils/object/cell/forms/containers/modal_layout.rb +7 -0
- data/app/concepts/kono_utils/object/cell/forms/containers/search_layout.rb +7 -0
- data/app/concepts/kono_utils/object/cell/forms/containers/table_layout.rb +8 -0
- data/app/concepts/kono_utils/object/cell/forms/field_selector.rb +77 -0
- data/app/concepts/kono_utils/object/cell/forms/field_selectors/layout.rb +7 -0
- data/app/concepts/kono_utils/object/cell/forms/field_selectors/modal_layout.rb +7 -0
- data/app/concepts/kono_utils/object/cell/forms/field_selectors/table_layout.rb +8 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/association.rb +7 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/base.rb +25 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/bases/layout.rb +24 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/bases/modal_layout.rb +7 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/bases/table_layout.rb +11 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/check_box.rb +10 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/collection.rb +17 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/date_field.rb +15 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/date_time_field.rb +51 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/enum.rb +20 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/file_field.rb +31 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_modal_wrapper.rb +6 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_modal_wrappers/forms_container.rb +9 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_modal_wrappers/show.rb +14 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrapper.rb +63 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/form.rb +38 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms/layout.rb +13 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms/modal_layout.rb +7 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms/table_layout.rb +7 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb +45 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_containers/layout.rb +15 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_containers/modal_layout.rb +9 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_containers/table_layout.rb +16 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/header.rb +31 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_button.rb +44 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_buttons/layout.rb +10 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_buttons/modal_layout.rb +7 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/remove_buttons/table_layout.rb +7 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/read_only.rb +15 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/time_field.rb +11 -0
- data/app/concepts/kono_utils/object/cell/forms/layout.rb +7 -0
- data/app/concepts/kono_utils/object/cell/forms/submit.rb +22 -0
- data/app/concepts/kono_utils/object/cell/index/base.rb +12 -0
- data/app/concepts/kono_utils/object/cell/index/page_title.rb +10 -0
- data/app/concepts/kono_utils/object/cell/index/row.rb +40 -0
- data/app/concepts/kono_utils/object/cell/index/row_buttons.rb +7 -0
- data/app/concepts/kono_utils/object/cell/index/row_footer.rb +6 -0
- data/app/concepts/kono_utils/object/cell/index/row_header.rb +11 -0
- data/app/concepts/kono_utils/object/cell/index/side_title.rb +5 -0
- data/app/concepts/kono_utils/object/cell/index/table.rb +15 -0
- data/app/concepts/kono_utils/object/cell/inject.rb +122 -0
- data/app/concepts/kono_utils/object/cell/modals/base.rb +6 -0
- data/app/concepts/kono_utils/object/cell/modals/bodies/layout.rb +7 -0
- data/app/concepts/kono_utils/object/cell/modals/body.rb +6 -0
- data/app/concepts/kono_utils/object/cell/modals/container.rb +24 -0
- data/app/concepts/kono_utils/object/cell/modals/containers/layout.rb +10 -0
- data/app/concepts/kono_utils/object/cell/modals/footer.rb +6 -0
- data/app/concepts/kono_utils/object/cell/modals/footers/layout.rb +7 -0
- data/app/concepts/kono_utils/object/cell/modals/header.rb +6 -0
- data/app/concepts/kono_utils/object/cell/modals/headers/layout.rb +7 -0
- data/app/concepts/kono_utils/object/cell/search.rb +27 -0
- data/app/concepts/kono_utils/object/cell/searches/form.rb +14 -0
- data/app/concepts/kono_utils/object/cell/show.rb +26 -0
- data/app/concepts/kono_utils/object/cell/shows/base.rb +8 -0
- data/app/concepts/kono_utils/object/cell/shows/page_title.rb +10 -0
- data/app/concepts/kono_utils/object/cell/shows/side_title.rb +5 -0
- data/app/concepts/kono_utils/object/view/create/side_title.erb +1 -0
- data/app/concepts/kono_utils/object/view/edits/side_title.erb +1 -0
- data/app/concepts/kono_utils/object/view/form.erb +9 -0
- data/app/concepts/kono_utils/object/view/forms/container.erb +5 -0
- data/app/concepts/kono_utils/object/view/forms/containers/layout.erb +3 -0
- data/app/concepts/kono_utils/object/view/forms/containers/modal_layout.erb +5 -0
- data/app/concepts/kono_utils/object/view/forms/containers/search_layout.erb +1 -0
- data/app/concepts/kono_utils/object/view/forms/containers/table_layout.erb +1 -0
- data/app/concepts/kono_utils/object/view/forms/field_selector.erb +1 -0
- data/app/concepts/kono_utils/object/view/forms/field_selectors/layout.erb +1 -0
- data/app/concepts/kono_utils/object/view/forms/field_selectors/modal_layout.erb +1 -0
- data/app/concepts/kono_utils/object/view/forms/field_selectors/table_layout.erb +1 -0
- data/app/concepts/kono_utils/object/view/forms/fields/association.erb +1 -0
- data/app/concepts/kono_utils/object/view/forms/fields/base.erb +1 -0
- data/app/concepts/kono_utils/object/view/forms/fields/bases/layout.erb +3 -0
- data/app/concepts/kono_utils/object/view/forms/fields/bases/layout.scss +25 -0
- data/app/concepts/kono_utils/object/view/forms/fields/bases/modal_layout.erb +3 -0
- data/app/concepts/kono_utils/object/view/forms/fields/bases/table_layout.erb +3 -0
- data/app/concepts/kono_utils/object/view/forms/fields/check_box.erb +1 -0
- data/app/concepts/kono_utils/object/view/forms/fields/collection.erb +1 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_modal_wrapper.erb +23 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_modal_wrappers/forms_container.erb +12 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_modal_wrappers/show.erb +28 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrapper.erb +18 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/form.erb +17 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/forms/layout.erb +18 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/forms/modal_layout.erb +4 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/forms/table_layout.erb +4 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/forms_container.erb +11 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/forms_containers/layout.erb +3 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/forms_containers/modal_layout.erb +3 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/forms_containers/table_layout.erb +14 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/header.erb +27 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/remove_button.erb +28 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/remove_buttons/layout.erb +1 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/remove_buttons/modal_layout.erb +1 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/remove_buttons/table_layout.erb +3 -0
- data/app/concepts/kono_utils/object/view/forms/layout.erb +1 -0
- data/app/concepts/kono_utils/object/view/index/row.erb +10 -0
- data/app/concepts/kono_utils/object/view/index/row_buttons.erb +2 -0
- data/app/concepts/kono_utils/object/view/index/row_footer.erb +0 -0
- data/app/concepts/kono_utils/object/view/index/row_header.erb +8 -0
- data/app/concepts/kono_utils/object/view/index/side_title.erb +1 -0
- data/app/concepts/kono_utils/object/view/index/table.erb +9 -0
- data/app/concepts/kono_utils/object/view/inject.erb +8 -0
- data/app/concepts/kono_utils/object/view/modals/bodies/layout.erb +3 -0
- data/app/concepts/kono_utils/object/view/modals/body.erb +1 -0
- data/app/concepts/kono_utils/object/view/modals/container.erb +13 -0
- data/app/concepts/kono_utils/object/view/modals/containers/layout.erb +7 -0
- data/app/concepts/kono_utils/object/view/modals/footer.erb +1 -0
- data/app/concepts/kono_utils/object/view/modals/footers/layout.erb +3 -0
- data/app/concepts/kono_utils/object/view/modals/header.erb +1 -0
- data/app/concepts/kono_utils/object/view/modals/headers/layout.erb +3 -0
- data/app/concepts/kono_utils/object/view/search.erb +40 -0
- data/app/concepts/kono_utils/object/view/searches/form.erb +16 -0
- data/app/concepts/kono_utils/object/view/show.erb +6 -0
- data/app/concepts/kono_utils/object/view/shows/side_title.erb +1 -0
- data/app/inputs/file_input_download_input.rb +22 -0
- data/app/inputs/tempus_dominus_input.rb +38 -0
- data/app/views/kaminari/_first_page.html.erb +3 -0
- data/app/views/kaminari/_gap.html.erb +3 -0
- data/app/views/kaminari/_last_page.html.erb +3 -0
- data/app/views/kaminari/_next_page.html.erb +3 -0
- data/app/views/kaminari/_page.html.erb +9 -0
- data/app/views/kaminari/_paginator.html.erb +17 -0
- data/app/views/kaminari/_prev_page.html.erb +3 -0
- data/app/views/kono_utils/base_editing/edit.html.erb +8 -0
- data/app/views/kono_utils/base_editing/edit.inject.erb +2 -0
- data/app/views/kono_utils/base_editing/index.html.erb +10 -0
- data/app/views/kono_utils/base_editing/new.html.erb +9 -0
- data/app/views/kono_utils/base_editing/new.inject.erb +2 -0
- data/app/views/kono_utils/base_editing/show.html.erb +8 -0
- data/app/views/kono_utils/base_editing/success_create_show.inject.erb +6 -0
- data/app/views/kono_utils/base_editing/success_update_show.inject.erb +6 -0
- data/config/initializers/kaminari_config.rb +30 -0
- data/config/initializers/simple_form.rb +179 -0
- data/config/initializers/simple_form_bootstrap.rb +439 -0
- data/config/locales/kono_utils_bootstrap4.en.yml +15 -0
- data/config/locales/kono_utils_bootstrap4.it.yml +15 -0
- data/config/locales/simple_form.en.yml +31 -0
- data/config/routes.rb +2 -0
- data/lib/generators/kono_utils_bootstrap_view4/concept/concept_generator.rb +79 -0
- data/lib/generators/kono_utils_bootstrap_view4/concept/templates/form.template +8 -0
- data/lib/generators/kono_utils_bootstrap_view4/concept/templates/forms/field_selector.template +13 -0
- data/lib/generators/kono_utils_bootstrap_view4/install/install_generator.rb +76 -0
- data/lib/generators/kono_utils_bootstrap_view4/install/templates/kono_utils_bootstrap_view4.js.erb.template +20 -0
- data/lib/generators/kono_utils_bootstrap_view4/install/templates/kono_utils_bootstrap_view4.template +5 -0
- data/lib/kono_utils_bootstrap_view4.rb +26 -0
- data/lib/kono_utils_bootstrap_view4/application_icon_helper.rb +31 -0
- data/lib/kono_utils_bootstrap_view4/base_class_concept_ns.rb +47 -0
- data/lib/kono_utils_bootstrap_view4/base_search.rb +5 -0
- data/lib/kono_utils_bootstrap_view4/configuration.rb +20 -0
- data/lib/kono_utils_bootstrap_view4/editable_field.rb +63 -0
- data/lib/kono_utils_bootstrap_view4/engine.rb +59 -0
- data/lib/kono_utils_bootstrap_view4/paginate_proxer.rb +11 -0
- data/lib/kono_utils_bootstrap_view4/search_form_builder.rb +14 -0
- data/lib/kono_utils_bootstrap_view4/version.rb +3 -0
- data/lib/tasks/kono_utils_bootstrap_view4_tasks.rake +4 -0
- data/lib/templates/erb/scaffold/_form.html.erb +15 -0
- metadata +391 -0
|
@@ -0,0 +1,22 @@
|
|
|
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
|
|
4
|
+
|
|
5
|
+
def btn_status_class
|
|
6
|
+
'btn-primary'
|
|
7
|
+
end
|
|
8
|
+
|
|
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
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module KonoUtils::Object::Cell::Index # namespace
|
|
2
|
+
class RowHeader < Row # class
|
|
3
|
+
|
|
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
|
|
9
|
+
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,122 @@
|
|
|
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
|
|
23
|
+
|
|
24
|
+
def form_layout
|
|
25
|
+
layout_ns("cell/forms/fields/nested_wrappers/forms/#{nested_layout}")
|
|
26
|
+
end
|
|
27
|
+
|
|
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
|
|
33
|
+
|
|
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)
|
|
37
|
+
|
|
38
|
+
container = nil
|
|
39
|
+
simple_form_for(model, as: "#{params.dig(:kono_utils, :structure_nested)}[#{Time.now.to_i}]", url: '#') do |form|
|
|
40
|
+
|
|
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
|
+
)
|
|
51
|
+
|
|
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
|
+
)
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
container
|
|
86
|
+
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
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
|
|
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
|
|
105
|
+
|
|
106
|
+
def inject_as_modal
|
|
107
|
+
params.dig(:kono_utils, :inject_as_modal)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
private
|
|
112
|
+
|
|
113
|
+
def nested_layout
|
|
114
|
+
remote_context[:nested_layout].blank? ? "layout" : remote_context[:nested_layout]
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def inject_as_modal?
|
|
118
|
+
!inject_as_modal.blank?
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
end
|
|
122
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module KonoUtils::Object::Cell # namespace
|
|
2
|
+
##
|
|
3
|
+
# Contenitore principale modal, come Model riceve un oggetto che rappresente il body da renderizzare che deve rispondere
|
|
4
|
+
# a to_s per restituire il contenuto del body e metodi to_footer e to_header per il contenuto degli altri componenti
|
|
5
|
+
# se l'oggetto non risponde a tali metodi, non visualizziamo nemmeno il componente header o footer.
|
|
6
|
+
class Modals::Container < Base
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
# Id per identificare il container che raggruppa campi e bottone per cancellare
|
|
11
|
+
def modal_container_id
|
|
12
|
+
@_unique ||= context[:modal_container_id] = SecureRandom.uuid
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def have_header?
|
|
16
|
+
model.respond_to? :to_header
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def have_footer?
|
|
20
|
+
model.respond_to? :to_footer
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module KonoUtils::Object::Cell # namespace
|
|
2
|
+
class Search < Base
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def collapse_container_id
|
|
6
|
+
dom_id(model, "search_form")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def data_loaded?
|
|
10
|
+
model.data_loaded?
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
##
|
|
14
|
+
# Identifica il contenitore dei bottoni, sia a livello di id DOM che per quanto riguarda la destinazione dei bottoni
|
|
15
|
+
# durante il renderig della form
|
|
16
|
+
def buttons_container
|
|
17
|
+
dom_id(model, 'buttons_container')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
##
|
|
21
|
+
# Andiamo a restituire il layout da utilizzare nel form
|
|
22
|
+
def form_layout
|
|
23
|
+
layout_ns("cell/forms/containers/search_layout")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
end
|