inline_forms 7.5.2 → 7.9.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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +110 -0
  3. data/README.rdoc +10 -0
  4. data/app/assets/javascripts/inline_forms/inline_forms.js +3 -10
  5. data/app/assets/stylesheets/inline_forms/inline_forms.scss +5 -4
  6. data/app/controllers/concerns/versions_concern.rb +0 -2
  7. data/app/controllers/inline_forms_controller.rb +76 -21
  8. data/app/helpers/inline_forms_helper.rb +42 -28
  9. data/app/views/inline_forms/_close.html.erb +9 -7
  10. data/app/views/inline_forms/_edit.html.erb +1 -1
  11. data/app/views/inline_forms/_list.html.erb +6 -21
  12. data/app/views/inline_forms/_new.html.erb +3 -5
  13. data/app/views/inline_forms/_show.html.erb +0 -26
  14. data/app/views/inline_forms/_versions.html.erb +5 -4
  15. data/app/views/inline_forms/_versions_list.html.erb +8 -8
  16. data/app/views/inline_forms/row_close.html.erb +10 -2
  17. data/app/views/inline_forms/versions_panel.html.erb +5 -2
  18. data/app/views/layouts/application.html.erb +2 -4
  19. data/app/views/layouts/inline_forms.html.erb +2 -5
  20. data/archived/README.md +47 -0
  21. data/archived/form_elements/README.md +27 -0
  22. data/archived/form_elements/chicas/README.md +31 -0
  23. data/archived/form_elements/geo_code_curacao/README.md +62 -0
  24. data/{app → archived/form_elements/geo_code_curacao/app}/helpers/form_elements/geo_code_curacao.rb +0 -1
  25. data/archived/form_elements/geo_code_curacao/app/views/geo_code_curacao/list_streets.html.erb +1 -0
  26. data/archived/form_elements/geo_code_curacao/app/views/geo_code_curacao/list_streets.js.erb +1 -0
  27. data/archived/form_elements/kansen_slider/README.md +31 -0
  28. data/archived/form_elements/tree/README.md +47 -0
  29. data/archived/form_elements/tree/app/views/inline_forms/_show_tree.html.erb +30 -0
  30. data/{app → archived/form_elements/tree/app}/views/inline_forms/_tree.html.erb +18 -5
  31. data/bin/inline_forms_installer_core.rb +70 -5
  32. data/docs/ujs-to-turbo.md +36 -37
  33. data/lib/generators/assets/stylesheets/inline_forms.scss +5 -4
  34. data/lib/inline_forms/archived_form_elements.rb +70 -0
  35. data/lib/inline_forms/version.rb +1 -1
  36. data/lib/inline_forms.rb +3 -1
  37. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_field_turbo_test.rb +6 -7
  38. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_name_required_test.rb +21 -0
  39. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_photos_pagination_test.rb +28 -0
  40. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_row_turbo_test.rb +14 -5
  41. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_top_level_new_test.rb +30 -60
  42. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_top_level_pagination_test.rb +40 -0
  43. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_versions_turbo_test.rb +93 -0
  44. data/lib/installer_templates/example_app_tests/test/integration/example_app_photo_revert_test.rb +94 -0
  45. data/lib/installer_templates/example_app_tests/test/integration/example_app_turbo_layout_test.rb +6 -9
  46. data/lib/installer_templates/example_app_tests/test/models/example_app_apartment_name_validation_test.rb +16 -0
  47. data/test/archived_form_elements_test.rb +41 -0
  48. data/test/form_element_from_callee_test.rb +2 -2
  49. metadata +25 -20
  50. data/app/views/geo_code_curacao/list_streets.html.erb +0 -1
  51. data/app/views/geo_code_curacao/list_streets.js.erb +0 -1
  52. data/app/views/inline_forms/close.js.erb +0 -4
  53. data/app/views/inline_forms/list.js.erb +0 -1
  54. data/app/views/inline_forms/new.js.erb +0 -1
  55. data/app/views/inline_forms/record_destroyed.js.erb +0 -1
  56. data/app/views/inline_forms/show.js.erb +0 -1
  57. data/app/views/inline_forms/show_undo.js.erb +0 -1
  58. data/app/views/inline_forms/versions.js.erb +0 -4
  59. data/app/views/inline_forms/versions_list.js.erb +0 -1
  60. /data/{app → archived/form_elements/chicas/app}/helpers/form_elements/chicas_dropdown_with_family_members.rb +0 -0
  61. /data/{app → archived/form_elements/chicas/app}/helpers/form_elements/chicas_family_photo_list.rb +0 -0
  62. /data/{app → archived/form_elements/chicas/app}/helpers/form_elements/chicas_photo_list.rb +0 -0
  63. /data/{app → archived/form_elements/geo_code_curacao/app}/controllers/geo_code_curacao_controller.rb +0 -0
  64. /data/{app → archived/form_elements/geo_code_curacao/app}/models/geo_code_curacao.rb +0 -0
  65. /data/{app → archived/form_elements/kansen_slider/app}/helpers/form_elements/kansen_slider.rb +0 -0
  66. /data/{app → archived/form_elements/tree/app}/helpers/form_elements/move.rb +0 -0
