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
|
@@ -1,32 +1,37 @@
|
|
|
1
|
-
module KonoUtils
|
|
2
|
-
|
|
1
|
+
module KonoUtils
|
|
2
|
+
module Object
|
|
3
|
+
module Cell
|
|
4
|
+
module Buttons # namespace
|
|
5
|
+
class Delete < Base
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
def url_to
|
|
8
|
+
options[:url_to] || destroy_custom_polymorphic_path(model)
|
|
9
|
+
end
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
def specific_button_class
|
|
12
|
+
'btn-danger'
|
|
13
|
+
end
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
def btn_opts(opts = {})
|
|
16
|
+
custom_options = options.dig(:button_options) || opts
|
|
17
|
+
super(automatic_remove_options.merge(custom_options))
|
|
18
|
+
end
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def button_content
|
|
27
|
-
options.fetch(:content, fa_icon("trash"))
|
|
28
|
-
end
|
|
20
|
+
##
|
|
21
|
+
# Metodo che è possibili fare override per rimuovere le funzioni di rails di conferma automatica
|
|
22
|
+
def automatic_remove_options
|
|
23
|
+
{
|
|
24
|
+
method: :delete,
|
|
25
|
+
data: { confirm: t(:are_you_sure), title: I18n.t('kono_utils.bootstrap4.buttons.delete.title') },
|
|
26
|
+
}
|
|
27
|
+
end
|
|
29
28
|
|
|
29
|
+
def button_content
|
|
30
|
+
options.fetch(:content, fa_icon("trash"))
|
|
31
|
+
end
|
|
30
32
|
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
31
36
|
end
|
|
32
37
|
end
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
module KonoUtils
|
|
2
|
-
|
|
1
|
+
module KonoUtils
|
|
2
|
+
module Object
|
|
3
|
+
module Cell
|
|
4
|
+
module Buttons # namespace
|
|
5
|
+
class Download < Base
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
def url_to
|
|
8
|
+
options[:url_to] || url_for(model)
|
|
9
|
+
end
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
def specific_button_class
|
|
12
|
+
'btn-light'
|
|
13
|
+
end
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
def button_content
|
|
16
|
+
options.fetch(:content, fa_icon("download", text: I18n.t('kono_utils.bootstrap4.buttons.download.alt')))
|
|
17
|
+
end
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
def btn_opts(opts = {})
|
|
20
|
+
{
|
|
21
|
+
target: :_blank
|
|
22
|
+
}.merge(super)
|
|
23
|
+
end
|
|
21
24
|
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
22
28
|
end
|
|
23
29
|
end
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
module KonoUtils
|
|
2
|
-
|
|
1
|
+
module KonoUtils
|
|
2
|
+
module Object
|
|
3
|
+
module Cell
|
|
4
|
+
module Buttons # namespace
|
|
5
|
+
class Edit < Base
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
def url_to
|
|
8
|
+
options[:url_to] || edit_custom_polymorphic_path(model)
|
|
9
|
+
end
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def button_content
|
|
13
|
-
options.fetch(:content, fa_icon("edit"))
|
|
14
|
-
end
|
|
11
|
+
def specific_button_class
|
|
12
|
+
'btn-primary'
|
|
13
|
+
end
|
|
15
14
|
|
|
15
|
+
def button_content
|
|
16
|
+
options.fetch(:content, fa_icon("edit"))
|
|
17
|
+
end
|
|
16
18
|
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
17
22
|
end
|
|
18
23
|
end
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
module KonoUtils
|
|
2
|
-
|
|
1
|
+
module KonoUtils
|
|
2
|
+
module Object
|
|
3
|
+
module Cell
|
|
4
|
+
module Buttons # namespace
|
|
5
|
+
class List < Base
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
def url_to
|
|
8
|
+
options[:url_to] || index_custom_polymorphic_path(model)
|
|
9
|
+
end
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
def specific_button_class
|
|
12
|
+
'btn-link'
|
|
13
|
+
end
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
def button_content
|
|
16
|
+
options.fetch(:content, fa_icon("list"))
|
|
17
|
+
end
|
|
15
18
|
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
16
22
|
end
|
|
17
23
|
end
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
module KonoUtils
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
module KonoUtils
|
|
2
|
+
module Object
|
|
3
|
+
module Cell
|
|
4
|
+
module Buttons # namespace
|
|
5
|
+
##
|
|
6
|
+
# Bottone per la struttura del collapse search
|
|
7
|
+
# *Options*
|
|
8
|
+
# - collapsed_target -> identificativo del contenitore che devo espandere
|
|
9
|
+
class ResetSearch < Base
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
def url_to
|
|
12
|
+
options[:url_to] || index_custom_polymorphic_path(model)
|
|
13
|
+
end
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
def specific_button_class
|
|
16
|
+
"btn-secondary"
|
|
17
|
+
end
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
def button_content
|
|
20
|
+
options.fetch(:content, fa_icon("times"))
|
|
21
|
+
end
|
|
19
22
|
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
20
26
|
end
|
|
21
27
|
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 Create
|
|
5
|
+
class PageTitle < Base
|
|
7
6
|
|
|
7
|
+
def show
|
|
8
|
+
title_new_g
|
|
9
|
+
end
|
|
8
10
|
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
9
14
|
end
|
|
10
15
|
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 Edits
|
|
5
|
+
class PageTitle < Base
|
|
7
6
|
|
|
7
|
+
def show
|
|
8
|
+
title_edit_g
|
|
9
|
+
end
|
|
8
10
|
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
9
14
|
end
|
|
10
15
|
end
|
|
@@ -1,51 +1,54 @@
|
|
|
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
|
-
|
|
1
|
+
module KonoUtils
|
|
2
|
+
module Object
|
|
3
|
+
module Cell
|
|
4
|
+
class Form < Base
|
|
5
|
+
|
|
6
|
+
load('action_view/helpers/form_helper.rb')
|
|
7
|
+
include ActionView::Helpers::FormHelper
|
|
8
|
+
include SimpleForm::ActionViewExtensions::FormHelper
|
|
9
|
+
include ActionView::Helpers::DateHelper
|
|
10
|
+
include ActionView::Helpers::FormOptionsHelper
|
|
11
|
+
|
|
12
|
+
layout("forms/layout")
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
# Metodo che mi ritorna la lista degli argomenti da passare a simple form.
|
|
16
|
+
# @return [Array]
|
|
17
|
+
#
|
|
18
|
+
# ES:
|
|
19
|
+
# [model] -> model deve essere l'ActiveRecord da utilizzare come oggetto della form
|
|
20
|
+
#
|
|
21
|
+
# [model,{ url:helper_path_custom }] -> come secondo parametro abbiamo l'hash delle opzioni da poter passare al form builder
|
|
22
|
+
# se al concept passiamo form_options come opzione, queste vengono mergiate nelle opzioni standard
|
|
23
|
+
def forms_options
|
|
24
|
+
[model, _form_options]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
protected
|
|
28
|
+
|
|
29
|
+
def form_id
|
|
30
|
+
dom_id(model, SecureRandom.uuid)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def container_layout
|
|
34
|
+
layout = context[:nested_layout].blank? ? "layout" : context[:nested_layout]
|
|
35
|
+
layout_ns("cell/forms/containers/#{layout}")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
##
|
|
41
|
+
# Opzioni aggiuntive per la form
|
|
42
|
+
def _form_options
|
|
43
|
+
opts = options[:form_options] || {}
|
|
44
|
+
html = opts.fetch(:html, { multipart: true })
|
|
45
|
+
html[:id] = form_id
|
|
46
|
+
|
|
47
|
+
opts.merge({ html: html })
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
24
52
|
end
|
|
25
|
-
|
|
26
|
-
protected
|
|
27
|
-
def form_id
|
|
28
|
-
dom_id(model, SecureRandom.uuid)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def container_layout
|
|
32
|
-
layout = context[:nested_layout].blank? ? "layout" : context[:nested_layout]
|
|
33
|
-
layout_ns("cell/forms/containers/#{layout}")
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
##
|
|
39
|
-
# Opzioni aggiuntive per la form
|
|
40
|
-
def _form_options
|
|
41
|
-
opts = options[:form_options] || {}
|
|
42
|
-
html = opts.fetch(:html, {multipart: true})
|
|
43
|
-
html[:id] = form_id
|
|
44
|
-
|
|
45
|
-
opts.merge({html: html})
|
|
46
|
-
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
|
|
50
53
|
end
|
|
51
54
|
end
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
module KonoUtils
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
module KonoUtils
|
|
2
|
+
module Object
|
|
3
|
+
module Cell
|
|
4
|
+
# La cella base dei componenti della form
|
|
5
|
+
# ha sempre un metodo form che viene ricevuto dal contesto della form
|
|
6
|
+
class Forms::Base < Base
|
|
7
|
+
|
|
8
|
+
def form
|
|
9
|
+
context[:form]
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
end
|
|
9
13
|
end
|
|
10
|
-
|
|
11
|
-
|
|
12
14
|
end
|
|
13
15
|
end
|