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.
- checksums.yaml +4 -4
- data/app/concepts/kono_utils/object/cell/base.rb +99 -97
- 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/lib/kono_utils_bootstrap_view4/version.rb +1 -1
- metadata +1 -1
@@ -1,38 +1,44 @@
|
|
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
|
-
|
1
|
+
module KonoUtils
|
2
|
+
module Object
|
3
|
+
module Cell
|
4
|
+
module Forms # namespace
|
5
|
+
module Fields
|
6
|
+
##
|
7
|
+
# Rappresenta la classe che renderizza il contenitore della singola nested form
|
8
|
+
##
|
9
|
+
class NestedWrappers::Form < Base
|
10
|
+
|
11
|
+
##
|
12
|
+
# Per i nested abbiamo un elenco di campi da visualizzare,
|
13
|
+
# questo elenco ci viene fornito tramite il modello EditableField dal nested_wrapper,
|
14
|
+
# il quale elabora rispetto ai nested delle policy, oppure direttamente dalla policy del model
|
15
|
+
def form_attributes
|
16
|
+
options[:form_attributes] || KonoUtilsBootstrapView4::EditableField.editable_fields_to_field_array(policy(model).editable_attributes)
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Visualizzare o meno il bottone di cancellazione
|
21
|
+
def show_remove_button?
|
22
|
+
options[:show_remove_button] || false
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Id per identificare il container che raggruppa campi e bottone per cancellare
|
27
|
+
def container_id
|
28
|
+
@_unique ||= context[:container_id] = SecureRandom.uuid
|
29
|
+
end
|
30
|
+
|
31
|
+
def container_layout
|
32
|
+
context[:nested_layout].blank? ? nil : layout_ns("cell/forms/containers/#{context[:nested_layout]}")
|
33
|
+
end
|
34
|
+
|
35
|
+
def remove_button_layout
|
36
|
+
context[:nested_layout].blank? ? nil : layout_ns("cell/forms/fields/nested_wrappers/remove_buttons/#{context[:nested_layout]}")
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
26
42
|
end
|
27
|
-
|
28
|
-
|
29
|
-
def container_layout
|
30
|
-
context[:nested_layout].blank? ? nil : layout_ns("cell/forms/containers/#{context[:nested_layout]}")
|
31
|
-
end
|
32
|
-
|
33
|
-
def remove_button_layout
|
34
|
-
context[:nested_layout].blank? ? nil : layout_ns("cell/forms/fields/nested_wrappers/remove_buttons/#{context[:nested_layout]}")
|
35
|
-
end
|
36
|
-
|
37
43
|
end
|
38
44
|
end
|
@@ -1,13 +1,22 @@
|
|
1
|
-
module KonoUtils
|
2
|
-
|
1
|
+
module KonoUtils
|
2
|
+
module Object
|
3
|
+
module Cell
|
4
|
+
module Forms # namespace
|
5
|
+
module Fields
|
3
6
|
|
4
|
-
|
5
|
-
context[:container_id] # generato dalla cella Form, trovare sistema più bello? FIXME
|
6
|
-
end
|
7
|
+
class NestedWrappers::Forms::Layout < Base
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
def container_id
|
10
|
+
context[:container_id] # generato dalla cella Form, trovare sistema più bello? FIXME
|
11
|
+
end
|
11
12
|
|
13
|
+
def object_header
|
14
|
+
form.object.class.model_name.human
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
12
21
|
end
|
13
22
|
end
|
@@ -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 Forms # 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
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module KonoUtils
|
2
|
+
module Object
|
3
|
+
module Cell
|
4
|
+
module Forms # namespace
|
5
|
+
module Fields
|
6
|
+
module NestedWrappers
|
7
|
+
module Forms # 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,45 +1,53 @@
|
|
1
|
-
module KonoUtils
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
module KonoUtils
|
2
|
+
module Object
|
3
|
+
module Cell
|
4
|
+
module Forms # namespace
|
5
|
+
module Fields
|
6
|
+
##
|
7
|
+
# Rappresenta la classe che renderizza il contenitore della singola nested form
|
8
|
+
#
|
9
|
+
# ** Options:
|
10
|
+
# - as_display_list -> Boolean che mi definisce se renderizzare come solo display la lista dei componenti
|
11
|
+
#
|
12
|
+
##
|
13
|
+
class NestedWrappers::FormsContainer < Base
|
10
14
|
|
11
|
-
|
15
|
+
delegates :parent_cell, :has_multiple_elements?
|
12
16
|
|
13
|
-
|
14
|
-
|
15
|
-
|
17
|
+
def parent_cell
|
18
|
+
context[:parent_cell]
|
19
|
+
end
|
16
20
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
# causa di una stranezza di simple form che non ritiene safe il contenuto passato
|
22
|
+
def inner_form_block
|
23
|
+
form.simple_fields_for(attribute_name, include_id: false) do |inside_form|
|
24
|
+
capture do
|
25
|
+
yield(inside_form)
|
26
|
+
end.html_safe
|
27
|
+
end
|
28
|
+
end
|
25
29
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
##
|
31
|
+
# Restituisce il nome della cella da renderizzare, è possibile che sia una form o la show
|
32
|
+
def render_cell_container
|
33
|
+
"cell/forms/fields/nested_wrappers/form"
|
34
|
+
end
|
31
35
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
##
|
37
|
+
# Per i nested abbiamo un elenco di campi da visualizzare,
|
38
|
+
# questo elenco ci viene fornito tramite il modello EditableField, il quale elabora rispetto ai nested delle policy
|
39
|
+
def inner_fields
|
40
|
+
model.inner_fields
|
41
|
+
end
|
38
42
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
+
def form_layout
|
44
|
+
layout = context[:nested_layout].blank? ? "layout" : context[:nested_layout]
|
45
|
+
layout_ns("cell/forms/fields/nested_wrappers/forms/#{layout}")
|
46
|
+
end
|
43
47
|
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
44
52
|
end
|
45
53
|
end
|
data/app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_containers/layout.rb
CHANGED
@@ -1,15 +1,22 @@
|
|
1
|
-
module KonoUtils
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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::FormsContainers::Layout < Base
|
7
11
|
|
8
|
-
|
12
|
+
delegates :parent_cell, :target_container_for_new_nested
|
9
13
|
|
10
|
-
|
11
|
-
|
12
|
-
|
14
|
+
def parent_cell
|
15
|
+
context[:parent_cell]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
13
20
|
end
|
14
21
|
end
|
15
22
|
end
|
@@ -1,9 +1,20 @@
|
|
1
|
-
module KonoUtils
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
module KonoUtils
|
2
|
+
module Object
|
3
|
+
module Cell
|
4
|
+
module Forms # namespace
|
5
|
+
module Fields
|
6
|
+
module NestedWrappers
|
7
|
+
module FormsContainers # namespace
|
8
|
+
##
|
9
|
+
# Rappresenta il layout del container del Wrapper
|
10
|
+
##
|
11
|
+
class ModalLayout < Layout
|
7
12
|
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
8
19
|
end
|
9
20
|
end
|
@@ -1,16 +1,25 @@
|
|
1
|
-
module KonoUtils
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
module KonoUtils
|
2
|
+
module Object
|
3
|
+
module Cell
|
4
|
+
module Forms # namespace
|
5
|
+
module Fields
|
6
|
+
module NestedWrappers
|
7
|
+
module FormsContainers # namespace
|
8
|
+
##
|
9
|
+
# Rappresenta il layout del container del Wrapper
|
10
|
+
# abbiamo la versione Standard e versione Table
|
11
|
+
##
|
12
|
+
class TableLayout < Layout
|
7
13
|
|
14
|
+
def columns_to_show
|
15
|
+
model.inner_fields.reject(&:is_hidden?)
|
16
|
+
end
|
8
17
|
|
9
|
-
|
10
|
-
|
11
|
-
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
12
23
|
end
|
13
|
-
|
14
|
-
|
15
24
|
end
|
16
25
|
end
|
@@ -1,31 +1,39 @@
|
|
1
|
-
module KonoUtils
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
module KonoUtils
|
2
|
+
module Object
|
3
|
+
module Cell
|
4
|
+
module Forms # namespace
|
5
|
+
module Fields
|
6
|
+
##
|
7
|
+
# Rappresenta la classe per la renderizzazione dell'header nel nested in modo da aggiungere o meno
|
8
|
+
# la gestione del bottone di aggiunta
|
9
|
+
class NestedWrappers::Header < Base
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
|
11
|
+
delegates :parent_cell, :reflection_association
|
12
|
+
delegates :parent_cell, :target_container_for_new_nested
|
13
|
+
delegates :parent_cell, :has_multiple_elements?
|
10
14
|
|
11
|
-
|
12
|
-
|
13
|
-
|
15
|
+
def parent_cell
|
16
|
+
context[:parent_cell]
|
17
|
+
end
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
##
|
20
|
+
# Controlla se dobbiamo renderizzare un bottone per fare la build di un nuovo record
|
21
|
+
# @return [TrueClass|FalseClass]
|
22
|
+
def build_new_nested?
|
23
|
+
has_multiple_elements? and form.object.persisted?
|
24
|
+
end
|
21
25
|
|
22
|
-
|
23
|
-
|
24
|
-
|
26
|
+
def target_container
|
27
|
+
inject_as_modal ? 'body' : "##{target_container_for_new_nested}"
|
28
|
+
end
|
25
29
|
|
26
|
-
|
27
|
-
|
28
|
-
|
30
|
+
def inject_as_modal
|
31
|
+
options[:inject_as_modal]
|
32
|
+
end
|
29
33
|
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
30
38
|
end
|
31
39
|
end
|
@@ -1,44 +1,50 @@
|
|
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
|
-
|
1
|
+
module KonoUtils
|
2
|
+
module Object
|
3
|
+
module Cell
|
4
|
+
module Forms # namespace
|
5
|
+
module Fields
|
6
|
+
##
|
7
|
+
# Bottone per la rimozione della riga nested
|
8
|
+
# *Options:*
|
9
|
+
# - ajax_remove: [Boolean] -> indica se vogliamo che venga veramente cancellato il record
|
10
|
+
class NestedWrappers::RemoveButton < KonoUtils::Object::Cell::Buttons::Delete
|
11
|
+
|
12
|
+
def url_to
|
13
|
+
if ajax_remove?
|
14
|
+
destroy_custom_polymorphic_path(model, format: :json)
|
15
|
+
else
|
16
|
+
"#"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# Controlla se questo record deve essere cancellato o meno via ajax
|
22
|
+
# @return [TrueClass, FalseClass]
|
23
|
+
def ajax_remove?
|
24
|
+
!!options.fetch(:ajax_remove, false)
|
25
|
+
end
|
26
|
+
|
27
|
+
def automatic_remove_options
|
28
|
+
if ajax_remove?
|
29
|
+
super.merge(remote: true)
|
30
|
+
else
|
31
|
+
{}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def show(&block)
|
36
|
+
super + render(&block).html_safe
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# ID div in cui definire che l'elemento viene rimosso
|
41
|
+
def remove_target
|
42
|
+
options[:remove_target]
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
29
47
|
end
|
30
48
|
end
|
31
|
-
|
32
|
-
def show(&block)
|
33
|
-
super + render(&block).html_safe
|
34
|
-
end
|
35
|
-
|
36
|
-
##
|
37
|
-
# ID div in cui definire che l'elemento viene rimosso
|
38
|
-
def remove_target
|
39
|
-
options[:remove_target]
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
49
|
end
|
44
50
|
end
|