@@ -41,22 +41,9 @@
41
41
  <% end %>
42
42
  <% end %>
43
43
 
44
- <%#
45
- Container element. For the nested has_many case (parent_class set) we
46
- emit a `<turbo-frame>` so pagination clicks (and any future in-frame
47
- re-render of this list) swap only the matching frame instead of doing
48
- a full-page navigation. Top-level lists keep the classic `<div>` and
49
- full-page navigation; their `+ new` link is plain (no Turbo frame
50
- target) so cancel / create just navigate -- a top-level `<turbo-frame>`
51
- collapses inside `position: absolute` `#outer_container` and hides the
52
- list (regression hit during the 7.5.2 spike).
53
- -%>
44
+ <%# List root is `<turbo-frame class="list_container">` (Step 4). See SCSS. %>
54
45
  <% if ul_needed -%>
55
- <% if parent_class.nil? -%>
56
- <%= raw "<div class=\"list_container\" id=\"#{update_span}\">" -%>
57
- <% else -%>
58
- <%= raw "<turbo-frame id=\"#{update_span}\" class=\"list_container\">" -%>
59
- <% end -%>
46
+ <%= raw "<turbo-frame id=\"#{update_span}\" class=\"list_container\">" -%>
60
47
  <% end -%>
61
48
 
62
49
  <!-- # list of objects -->
@@ -123,7 +110,9 @@
123
110
  <% end -%>
124
111
  <!-- # pagination -->
125
112
  <% if parent_id.nil? -%>
126
- <% pagination = will_paginate objects -%>
113
+ <% paginate_params = { update: update_span, ul_needed: true } %>
114
+ <% paginate_params[:search] = params[:search] if params[:search].present? %>
115
+ <% pagination = will_paginate objects, params: paginate_params %>
127
116
  <% else %>
128
117
  <% if pagination %>
129
118
  <%#
@@ -155,9 +144,5 @@
155
144
  </div>
156
145
  <% end %>
157
146
  <% if ul_needed -%>
158
- <% if parent_class.nil? -%>
159
- <%= raw "</div>" -%>
160
- <% else -%>
161
- <%= raw "</turbo-frame>" -%>
162
- <% end -%>
147
+ <%= raw "</turbo-frame>" -%>
163
148
  <% end -%>
@@ -30,10 +30,8 @@
30
30
  </div>
31
31
 
32
32
  <% new_form_opts = { multipart: true, class: "edit_form" } %>
33
- <% if @turbo_frame %>
33
+ <% if @update_span.present? %>
34
34
  <% new_form_opts[:data] = { turbo: true, turbo_frame: @update_span } %>
35
- <% else %>
36
- <% new_form_opts[:remote] = true %>
37
35
  <% end %>
38
36
  <%= form_tag polymorphic_path(@Klass,
39
37
  update: @update_span,
@@ -42,7 +40,7 @@
42
40
  new_form_opts do -%>
43
41
  <% attributes = @inline_forms_attribute_list || @object.inline_forms_attribute_list -%>
44
42
  <% attributes.each do | attribute, name, form_element | -%>
45
- <% unless form_element.to_sym == :associated || form_element.to_sym == :tree || (cancan_enabled? && cannot?(:read, @object, attribute)) -%>
43
+ <% unless form_element.to_sym == :associated || (cancan_enabled? && cannot?(:read, @object, attribute)) -%>
46
44
  <% css_class_id = "attribute_#{attribute}_#{@object.id}" -%>
47
45
  <% if form_element && form_element.to_sym == :header %>
48
46
  <div class="row form_element_header" >
@@ -72,7 +70,7 @@
72
70
  parent_class: @parent_class,
73
71
  parent_id: @parent_id,
74
72
  ul_needed: true) %>
75
- <% cancel_opts = @turbo_frame ? inline_forms_turbo_link_data(@update_span) : { remote: true } %>
73
+ <% cancel_opts = @update_span.present? ? inline_forms_turbo_link_data(@update_span) : {} %>
76
74
  <%= link_to cancel_path, cancel_opts do -%>
77
75
  <input type="button" name="cancel" value="cancel" class="button alert" />
78
76
  <% end %>
@@ -30,31 +30,6 @@
30
30
  </div>
31
31
  </div>
32
32
  <% else %>
