inline_forms_installer 8.1.46 → 8.1.53
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/lib/inline_forms_installer/installer_core.rb +18 -3
- data/lib/inline_forms_installer/version.rb +1 -1
- data/lib/installer_templates/example_app_tests/test/integration/example_app_layout_title_test.rb +52 -0
- data/lib/installer_templates/example_app_tests/test/integration/example_app_schema_edit_test.rb +7 -0
- data/lib/installer_templates/example_app_tests/test/integration/example_app_showcase_file_slot_test.rb +102 -0
- data/lib/installer_templates/example_app_tests/test/models/example_app_form_element_showcase_test.rb +1 -0
- data/lib/installer_templates/example_app_views/inline_forms/_header.html.erb +3 -0
- data/lib/installer_templates/example_app_views/inline_forms/_model_top_bar_left.html.erb +6 -0
- metadata +4 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d6ae21066b6f0b20f52c9d8800b0e7bf580c2dbd3124c85f8521c47d7113ed98
|
|
4
|
+
data.tar.gz: 4e6d67961a89c567d52fb9efc82215eae83ebadc89c908556ed606a38268b316
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9c8cbab1fe17fd2f2c0041580a56936529c83310fd48f23df359f2f63e748bf1f5fa9aed85dd632eb42e95dadb8492ffb7410108eaefd3bec3dee609154a5c33
|
|
7
|
+
data.tar.gz: 934023b6ec6c9ab6314573134b330e46ffbb609be112f88135ae4efae97ceed073a443cd51c630310660c61b9aed19c9f3d6d142cb7e178f47fb0f862605782d
|
|
@@ -571,6 +571,15 @@ generate "paper_trail:install --with-changes"
|
|
|
571
571
|
# paper_trail emits two migrations in one second; the next generator would reuse that timestamp.
|
|
572
572
|
sleep 1
|
|
573
573
|
|
|
574
|
+
say "- File trash for declared file slots (simple_file_field)..."
|
|
575
|
+
# Tables for InlineForms::StoredFiles: removed/replaced files stay restorable
|
|
576
|
+
# for InlineForms.file_trash_retention (30 days) before the nightly sweep
|
|
577
|
+
# (`rails inline_forms:file_trash:purge_expired`, from cron) purges them.
|
|
578
|
+
# Plus the superadmin page listing every trashed file.
|
|
579
|
+
generate "inline_forms:file_trash"
|
|
580
|
+
sleep 1
|
|
581
|
+
route "InlineForms.draw_file_trash_routes(self)"
|
|
582
|
+
|
|
574
583
|
say "- Track ActionText (rich_text) edits with PaperTrail..."
|
|
575
584
|
# `has_rich_text :foo` stores the body in the separate `action_text_rich_texts`
|
|
576
585
|
# table, not on the parent model, so `has_paper_trail` on the parent never
|
|
@@ -649,6 +658,9 @@ PT_YAML
|
|
|
649
658
|
say "- Creating application title via locales..."
|
|
650
659
|
create_file "config/locales/inline_forms_local.en.yml", <<-END_LOCALE.strip_heredoc
|
|
651
660
|
en:
|
|
661
|
+
# <title> of every page in the inline_forms layout (falls back to
|
|
662
|
+
# ApplicationHelper#application_name in locales that do not define it).
|
|
663
|
+
application_name: #{app_name}
|
|
652
664
|
inline_forms:
|
|
653
665
|
general:
|
|
654
666
|
application_title: #{app_name}
|
|
@@ -847,11 +859,13 @@ copy_file File.join(INSTALLER_ROOT,'lib/installer_templates/unicorn/production.r
|
|
|
847
859
|
|
|
848
860
|
# Schema-change GUI (dev-only authoring; InlineForms::SchemaController from
|
|
849
861
|
# the inline_forms_schema_edit gem). Wired only when requested via
|
|
850
|
-
# `--schema-edit` (implied by `--example`): routes +
|
|
862
|
+
# `--schema-edit` (implied by `--example`): routes + batch tables. The
|
|
863
|
+
# "+ field" nav link is example-app only (example_app_views/inline_forms/
|
|
864
|
+
# _model_top_bar_left.html.erb), never in the engine's top bar.
|
|
851
865
|
# Applies inline_forms_addto through the browser; does NOT run db:migrate.
|
|
852
866
|
# Must precede the example section: its test gate exercises these routes.
|
|
853
867
|
if ENV['install_schema_edit'] == 'true'
|
|
854
|
-
say "- Schema GUI: routes +
|
|
868
|
+
say "- Schema GUI: routes + batch tables..."
|
|
855
869
|
# One line: the gem owns its route set, so gem upgrades can add routes
|
|
856
870
|
# without editing the app's routes.rb.
|
|
857
871
|
route 'InlineFormsSchemaEdit.draw_routes(self)'
|
|
@@ -1226,7 +1240,7 @@ if ENV['install_example'] == 'true'
|
|
|
1226
1240
|
# ---------------------------------------------------------------------
|
|
1227
1241
|
say "- Generating FormElementShowcase (one resource per kept Tier 1 form_element)..."
|
|
1228
1242
|
sleep 1
|
|
1229
|
-
run %q{bundle exec rails g inline_forms FormElementShowcase title:string body_plain_area:plain_text_area count:integer_field price:decimal_field amount:money_field latitude:decimal_field{9,6} longitude:decimal_field{10,6} meeting_date:date_select meeting_time:time_select birth_month:month_select start_month:month_year_picker is_active:check_box gender:radio_button rating_int:dropdown_with_integers priority:dropdown_with_values priority2:dropdown_with_values stars:dropdown_with_values_with_stars scale_int:scale_with_integers scale_val:scale_with_values attachment:file_field jingle:audio_field cover:image_field gallery:multi_image_field description:rich_text locales:has_and_belongs_to_many _enabled:yes _list_order:title _list_search:title _presentation:'#{title}'}
|
|
1243
|
+
run %q{bundle exec rails g inline_forms FormElementShowcase title:string body_plain_area:plain_text_area count:integer_field price:decimal_field amount:money_field latitude:decimal_field{9,6} longitude:decimal_field{10,6} meeting_date:date_select meeting_time:time_select birth_month:month_select start_month:month_year_picker is_active:check_box gender:radio_button rating_int:dropdown_with_integers priority:dropdown_with_values priority2:dropdown_with_values stars:dropdown_with_values_with_stars scale_int:scale_with_integers scale_val:scale_with_values attachment:file_field jingle:audio_field cover:image_field gallery:multi_image_field manual:simple_file_field description:rich_text locales:has_and_belongs_to_many _enabled:yes _list_order:title _list_search:title _presentation:'#{title}'}
|
|
1230
1244
|
|
|
1231
1245
|
say "- Generating Attachment + Jingle uploaders (Cover reuses ImageUploader)..."
|
|
1232
1246
|
run "bundle exec rails generate uploader Attachment"
|
|
@@ -1385,6 +1399,7 @@ if ENV['install_example'] == 'true'
|
|
|
1385
1399
|
jingle: Jingle
|
|
1386
1400
|
cover: Cover
|
|
1387
1401
|
gallery: Gallery (multiple images)
|
|
1402
|
+
manual: Manual (file slot with trash)
|
|
1388
1403
|
description: Description
|
|
1389
1404
|
locales: Locales (editable)
|
|
1390
1405
|
locales_display: Locales (read-only)
|
data/lib/installer_templates/example_app_tests/test/integration/example_app_layout_title_test.rb
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../example_app/example_integration_test_case"
|
|
4
|
+
|
|
5
|
+
# layouts/inline_forms <title> (inline_forms 8.1.53): the installer writes
|
|
6
|
+
# `application_name` into config/locales/inline_forms_local.en.yml, and the
|
|
7
|
+
# layout falls back to ApplicationHelper#application_name, so the title is
|
|
8
|
+
# "<app name> v<version>" — never the html_safe translation_missing span.
|
|
9
|
+
class ExampleAppLayoutTitleTest < ExampleAppIntegrationTestCase
|
|
10
|
+
def page_title
|
|
11
|
+
@response.body[%r{<title>(.*?)</title>}m, 1]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def expected_title
|
|
15
|
+
"#{ERB::Util.h(ApplicationController.helpers.application_name)} v#{InlineForms::VERSION}"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
test "installer defines the en application_name translation" do
|
|
19
|
+
assert I18n.exists?(:application_name, :en)
|
|
20
|
+
assert_equal ApplicationController.helpers.application_name, I18n.t(:application_name, locale: :en)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
test "apartments page title is the app name and version" do
|
|
24
|
+
get apartments_path
|
|
25
|
+
|
|
26
|
+
assert_response :success
|
|
27
|
+
assert_equal expected_title, page_title
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
test "file trash page title is the app name and version" do
|
|
31
|
+
get "/file_trash"
|
|
32
|
+
|
|
33
|
+
assert_response :success
|
|
34
|
+
assert_equal expected_title, page_title
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
test "title in nl falls back to the app name, not a placeholder" do
|
|
38
|
+
admin = User.find_by!(email: "admin@example.com")
|
|
39
|
+
nl = Locale.find_or_create_by!(name: "nl") { |l| l.title = "Nederlands" }
|
|
40
|
+
admin.update!(locale: nl)
|
|
41
|
+
sign_in admin
|
|
42
|
+
|
|
43
|
+
get apartments_path
|
|
44
|
+
|
|
45
|
+
assert_response :success
|
|
46
|
+
assert_includes @response.body, %(<html lang="nl">)
|
|
47
|
+
assert_equal expected_title, page_title
|
|
48
|
+
ensure
|
|
49
|
+
en = Locale.find_by(name: "en")
|
|
50
|
+
admin&.update!(locale: en) if en
|
|
51
|
+
end
|
|
52
|
+
end
|
data/lib/installer_templates/example_app_tests/test/integration/example_app_schema_edit_test.rb
CHANGED
|
@@ -16,6 +16,13 @@ class ExampleAppSchemaEditTest < ExampleAppIntegrationTestCase
|
|
|
16
16
|
assert_includes @response.body, "text_field"
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
test "the example app's top bar links the schema GUI" do
|
|
20
|
+
get apartments_path
|
|
21
|
+
assert_response :success
|
|
22
|
+
assert_includes @response.body, %(href="/schema/new")
|
|
23
|
+
assert_includes @response.body, "+ field"
|
|
24
|
+
end
|
|
25
|
+
|
|
19
26
|
test "schema/preview shows a new scalar field on Apartment without changing the schema" do
|
|
20
27
|
refute_includes Apartment.column_names, "staff_note",
|
|
21
28
|
"precondition: staff_note must not already exist"
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../example_app/example_integration_test_case"
|
|
4
|
+
|
|
5
|
+
# FormElementShowcase#manual is a declared file slot (generated from
|
|
6
|
+
# `manual:simple_file_field`: InlineForms::StoredFiles, manual_data /
|
|
7
|
+
# manual_content_type columns, InlineForms.file_routes in routes.rb, the
|
|
8
|
+
# inline_forms:file_trash migration). Exercises the generated wiring end to
|
|
9
|
+
# end as the superadmin: upload, replace, remove, undo, purge, the global
|
|
10
|
+
# trash page, and that reverting an unrelated edit keeps the file.
|
|
11
|
+
class ExampleAppShowcaseFileSlotTest < ExampleAppIntegrationTestCase
|
|
12
|
+
PDF = "%PDF-1.4 example file slot".b
|
|
13
|
+
OTHER = "%PDF-1.4 a different file".b
|
|
14
|
+
|
|
15
|
+
setup do
|
|
16
|
+
@showcase = FormElementShowcase.create!(title: "File slot demo")
|
|
17
|
+
@frame = "form_element_showcase_#{@showcase.id}_manual"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def upload(bytes, name)
|
|
21
|
+
Rack::Test::UploadedFile.new(StringIO.new(bytes), "application/pdf", original_filename: name)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def put_manual(bytes, name)
|
|
25
|
+
patch form_element_showcase_path(@showcase, attribute: "manual", form_element: "simple_file_field", update: @frame),
|
|
26
|
+
params: { manual: upload(bytes, name) }, headers: { "Turbo-Frame" => @frame }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def stream_headers
|
|
30
|
+
{ "Turbo-Frame" => @frame, "Accept" => "text/vnd.turbo-stream.html" }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
test "the generated model declares the slot and skips it in PaperTrail" do
|
|
34
|
+
assert FormElementShowcase.inline_forms_file_slot?(:manual)
|
|
35
|
+
assert_includes FormElementShowcase.paper_trail_options[:skip], "manual_data"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
test "upload, replace, remove, undo and purge" do
|
|
39
|
+
put_manual(PDF, "first.pdf")
|
|
40
|
+
assert_response :success
|
|
41
|
+
assert_equal PDF, @showcase.reload.manual_data
|
|
42
|
+
|
|
43
|
+
put_manual(OTHER, "second.pdf")
|
|
44
|
+
assert_equal OTHER, @showcase.reload.manual_data
|
|
45
|
+
replaced = InlineForms::TrashedFile.trash_entries.where(reason: "replaced").sole
|
|
46
|
+
assert_equal "first.pdf", replaced.filename
|
|
47
|
+
|
|
48
|
+
post remove_file_form_element_showcase_path(@showcase, attribute: "manual", update: @frame), headers: stream_headers
|
|
49
|
+
assert_response :success
|
|
50
|
+
assert_nil @showcase.reload.manual_data
|
|
51
|
+
removed = InlineForms::TrashedFile.trash_entries.where(reason: "removed").sole
|
|
52
|
+
|
|
53
|
+
post restore_file_form_element_showcase_path(@showcase, attribute: "manual", trash_id: removed.id, update: @frame),
|
|
54
|
+
headers: stream_headers
|
|
55
|
+
assert_equal OTHER, @showcase.reload.manual_data
|
|
56
|
+
|
|
57
|
+
post purge_file_form_element_showcase_path(@showcase, attribute: "manual", trash_id: replaced.id, update: @frame),
|
|
58
|
+
headers: stream_headers
|
|
59
|
+
assert replaced.reload.purged?
|
|
60
|
+
assert_nil replaced.file_data
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
test "download_file sends the stored bytes" do
|
|
64
|
+
put_manual(PDF, "first.pdf")
|
|
65
|
+
get download_file_form_element_showcase_path(@showcase, attribute: "manual")
|
|
66
|
+
|
|
67
|
+
assert_response :success
|
|
68
|
+
assert_equal PDF, response.body.b
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
test "reverting an unrelated edit keeps the file" do
|
|
72
|
+
put_manual(PDF, "first.pdf")
|
|
73
|
+
@showcase.update!(title: "Renamed")
|
|
74
|
+
version = @showcase.versions.where(event: "update").last
|
|
75
|
+
row = "form_element_showcase_#{@showcase.id}"
|
|
76
|
+
|
|
77
|
+
post revert_form_element_showcase_path(version, update: row),
|
|
78
|
+
headers: { "Turbo-Frame" => row, "Accept" => "text/vnd.turbo-stream.html" }
|
|
79
|
+
|
|
80
|
+
@showcase.reload
|
|
81
|
+
assert_equal "File slot demo", @showcase.title
|
|
82
|
+
assert_equal PDF, @showcase.manual_data
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
test "the global trash page renders for the superadmin" do
|
|
86
|
+
put_manual(PDF, "first.pdf")
|
|
87
|
+
post remove_file_form_element_showcase_path(@showcase, attribute: "manual", update: @frame), headers: stream_headers
|
|
88
|
+
|
|
89
|
+
get inline_forms_file_trash_path
|
|
90
|
+
assert_response :success
|
|
91
|
+
assert_includes response.body, "first.pdf"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
test "the user menu links the trash, next to logout" do
|
|
95
|
+
get form_element_showcases_path
|
|
96
|
+
assert_response :success
|
|
97
|
+
|
|
98
|
+
user_menu = response.body.scan(/<ul class="menu">(.*?)<\/ul>/m).flatten.find { |menu| menu.include?(destroy_user_session_path) }
|
|
99
|
+
assert user_menu, "no user menu with the logout link"
|
|
100
|
+
assert_includes user_menu, %(href="#{inline_forms_file_trash_path}")
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -39,6 +39,9 @@
|
|
|
39
39
|
<li>
|
|
40
40
|
<a href="#"><%= current_user.name %></a>
|
|
41
41
|
<ul class="menu">
|
|
42
|
+
<% if (trash_link = link_to_inline_forms_file_trash) %>
|
|
43
|
+
<li><%= trash_link %></li>
|
|
44
|
+
<% end %>
|
|
42
45
|
<li>
|
|
43
46
|
<%= link_to( t("common.logout"), destroy_user_session_path, :method => :delete) if current_user %>
|
|
44
47
|
</li>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<%# Example app only: link to the dev-only schema GUI (inline_forms_schema_edit). %>
|
|
2
|
+
<% if respond_to?(:inline_forms_schema_new_path) %>
|
|
3
|
+
<li class="menu-text">
|
|
4
|
+
<%= link_to "+ field", inline_forms_schema_new_path, data: { turbo: false }, title: "Add a field to a model (dev only)" %>
|
|
5
|
+
</li>
|
|
6
|
+
<% end %>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inline_forms_installer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.1.
|
|
4
|
+
version: 8.1.53
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ace Suares
|
|
@@ -98,6 +98,7 @@ files:
|
|
|
98
98
|
- lib/installer_templates/example_app_tests/test/integration/example_app_apartment_top_level_pagination_test.rb
|
|
99
99
|
- lib/installer_templates/example_app_tests/test/integration/example_app_apartment_versions_turbo_test.rb
|
|
100
100
|
- lib/installer_templates/example_app_tests/test/integration/example_app_guest_access_test.rb
|
|
101
|
+
- lib/installer_templates/example_app_tests/test/integration/example_app_layout_title_test.rb
|
|
101
102
|
- lib/installer_templates/example_app_tests/test/integration/example_app_owner_tabs_test.rb
|
|
102
103
|
- lib/installer_templates/example_app_tests/test/integration/example_app_photo_comments_test.rb
|
|
103
104
|
- lib/installer_templates/example_app_tests/test/integration/example_app_photo_revert_test.rb
|
|
@@ -107,6 +108,7 @@ files:
|
|
|
107
108
|
- lib/installer_templates/example_app_tests/test/integration/example_app_schema_edit_test.rb
|
|
108
109
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_choice_scale_fields_test.rb
|
|
109
110
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_date_time_fields_test.rb
|
|
111
|
+
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_file_slot_test.rb
|
|
110
112
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_gallery_test.rb
|
|
111
113
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_locales_associations_test.rb
|
|
112
114
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_money_update_test.rb
|
|
@@ -126,6 +128,7 @@ files:
|
|
|
126
128
|
- lib/installer_templates/example_app_tests/test/models/example_app_plain_text_rich_text_edge_cases_test.rb
|
|
127
129
|
- lib/installer_templates/example_app_views/apartments/name_list.html.erb
|
|
128
130
|
- lib/installer_templates/example_app_views/inline_forms/_header.html.erb
|
|
131
|
+
- lib/installer_templates/example_app_views/inline_forms/_model_top_bar_left.html.erb
|
|
129
132
|
- lib/installer_templates/example_app_views/owners/_owner_tabs.html.erb
|
|
130
133
|
- lib/installer_templates/example_app_views/owners/show_with_tabs.html.erb
|
|
131
134
|
- lib/installer_templates/unicorn/production.rb
|