kono_utils_bootstrap_view4 0.1.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,26 @@
|
|
1
|
+
module KonoUtils::Object::Cell # namespace
|
2
|
+
class Show < Base
|
3
|
+
|
4
|
+
# @param field [KonoUtilsBootstrapView4::EditableField] campo da cui estrapolare il valore
|
5
|
+
def get_field(field)
|
6
|
+
model.send(field.name)
|
7
|
+
end
|
8
|
+
|
9
|
+
# @param field [KonoUtilsBootstrapView4::EditableField] campo da cui estrapolare la descrizione
|
10
|
+
def field_description(field)
|
11
|
+
model.class.han field.name
|
12
|
+
end
|
13
|
+
|
14
|
+
##
|
15
|
+
# Elenco dei campi da visualizzare, altrimenti estrapolati dalla policy
|
16
|
+
# @return [Array<KonoUtilsBootstrapView4::EditableField>]
|
17
|
+
def displayable_attributes
|
18
|
+
if options[:displayable_attributes]
|
19
|
+
KonoUtilsBootstrapView4::EditableField.editable_fields_to_field_array(options[:displayable_attributes])
|
20
|
+
else
|
21
|
+
KonoUtilsBootstrapView4::EditableField.editable_fields_to_field_array(policy(model).displayable_attributes)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= concept("cell/buttons/list", base_class) if policy(base_class.new).index? %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= concept("cell/buttons/list", base_class) if policy(base_class.new).index? %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= simple_form_for(*forms_options) do |f| %>
|
2
|
+
|
3
|
+
<%= concept("cell/forms/container", model, context: {form: f}, layout: container_layout) %>
|
4
|
+
|
5
|
+
<%= hidden_field_tag "kono_utils[form_id]", form_id %>
|
6
|
+
|
7
|
+
<%= concept("cell/forms/submit", nil, context: {form: f}) %>
|
8
|
+
|
9
|
+
<% end %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<%= hidden_field_tag 'kono_utils[target_container]', 'body' %>
|
2
|
+
<%= hidden_field_tag 'kono_utils[inject_as_modal]', 'true' %>
|
3
|
+
<%= hidden_field_tag 'kono_utils[modal_upgraded_target_container]', context[:modal_upgraded_target_container] %>
|
4
|
+
<%= hidden_field_tag 'kono_utils[context][nested_layout]', context[:nested_layout] %>
|
5
|
+
<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= get_field %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= form.association attribute_name, field_options %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= form.input attribute_name, field_options %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
.kono_utils-hidden {
|
2
|
+
display: none;
|
3
|
+
}
|
4
|
+
|
5
|
+
.kono_utils_nested_wrapper_header{
|
6
|
+
margin-bottom: 4px;
|
7
|
+
}
|
8
|
+
|
9
|
+
.kono_utils_nested_table {
|
10
|
+
tr.kono_utils_single_nested_container {
|
11
|
+
td {
|
12
|
+
vertical-align: top;
|
13
|
+
padding-bottom:10px;
|
14
|
+
.form-group{
|
15
|
+
margin-bottom: 0px;
|
16
|
+
}
|
17
|
+
label {
|
18
|
+
display: none;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
div.kono_utils_single_nested_container{
|
24
|
+
margin-bottom:10px;
|
25
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= form.input attribute_name, field_options %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= form.input attribute_name, field_options %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%= concept("cell/forms/fields/nested_wrappers/header", model,
|
2
|
+
inject_as_modal:true,
|
3
|
+
context: {
|
4
|
+
form: form,
|
5
|
+
parent_cell: self,
|
6
|
+
base_class: base_class,
|
7
|
+
nested_layout:'modal_layout'
|
8
|
+
}) %>
|
9
|
+
<%= concept("cell/forms/fields/nested_modal_wrappers/forms_container", model,
|
10
|
+
layout: forms_container_layout,
|
11
|
+
context: {
|
12
|
+
form: form,
|
13
|
+
base_class: base_class,
|
14
|
+
parent_cell: self
|
15
|
+
})
|
16
|
+
%>
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
data/app/concepts/kono_utils/object/view/forms/fields/nested_modal_wrappers/forms_container.erb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= inner_form_block do |inside_form| %>
|
2
|
+
<%= concept(render_cell_container, model,
|
3
|
+
form_attributes: inner_fields,
|
4
|
+
layout: form_layout,
|
5
|
+
show_remove_button: has_multiple_elements?,
|
6
|
+
context: {
|
7
|
+
form: inside_form,
|
8
|
+
base_class: base_class,
|
9
|
+
nested_layout: 'modal_layout'
|
10
|
+
}) %>
|
11
|
+
|
12
|
+
<% end %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<%= concept("cell/show", form.object) %>
|
2
|
+
|
3
|
+
<% content_for_layout :"remove_button_#{container_id}", concept("cell/forms/fields/nested_wrappers/remove_button", form.object,
|
4
|
+
remove_target: container_id,
|
5
|
+
layout: remove_button_layout,
|
6
|
+
ajax_remove: true,
|
7
|
+
context: {
|
8
|
+
form: form,
|
9
|
+
base_class: base_class,
|
10
|
+
}), flush: true if policy(form.object).destroy? and show_remove_button? %>
|
11
|
+
|
12
|
+
<% content_for_layout :"edit_button_#{container_id}", concept("cell/buttons/edit", base_class.new,
|
13
|
+
url_to: edit_custom_polymorphic_path(
|
14
|
+
[form.object.user, form.object],
|
15
|
+
format: options.fetch(:format, :inject),
|
16
|
+
kono_utils: {
|
17
|
+
inject_as_modal: true,
|
18
|
+
target_container: 'body',
|
19
|
+
modal_upgraded_target_container: container_id,
|
20
|
+
context: {nested_layout: 'modal_layout'}
|
21
|
+
}
|
22
|
+
),
|
23
|
+
button_options: {
|
24
|
+
class: "kono_utils_append_nested_object #{dom_class(base_class, dom_class(form.object, 'edit'))}",
|
25
|
+
remote: true
|
26
|
+
}
|
27
|
+
), flush: true %>
|
28
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= concept("cell/forms/fields/nested_wrappers/header", model, context: {form: form, parent_cell: self, base_class: base_class}) %>
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
<%= concept("cell/forms/fields/nested_wrappers/forms_container", model,
|
6
|
+
layout: forms_container_layout,
|
7
|
+
as_display_list: options[:as_display_list],
|
8
|
+
context: {
|
9
|
+
form: form,
|
10
|
+
base_class: base_class,
|
11
|
+
parent_cell: self
|
12
|
+
})
|
13
|
+
%>
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= concept("cell/forms/container", model,
|
2
|
+
form_attributes: form_attributes,
|
3
|
+
layout: container_layout,
|
4
|
+
context: {
|
5
|
+
form: form,
|
6
|
+
base_class: base_class,
|
7
|
+
overriden_layout: context[:nested_layout]
|
8
|
+
}
|
9
|
+
) %>
|
10
|
+
<% content_for_layout :"remove_button_#{container_id}", concept("cell/forms/fields/nested_wrappers/remove_button", form.object,
|
11
|
+
remove_target: container_id,
|
12
|
+
layout: remove_button_layout,
|
13
|
+
context: {
|
14
|
+
form: form,
|
15
|
+
base_class: base_class
|
16
|
+
}),flush:true if policy(form.object).destroy? and show_remove_button? %>
|
17
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<div class="kono_utils_single_nested_container" id="<%= container_id %>">
|
2
|
+
|
3
|
+
<div class="card">
|
4
|
+
<div class="card-header">
|
5
|
+
<%= object_header %>
|
6
|
+
</div>
|
7
|
+
<div class="card-body">
|
8
|
+
<%= yield %>
|
9
|
+
</div>
|
10
|
+
<% if content_for_layout? :"remove_button_#{container_id}" or content_for_layout? :"edit_button_#{container_id}" %>
|
11
|
+
<div class="card-footer text-right">
|
12
|
+
<%= content_for_layout :"remove_button_#{container_id}" if content_for_layout? :"remove_button_#{container_id}" %>
|
13
|
+
<%= content_for_layout :"edit_button_#{container_id}" if content_for_layout? :"edit_button_#{container_id}" %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
</div>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= inner_form_block do |inside_form| %>
|
2
|
+
<%= concept(render_cell_container, model,
|
3
|
+
form_attributes: inner_fields,
|
4
|
+
layout: form_layout,
|
5
|
+
show_remove_button: has_multiple_elements?,
|
6
|
+
context: {
|
7
|
+
form: inside_form,
|
8
|
+
base_class: base_class
|
9
|
+
}) %>
|
10
|
+
|
11
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<table class="kono_utils_nested_table table">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<% columns_to_show.each do |c| %>
|
5
|
+
<th><%= form.object.class.human_attribute_name(c.name) %></th>
|
6
|
+
<% end %>
|
7
|
+
<th></th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody class="kono_utils_nested_multi_container" id="<%= target_container_for_new_nested %>">
|
11
|
+
<%= yield %>
|
12
|
+
</tbody>
|
13
|
+
<tfoot></tfoot>
|
14
|
+
</table>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<div class="kono_utils_nested_wrapper_header">
|
2
|
+
|
3
|
+
<strong><%= form.label attribute_name %></strong>
|
4
|
+
|
5
|
+
<% if build_new_nested? %>
|
6
|
+
<% if policy(base_class.new).new? %>
|
7
|
+
<%= concept("cell/buttons/create", base_class.new,
|
8
|
+
url_to: new_custom_polymorphic_path(
|
9
|
+
[form.object, base_class.new],
|
10
|
+
format: options.fetch(:format, :inject),
|
11
|
+
kono_utils: {
|
12
|
+
inject_as_modal: inject_as_modal,
|
13
|
+
target_container: target_container,
|
14
|
+
structure_nested: "#{form.object_name}[#{attribute_name}_attributes]",
|
15
|
+
modal_upgraded_target_container: target_container_for_new_nested,
|
16
|
+
context: {nested_layout: context[:nested_layout]}
|
17
|
+
}
|
18
|
+
),
|
19
|
+
button_options: {
|
20
|
+
class: "kono_utils_append_nested_object #{dom_class(base_class, dom_class(form.object, 'create'))}",
|
21
|
+
remote: true
|
22
|
+
}
|
23
|
+
) %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
</div>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<script type="application/javascript">
|
2
|
+
|
3
|
+
(function (id_button, container_selector) {
|
4
|
+
var element = $(id_button)[0];
|
5
|
+
|
6
|
+
// in modalità ajax, utilizzando le chimate di rails, facciamo in modo di attendere gli eventi
|
7
|
+
<% if ajax_remove? %>
|
8
|
+
element.onclick = function (e) {
|
9
|
+
$(element).on("ajax:success", function (event) {
|
10
|
+
element.kono_utils_delete_container();
|
11
|
+
}).on("ajax:error", function (event) {
|
12
|
+
console.error("Destroy problems", arguments, event.detail[0]);
|
13
|
+
$(container_selector).trigger("error_during_container_deletion", [container_selector, event.detail[0], event]);
|
14
|
+
});
|
15
|
+
};
|
16
|
+
<% else %>
|
17
|
+
element.onclick = function (e) {
|
18
|
+
e.preventDefault();
|
19
|
+
this.kono_utils_delete_container();
|
20
|
+
};
|
21
|
+
<%end %>
|
22
|
+
|
23
|
+
element.kono_utils_delete_container = function () {
|
24
|
+
$(container_selector).hide().find('[type="hidden"][name$="[_destroy]"]').val('true');
|
25
|
+
$(container_selector).trigger("container_deleted", [$(container_selector)[0]]);
|
26
|
+
}
|
27
|
+
})("#<%= unique_dom_id %>", '#<%= remove_target %>');
|
28
|
+
</script>
|
data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/remove_buttons/layout.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
File without changes
|