33
- <% if form_element == :tree -%>
34
- <div class="row form_element_header associated_auto_header" id="<%= css_class_id -%>_list_auto_header" >
35
- <div class='medium-11 large-11 column' >
36
- Children
37
- </div>
38
- <div class='medium-1 large-1 column'>
39
- <%= link_to_new_record(@object.class, "new_#{@object.class.to_s.underscore.singularize}_path", css_class_id, @object.class, @object.id) -%>
40
- </div>
41
- </div>
42
- <div class="row <%= cycle('odd', 'even') %>">
43
- <% if (INLINE_FORMS_TREE_INDENT rescue true) %>
44
- <div class='medium-1 large-1 column'>
45
- &nbsp;
46
- </div>
47
- <div id="<%= css_class_id -%>" class='small-11 column'>
48
- <% else %>
49
- <div id="<%= css_class_id -%>" class='small-12 column' >
50
- <% end %>
51
- <%= render :partial => "inline_forms/tree",
52
- :locals => { :parent_class => @object.class,
53
- :parent_id => @object.id,
54
- :attribute => attribute } %>
55
- </div>
56
- </div>
57
- <% else %>
58
33
  <% if form_element == :associated -%>
59
34
  <div class="row form_element_header associated_auto_header" id="<%= css_class_id -%>_list_auto_header" >
60
35
  <div class='medium-11 large-11 column' >
@@ -113,7 +88,6 @@
113
88
  </div>
114
89
  <% end %>
115
90
  <% end %>
116
- <% end %>
117
91
  <% end %>
118
92
  <% end %>
119
93
  <% end %>
@@ -1,12 +1,13 @@
1
- <% css_class_id = "#{@object.class.name.underscore}_#{@object.id}_versions" -%>
1
+ <% object = local_assigns[:object] || @object -%>
2
+ <% css_class_id = "#{object.class.name.underscore}_#{object.id}_versions" -%>
2
3
  <div class="row form_element_header associated_auto_header callout">
3
4
  <div class='medium-11 large-11 column' >
4
- <%= "Versions (#{@object.versions.length})" %>
5
+ <%= "Versions (#{object.versions.length})" %>
5
6
  </div>
6
7
  <div class='medium-1 large-1 column'>
7
8
  <%= link_to_versions_list(
8
- 'list_versions_' + @object.class.to_s.underscore + "_path",
9
- @object,
9
+ 'list_versions_' + object.class.to_s.underscore + "_path",
10
+ object,
10
11
  css_class_id
11
12
  )
12
13
  %>
@@ -45,14 +45,14 @@
45
45
  <% rich_text_name = entry[:rich_text_name] -%>
46
46
  <div class="row <%= cycle('odd', 'even') %>">
47
47
  <div class="small-1 column">
48
- <% if entry[:kind] == :primary %>
49
- <% row_id = "#{@object.class.name.underscore}_#{@object.id}" %>
50
- <%= link_to t("inline_forms.view.restore"),
51
- send("revert_#{@object.class.to_s.underscore}_path", version, update: row_id),
52
- inline_forms_turbo_link_data(row_id, method: :post) %>
53
- <% else %>
54
- &nbsp;
55
- <% end %>
48
+ <%# Restore is enabled for both :primary (object itself) and :rich_text
49
+ (ActionText::RichText hanging off @object). The revert route is
50
+ keyed by PaperTrail::Version id (global) and always targets the
51
+ parent's controller, so the same path works for both kinds. -%>
52
+ <% row_id = inline_forms_row_turbo_frame_id(@object) %>
53
+ <%= link_to t("inline_forms.view.restore"),
54
+ send("revert_#{@object.class.to_s.underscore}_path", version, update: row_id),
55
+ inline_forms_turbo_link_data(row_id, method: :post, turbo_stream: true) %>
56
56
  </div>
57
57
  <div class="small-1 column">
58
58
  <%= version.event -%><% if entry[:kind] == :rich_text %> <em>(rich text)</em><% end %>
@@ -1,5 +1,13 @@
1
- <turbo-frame id="<%= @update_span %>">
1
+ <% update_span = local_assigns[:update_span] || @update_span -%>
2
+ <% object = local_assigns[:object] || @object -%>
3
+ <% inline_forms_turbo_row = local_assigns.fetch(:inline_forms_turbo_row, @inline_forms_turbo_row) -%>
4
+ <turbo-frame id="<%= update_span %>">
2
5
  <div class="row odd top-level">
3
- <%= render partial: "inline_forms/close" %>
6
+ <%= render partial: "inline_forms/close",
7
+ locals: {
8
+ update_span: update_span,
9
+ object: object,
10
+ inline_forms_turbo_row: inline_forms_turbo_row
11
+ } %>
4
12
  </div>
5
13
  </turbo-frame>
@@ -1,3 +1,6 @@
1
- <turbo-frame id="<%= @update_span %>">
2
- <%= render partial: "inline_forms/versions" %>
1
+ <% update_span = local_assigns[:update_span] || @update_span -%>
2
+ <% object = local_assigns[:object] || @object -%>
3
+ <turbo-frame id="<%= update_span %>">
4
+ <%= render partial: "inline_forms/versions",
5
+ locals: { update_span: update_span, object: object } %>
3
6
  </turbo-frame>
@@ -15,12 +15,10 @@
15
15
  <%= yield %>
16
16
  <%= javascript_include_tag "application" %>
17
17
  <%# Turbo (Hotwire) is loaded as an ES module so it does not collide with %>
18
- <%# the classic-script Sprockets bundle above. Drive is disabled here so %>
19
- <%# existing UJS-driven links/forms keep working unchanged; `<turbo-frame>` %>
20
- <%# and `format.turbo_stream` remain available for per-view conversions. %>
18
+ <%# the classic-script Sprockets bundle above. Drive uses the Turbo default %>
19
+ <%# (enabled). %>
21
20
  <script type="module">
22
21
  import { Turbo } from "<%= asset_path('turbo.min.js') %>"
23
- Turbo.session.drive = false
24
22
  window.Turbo = Turbo
25
23
  </script>
26
24
  <%= javascript_include_tag "https://unpkg.com/trix@1.3.1/dist/trix.js" %>
@@ -28,13 +28,10 @@
28
28
  </div>
29
29
  <%= javascript_include_tag 'inline_forms/inline_forms' %>
30
30
  <%# Turbo (Hotwire) is loaded as an ES module so it does not collide with %>
31
- <%# the classic-script Sprockets bundle above (jquery_ujs etc.). Drive is %>
32
- <%# disabled here so existing UJS-driven links/forms keep working unchanged; %>
33
- <%# `<turbo-frame>` and `format.turbo_stream` are still available for the %>
34
- <%# per-view conversions that follow this slice. %>
31
+ <%# the classic-script Sprockets bundle above. Drive stays at the default %>
32
+ <%# (enabled); inline interactions use `<turbo-frame>` + HTML responses. %>
35
33
  <script type="module">
36
34
  import { Turbo } from "<%= asset_path('turbo.min.js') %>"
37
- Turbo.session.drive = false
38
35
  window.Turbo = Turbo
39
36
  </script>
40
37
  <%= javascript_include_tag "https://unpkg.com/trix@1.3.1/dist/trix.js" %>
@@ -0,0 +1,47 @@
1
+ # Archived and removed features
2
+
3
+ This directory is the **versioned archive** for inline_forms capabilities that are no longer loaded by default but may be restored if requirements change.
4
+
5
+ ## Catalog
6
+
7
+ | Symbol / feature | Status | Gem version | Location / notes |
8
+ |------------------|--------|-------------|------------------|
9
+ | `:geo_code_curacao` | **Archived** | **7.6.0** | [`form_elements/geo_code_curacao/`](form_elements/geo_code_curacao/) |
10
+ | `:chicas_photo_list`, `:chicas_family_photo_list`, `:chicas_dropdown_with_family_members` | **Archived** | **7.6.0** | [`form_elements/chicas/`](form_elements/chicas/) |
11
+ | `:kansen_slider` | **Archived** | **7.6.0** | [`form_elements/kansen_slider/`](form_elements/kansen_slider/) |
12
+ | `:tree`, `:move` | **Archived** | **7.7.0** | [`form_elements/tree/`](form_elements/tree/) — host `#children`, `#hash_tree_to_collection`, `#add_child` |
13
+ | `:absence_list` | **Removed** (source not in repo) | **6.3.0** | See [CHANGELOG](../CHANGELOG.md#630---2026-05-03); vendor from git history or app copy |
14
+
15
+ Programmatic registry: `InlineForms::ARCHIVED_FORM_ELEMENTS` in `lib/inline_forms.rb` (boot-time check if a model still declares an archived symbol).
16
+
17
+ ## Layout
18
+
19
+ ```
20
+ archived/
21
+ README.md ← this file
22
+ form_elements/
23
+ README.md ← how form-element archives work
24
+ <name>/
25
+ README.md ← restore steps for that element
26
+ app/ ← mirror of engine paths under app/
27
+ ```
28
+
29
+ Active form elements load from `app/helpers/form_elements/*.rb` only (top-level `*.rb` in that folder). Anything under `archived/` is **not** required automatically.
30
+
31
+ ## Restoring an archived form element
32
+
33
+ 1. Read `archived/form_elements/<name>/README.md`.
34
+ 2. Copy files from `archived/form_elements/<name>/app/` back into the gem’s `app/` tree (same relative paths).
35
+ 3. Re-add routes, DB tables, and assets described in that README.
36
+ 4. Remove the symbol from `InlineForms::ARCHIVED_FORM_ELEMENTS` (or leave it and remove the model reference only in your app).
37
+ 5. Bump your app/gem as needed; run tests.
38
+
39
+ ## Adding a new archive entry
40
+
41
+ When retiring a form element:
42
+
43
+ 1. Move its helper, and any dedicated model/controller/views, into `archived/form_elements/<name>/app/…`.
44
+ 2. Add `archived/form_elements/<name>/README.md` with dependencies, routes, Turbo/UJS status, and restore steps.
45
+ 3. Register it in `InlineForms::ARCHIVED_FORM_ELEMENTS`.
46
+ 4. Document in CHANGELOG under **Removed** or **Changed**.
47
+ 5. Update `docs/ujs-to-turbo.md` if the element had migration checklist items.
@@ -0,0 +1,27 @@
1
+ # Archived form elements
2
+
3
+ Form elements are Ruby files that define `#{name}_show`, `#{name}_edit`, and `#{name}_update` helpers. The engine loads them from:
4
+
5
+ ```ruby
6
+ Dir[File.dirname(__FILE__) + "/form_elements/*.rb"].each { |f| require f }
7
+ ```
8
+
9
+ Only **top-level** `app/helpers/form_elements/*.rb` files are loaded. Subdirectories (including this `archived/` tree) are ignored.
10
+
11
+ ## Why archive instead of delete?
12
+
13
+ - **Turbo migration:** Some elements (e.g. `:geo_code_curacao`) still depend on jQuery UI autocomplete and `*.js.erb` responses. Parking them avoids maintaining dead code paths in the active tree while keeping a known-good reference.
14
+ - **Rare domains:** Curaçao street geocoding or one-off project widgets may be needed again; restoration should be copy-paste plus README steps, not archaeology in git.
15
+
16
+ ## Per-element folders
17
+
18
+ Each subdirectory is named after the `params[:form_element]` / generator type symbol (e.g. `geo_code_curacao`).
19
+
20
+ Inside:
21
+
22
+ - `README.md` — purpose, DB schema, routes, generator usage, Turbo notes, restore checklist
23
+ - `app/` — snapshot of files that lived under the engine `app/` directory
24
+
25
+ ## Related: removed without archive copy
26
+
27
+ `:absence_list` was removed in **6.3.0** without a copy in this tree. See the main [archived README](../README.md) catalog and CHANGELOG.
@@ -0,0 +1,31 @@
1
+ # Chicas project form elements (archived)
2
+
3
+ **Archived in gem version:** 7.6.0
4
+ **Reason:** One-off widgets for a specific host application (“Chicas”). Comments in source stated they do not belong in the generic gem. No `_edit`/`_update` on photo lists; dropdown moves CarrierWave upload dirs via shell `mv`.
5
+
6
+ ## Symbols
7
+
8
+ | Symbol | File | Role |
9
+ |--------|------|------|
10
+ | `:chicas_photo_list` | `chicas_photo_list.rb` | Read-only gallery: `object.<members>.<photos>` by rating (attribute name encodes association path, e.g. `members_photos`) |
11
+ | `:chicas_family_photo_list` | `chicas_family_photo_list.rb` | Same via `object.family.<members>.<photos>` |
12
+ | `:chicas_dropdown_with_family_members` | `chicas_dropdown_with_family_members.rb` | Belongs-to style picker over `o.family.clients`; on update rehomes upload folder with `mkdir`/`mv` |
13
+
14
+ ## Host app requirements
15
+
16
+ - Models with `family`, `clients`, members, photos, CarrierWave `image`, `_dropdown_presentation`, etc. as assumed in the helpers.
17
+ - No generator `SPECIAL_COLUMN_TYPES` registration on photo lists (show-only).
18
+ - `:chicas_dropdown_with_family_members` registers `SPECIAL_COLUMN_TYPES[:dropdown]=:belongs_to` when loaded (same as stock dropdown).
19
+
20
+ ## Restore
21
+
22
+ ```bash
23
+ cp archived/form_elements/chicas/app/helpers/form_elements/chicas_*.rb \
24
+ app/helpers/form_elements/
25
+ ```
26
+
27
+ Remove the three symbols from `InlineForms::ARCHIVED_FORM_ELEMENTS` if restoring into the gem.
28
+
29
+ ## Turbo / UJS
30
+
31
+ Photo lists are display-only. Dropdown uses standard inline edit (UJS or Turbo field path depending on app). Re-init jQuery UI slider N/A for these files.
@@ -0,0 +1,62 @@
1
+ # `:geo_code_curacao` form element (archived)
2
+
3
+ **Archived in gem version:** 7.6.0
4
+ **Reason:** Curaçao-specific street geocoder tied to legacy MySQL tables (`Zones`, `Buurten`, `Straatcode`), jQuery UI autocomplete, and UJS `list_streets.js.erb`. Not used by the `--example` app; blocks clean Turbo/UJS removal while inactive.
5
+
6
+ ## What it did
7
+
8
+ - **Generator / model:** declare e.g. `address:geo_code_curacao` → string column storing a 6-digit zone/neighbourhood/street code.
9
+ - **Show:** human-readable `"Street, Zone"` via `GeoCodeCuracao#presentation`.
10
+ - **Edit:** text field + jQuery UI autocomplete hitting `GET /geo_code_curacao?term=…` (JSON labels).
11
+ - **Update:** parses six digits from submitted text, validates against `Straatcode`, stores code or `nil`.
12
+
13
+ ## Files in this archive
14
+
15
+ | Path under `app/` | Role |
16
+ |-------------------|------|
17
+ | `helpers/form_elements/geo_code_curacao.rb` | `_show` / `_edit` / `_update`; registers `SPECIAL_COLUMN_TYPES[:geo_code_curacao]=:string` |
18
+ | `models/geo_code_curacao.rb` | Lookup, validation, raw SQL autocomplete |
19
+ | `controllers/geo_code_curacao_controller.rb` | `list_streets` action |
20
+ | `views/geo_code_curacao/list_streets.js.erb` | Returns JSON for autocomplete (UJS/JS request) |
21
+ | `views/geo_code_curacao/list_streets.html.erb` | Unused HTML variant |
22
+
23
+ ## Host app requirements (when active)
24
+
25
+ 1. **Database:** MySQL (or compatible) with tables `Zones`, `Buurten`, `Straatcode` and legacy column names (`ZONECODE`, `NBRHCODE`, `STREETCODE`, `NAME`, …) as expected by `GeoCodeCuracao.lookup` and `Street.find_by_ZONECODE_and_NBRHCODE_and_STREETCODE`.
26
+ 2. **Routes** (not shipped by inline_forms installer; add to host `config/routes.rb`):
27
+
28
+ ```ruby
29
+ get "geo_code_curacao", to: "geo_code_curacao#list_streets"
30
+ ```
31
+
32
+ 3. **jQuery UI** autocomplete (already in `inline_forms.js` bundle when using stock assets).
33
+ 4. **Turbo note:** edit partial embeds inline `<script>` for `#geo_code_curacao` autocomplete; field swaps need `turbo:frame-load` re-init if you restore this on a Turbo field path (see `docs/ujs-to-turbo.md` geo section — archived as of 7.6.0).
34
+
35
+ ## Restore into the gem
36
+
37
+ ```bash
38
+ # From gem root
39
+ cp archived/form_elements/geo_code_curacao/app/helpers/form_elements/geo_code_curacao.rb \
40
+ app/helpers/form_elements/
41
+ cp archived/form_elements/geo_code_curacao/app/models/geo_code_curacao.rb \
42
+ app/models/
43
+ cp archived/form_elements/geo_code_curacao/app/controllers/geo_code_curacao_controller.rb \
44
+ app/controllers/
45
+ mkdir -p app/views/geo_code_curacao
46
+ cp archived/form_elements/geo_code_curacao/app/views/geo_code_curacao/* \
47
+ app/views/geo_code_curacao/
48
+ ```
49
+
50
+ Then remove `:geo_code_curacao` from `InlineForms::ARCHIVED_FORM_ELEMENTS` in `lib/inline_forms.rb` (optional if only your app uses it), document in CHANGELOG, and run the example app / host app tests.
51
+
52
+ ## Restore only in a host application (vendor)
53
+
54
+ Copy the same files into your app’s `app/` tree (adjust namespaces if you drop the engine). Remove the symbol from any `inline_forms_attribute_list` until files are in place. Prefer migrating to a modern geocoding field rather than restoring unless you still maintain the Curaçao street tables.
55
+
56
+ ## Generator usage (historical)
57
+
58
+ ```bash
59
+ rails g inline_forms Address street:geo_code_curacao
60
+ ```
61
+
62
+ After archive, the generator still accepts unknown types only with `--allow-unknown`; `:geo_code_curacao` is listed in `ARCHIVED_FORM_ELEMENTS` and will raise at boot if declared on a model.
@@ -22,4 +22,3 @@ def geo_code_curacao_update(object, attribute)
22
22
  geo_code = params[attribute].scan(/\d\d\d\d\d\d/).first || nil
23
23
  object[attribute.to_sym] = GeoCodeCuracao.new(geo_code).valid? ? geo_code : nil
24
24
  end
25
-
@@ -0,0 +1 @@
1
+ <%= @streets.each { |s| puts s} %>
@@ -0,0 +1,31 @@
1
+ # `:kansen_slider` form element (archived)
2
+
3
+ **Archived in gem version:** 7.6.0
4
+ **Reason:** Project-specific jQuery UI slider for integer-coded “kansen” (chance) scales. Uses inline `<script>` per field, `attribute_values(object, attribute)` on the model, and custom layout via `@BUTTONS_UNDER` in `_edit.html.erb` (removed from that list in 7.6.0).
5
+
6
+ ## Behavior
7
+
8
+ - **Show:** read-only jQuery UI slider when value is 1–5; otherwise plain label from `attribute_values`.
9
+ - **Edit:** interactive slider; updates hidden input and label on slide.
10
+ - **Update:** assigns integer from `params[:_<model>][attribute]`.
11
+ - **Migration:** `SPECIAL_COLUMN_TYPES[:kansen_slider]=:integer`.
12
+
13
+ ## Dependencies
14
+
15
+ - jQuery UI slider (in `inline_forms.js` bundle).
16
+ - Host model implements `attribute_values` for the attribute (see `InlineFormsHelper#attribute_values`).
17
+
18
+ ## Restore
19
+
20
+ ```bash
21
+ cp archived/form_elements/kansen_slider/app/helpers/form_elements/kansen_slider.rb \
22
+ app/helpers/form_elements/
23
+ ```
24
+
25
+ If you need OK/cancel buttons below the slider in edit forms, add `"kansen_slider"` back to `@BUTTONS_UNDER` in `app/views/inline_forms/_edit.html.erb`.
26
+
27
+ Remove `:kansen_slider` from `InlineForms::ARCHIVED_FORM_ELEMENTS` when restoring into the gem.
28
+
29
+ ## Turbo
30
+
31
+ Inline scripts must be re-bound on `turbo:frame-load` if used inside Turbo field frames (not done in archive).
@@ -0,0 +1,47 @@
1
+ # `:tree` form element + `:move` reparent helper (archived)
2
+
3
+ **Archived in gem version:** 7.7.0
4
+ **Reason:** Hierarchical child lists depend on host-app APIs that were never defined inside inline_forms (`#children`, `#hash_tree_to_collection`, `#add_child`). Typical integrations used an external tree gem (e.g. **awesome_nested_set**, **acts_as_tree**, or a custom concern). The example app has no tree model; keeping the partial active implied support the gem did not provide.
5
+
6
+ ## What it did
7
+
8
+ Declare in `inline_forms_attribute_list`, e.g. `[ :children, "Children", :tree ]`:
9
+
10
+ - **`_show.html.erb`:** header “Children”, `+` for new child, `<turbo-frame>` wrapping **`_tree.html.erb`**.
11
+ - **`_tree.html.erb`:** lists `parent.children` with Turbo row open, list-frame pagination (`update=…_list`).
12
+ - **`create`:** skips `:tree` attributes on the new-record form (like `:associated`).
13
+ - **`:move`:** separate form element (`move.rb`) to reparent a node via `hash_tree_to_collection` + `add_child` (host must implement both on the model class).
14
+
15
+ Top-level parents use `parent_id` **nil** on roots; children point at the parent record.
16
+
17
+ ## Files in this archive
18
+
19
+ | Path | Role |
20
+ |------|------|
21
+ | `app/views/inline_forms/_tree.html.erb` | Child list partial (Turbo frames, 7.7.0) |
22
+ | `app/helpers/form_elements/move.rb` | Reparent dropdown (`:move`) |
23
+ | `app/views/inline_forms/_show_tree.html.erb` | `_show` branch removed in 7.7.0 — paste back into `_show.html.erb` |
24
+
25
+ ## Host app requirements
26
+
27
+ 1. Self-referential model, e.g. `belongs_to :parent, class_name: "Outline", optional: true` and `has_many :children, class_name: "Outline", foreign_key: "parent_id"`.
28
+ 2. **`children`** scope/method returning child records (same class).
29
+ 3. For **`:move`:** class methods **`hash_tree_to_collection`** (options for select) and instance **`add_child(node)`** — historically copied from a host app using a tree gem, not implemented in inline_forms.
30
+ 4. Optional: **`INLINE_FORMS_TREE_INDENT`** constant (default true) for left spacer in `_show`.
31
+
32
+ ## Restore
33
+
34
+ ```bash
35
+ cp archived/form_elements/tree/app/views/inline_forms/_tree.html.erb \
36
+ app/views/inline_forms/
37
+ cp archived/form_elements/tree/app/helpers/form_elements/move.rb \
38
+ app/helpers/form_elements/
39
+ # Merge archived/form_elements/tree/app/views/inline_forms/_show_tree.html.erb
40
+ # into app/views/inline_forms/_show.html.erb (see comments in that fragment).
41
+ ```
42
+
43
+ Remove `:tree` and `:move` from `InlineForms::ARCHIVED_FORM_ELEMENTS` when restoring into the gem.
44
+
45
+ ## Turbo / UJS
46
+
47
+ Archive copy is the **7.7.0 Turbo** tree partial (frames + HTML row open). No `*.js.erb` row templates required when paired with current `InlineFormsController` row Turbo paths.
@@ -0,0 +1,30 @@
1
+ <%#
2
+ Paste into app/views/inline_forms/_show.html.erb in the non-header branch,
3
+ immediately before `<% if form_element == :associated -%>`, and keep the
4
+ trailing `<% else %>`. Archived 7.7.0 — see README.md.
5
+ -%>
6
+ <% if form_element == :tree -%>
7
+ <div class="row form_element_header associated_auto_header" id="<%= css_class_id -%>_list_auto_header" >
8
+ <div class='medium-11 large-11 column' >
9
+ Children
10
+ </div>
11
+ <div class='medium-1 large-1 column'>
12
+ <%= link_to_new_record(@object.class, "new_#{@object.class.to_s.underscore.singularize}_path", css_class_id, @object.class, @object.id) -%>
13
+ </div>
14
+ </div>
15
+ <div class="row <%= cycle('odd', 'even') %>">
16
+ <% if (INLINE_FORMS_TREE_INDENT rescue true) %>
17
+ <div class='medium-1 large-1 column'>
18
+ &nbsp;
19
+ </div>
20
+ <turbo-frame id="<%= css_class_id -%>" class="small-11 column">
21
+ <% else %>
22
+ <turbo-frame id="<%= css_class_id -%>" class="small-12 column">
23
+ <% end %>
24
+ <%= render :partial => "inline_forms/tree",
25
+ :locals => { :parent_class => @object.class,
26
+ :parent_id => @object.id,
27
+ :attribute => attribute } %>
28
+ </turbo-frame>
29
+ </div>
30
+ <% else %>
@@ -5,14 +5,17 @@
5
5
  <% objects = parent_class.find(parent_id).children %>
6
6
  <% objects = parent_class.find(parent_id).children.accessible_by(current_ability) if cancan_enabled? %>
7
7
  <% objects = objects.paginate :page => params[:page] %>
8
+ <% list_controller = parent_class.model_name.route_key %>
8
9
 
9
- <div class="list_container" id="<%= update_span %>">
10
+ <turbo-frame id="<%= update_span %>" class="list_container">
10
11
 
11
12
  <!-- # list of objects -->
12
13
  <% for object in objects %>
13
14
  <% css_class_id = parent_class.to_s.underscore + '_' + parent_id.to_s + '_' + attribute.to_s.singularize.underscore + "_" + object.id.to_s -%>
14
15
  <% path_to_object = parent_class.to_s.singularize.underscore + "_path" %>
15
- <div class="row <%= cycle('odd', 'even') %><%= " top-level" if parent_class.nil? %>" id="<%= css_class_id -%>">
16
+ <% row_open_link_opts = { data: { turbo: true, turbo_frame: css_class_id } } %>
17
+ <%= tag.turbo_frame(id: css_class_id) do %>
18
+ <div class="row <%= cycle('odd', 'even') %>">
16
19
  <% if cancan_disabled? || ( can? :delete, object ) %>
17
20
  <div class="small-1 column">
18
21
  <%= link_to_destroy(object, css_class_id) -%>
@@ -20,22 +23,31 @@
20
23
  <div class="small-11 column">
21
24
  <%= link_to h(object._presentation),
22
25
  send( path_to_object, object, :update => css_class_id),
23
- :remote => true -%>
26
+ row_open_link_opts -%>
24
27
  </div>
25
28
  <% else %>
26
29
  <div class="small-12 column">
27
30
  <%= link_to h(object._presentation),
28
31
  send( path_to_object, object, :update => css_class_id),
29
- :remote => true -%>
32
+ row_open_link_opts -%>
30
33
  </div>
31
34
  <% end %>
32
35
  </div>
36
+ <% end %>
33
37
  <% end -%>
34
38
  <!-- # pagination -->
35
39
  <% if parent_id.nil? -%>
36
40
  <% pagination = will_paginate objects -%>
37
41
  <% else %>
38
- <% pagination = will_paginate objects, :remote => true, :params => {:controller => attribute, :action => :index, :id => nil, :parent_class => parent_class, :parent_id => parent_id, :update => "#{parent_class.to_s.underscore}_#{parent_id}_#{attribute}", :ul_needed => true } -%>
42
+ <% pagination = will_paginate objects, params: {
43
+ controller: list_controller,
44
+ action: :index,
45
+ id: nil,
46
+ parent_class: parent_class,
47
+ parent_id: parent_id,
48
+ update: update_span,
49
+ ul_needed: true
50
+ } %>
39
51
  <% end %>
40
52
  <% if pagination %>
41
53
  <div class="row <%= cycle('odd', 'even') %>">
@@ -44,3 +56,4 @@
44
56
  </div>
45
57
  </div>
46
58
  <% end %>
59
+ </turbo-frame>