inline_forms_installer 8.1.61 → 8.1.65

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c6f069c96fd0e7598a438f56447b8205baf15a35dd1a6bab0326df74e831bdf
4
- data.tar.gz: 9d289beb55c1ac15cd1ecd969f86962995f90dc7a4829965b5971e5454cc309e
3
+ metadata.gz: dcf1a3e74f85dca6e068bbcdaaa71099f1fc0b2e6507d4192e1305660c78b244
4
+ data.tar.gz: 5c20607e05a1ee5db7b1cc69bd979b94068e0d4f62e487391eb4cc151f3ceaea
5
5
  SHA512:
6
- metadata.gz: 010cf011587607315cbec7c5dd848adb6e400f2f1b78ed27c3e93f71c5a544e23bd568c07d6fdf07daa3e4204dd4786583ebd00c0938ccbaeffa3a109f2f018f
7
- data.tar.gz: a9cc8aaa125436c16f15cd9ae0eb9af5a55c044d7c0c0524eefd61496035cf041ed0fd044b0fedb52bbf9389a5a874a0dc3c2abed07806a8bfc4e1effde979e4
6
+ metadata.gz: f8bd143a0eb3fed6bb2427022847f991e1d8f3519dc30e1bf4c07c575fe1b7b72ab5c7c1f327440ac607f033e630b5a6684469170ecb282e67b7cfac5e3718f5
7
+ data.tar.gz: 85e195581364c3a4d9a6d360589c3b7fea2cc52f77d271abddd3b36b612e62eaaf210d4a8b0e9d7a977f3937a59c9cdbdb761751d64ac52d27a7a79b6b73b6f6
@@ -1417,6 +1417,30 @@ if ENV['install_example'] == 'true'
1417
1417
  "[ :description, :rich_text ], \n",
1418
1418
  "[ :description, :rich_text ], \n [ :locales, :check_list ], \n [ :locales_display, :info_list ], \n [ :header_meta, :header ], \n [ :created_at, :info ], \n [ :updated_at, :info ], \n"
1419
1419
 
1420
+ # pdf_link links to /report/:id and /report/:id.pdf and leaves both routes
1421
+ # to the app. There is no column and no model method.
1422
+ gsub_file "app/models/form_element_showcase.rb",
1423
+ "[ :manual, :simple_file_field ], \n",
1424
+ "[ :manual, :simple_file_field ], \n [ :report, :pdf_link ], \n"
1425
+ create_file "app/controllers/showcase_reports_controller.rb", <<-'SHOWCASE_REPORTS'.strip_heredoc
1426
+ # The two routes behind FormElementShowcase's :report pdf_link row.
1427
+ class ShowcaseReportsController < ApplicationController
1428
+ def show
1429
+ @showcase = FormElementShowcase.find(params[:id])
1430
+ authorize! :read, @showcase
1431
+
1432
+ respond_to do |format|
1433
+ format.html
1434
+ format.pdf do
1435
+ send_file Rails.root.join("db/seed_uploads/sample.pdf"),
1436
+ filename: "showcase_#{@showcase.id}.pdf", type: "application/pdf"
1437
+ end
1438
+ end
1439
+ end
1440
+ end
1441
+ SHOWCASE_REPORTS
1442
+ route 'get "report/:id", to: "showcase_reports#show", as: :showcase_report'
1443
+
1420
1444
  # Locale keys for the showcase attributes. Headers + the timestamps
1421
1445
  # need explicit labels so `human_attribute_name` does not fall back to
1422
1446
  # "Header basics" / "Created at". The leading two-space indent puts
@@ -1456,6 +1480,7 @@ if ENV['install_example'] == 'true'
1456
1480
  cover: Cover
1457
1481
  gallery: Gallery (multiple images)
1458
1482
  manual: Manual (file slot with trash)
1483
+ report: Report
1459
1484
  description: Description
1460
1485
  locales: Locales (editable)
1461
1486
  locales_display: Locales (read-only)
@@ -1478,7 +1503,7 @@ if ENV['install_example'] == 'true'
1478
1503
  # under db/seed_uploads so the seed migration can read them at
1479
1504
  # db:migrate time and store them through CarrierWave. Mirrors the
1480
1505
  # db/seed_images convention used for the Photo gallery seed above.
1481
- %w[sample.txt sample.wav sample_cover.png].each do |basename|
1506
+ %w[sample.txt sample.wav sample_cover.png sample.pdf].each do |basename|
1482
1507
  src = File.join(showcase_assets_root, basename)
1483
1508
  copy_file src, File.join("db/seed_uploads", basename) if File.exist?(src)
1484
1509
  end
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  module InlineFormsInstaller
4
- VERSION = "8.1.61"
4
+ VERSION = "8.1.65"
5
5
 
6
6
  # Canonical bare Ruby version (must match gemspec `required_ruby_version`).
7
7
  # Written verbatim into generated apps' `.ruby-version` for rbenv/chruby/asdf/
@@ -0,0 +1,32 @@
1
+ %PDF-1.4
2
+ 1 0 obj
3
+ << /Type /Catalog /Pages 2 0 R >>
4
+ endobj
5
+ 2 0 obj
6
+ << /Type /Pages /Kids [3 0 R] /Count 1 >>
7
+ endobj
8
+ 3 0 obj
9
+ << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>
10
+ endobj
11
+ 4 0 obj
12
+ << /Length 54 >>
13
+ stream
14
+ BT /F1 18 Tf 72 720 Td (inline_forms sample PDF) Tj ET
15
+ endstream
16
+ endobj
17
+ 5 0 obj
18
+ << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>
19
+ endobj
20
+ xref
21
+ 0 6
22
+ 0000000000 65535 f
23
+ 0000000009 00000 n
24
+ 0000000058 00000 n
25
+ 0000000115 00000 n
26
+ 0000000241 00000 n
27
+ 0000000345 00000 n
28
+ trailer
29
+ << /Size 6 /Root 1 0 R >>
30
+ startxref
31
+ 415
32
+ %%EOF
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../example_app/example_integration_test_case"
4
+ require Dir[Rails.root.join("db/migrate/*_seed_example_apartments_and_owners.rb")].first
5
+
6
+ # The seed's down: apartments.owner_id and phase_id have foreign keys, so the
7
+ # apartments are released before the owners and phases go.
8
+ class ExampleAppSeedRollbackTest < ExampleAppIntegrationTestCase
9
+ test "down removes the seed and keeps an apartment that is not seeded" do
10
+ seed = SeedExampleApartmentsAndOwners
11
+ owner = Owner.create!(name: seed::OWNERS.first[:name])
12
+ phase = Phase.create!(name: seed::PHASES.first[:name])
13
+ Apartment.create!(name: seed::APARTMENTS.first[:name], owner: owner, phase: phase)
14
+ other = Apartment.create!(name: "Not seeded", owner: owner, phase: phase)
15
+
16
+ seed.new.down
17
+
18
+ assert_not Owner.exists?(owner.id)
19
+ assert_not Phase.exists?(phase.id)
20
+ assert_not Apartment.exists?(name: seed::APARTMENTS.first[:name])
21
+ assert_nil other.reload.owner_id
22
+ assert_nil other.phase_id
23
+ end
24
+ end
@@ -31,6 +31,7 @@ class ExampleAppShowcasePageRenderTest < ExampleAppIntegrationTestCase
31
31
  attachment
32
32
  jingle
33
33
  cover
34
+ report
34
35
  description
35
36
  locales
36
37
  locales_display
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../example_app/example_integration_test_case"
4
+
5
+ # pdf_link links to /<attribute>/:id and /<attribute>/:id.pdf; the app owns
6
+ # both routes. The example app's are ShowcaseReportsController.
7
+ class ExampleAppShowcasePdfLinkTest < ExampleAppIntegrationTestCase
8
+ setup { @showcase = FormElementShowcase.create!(title: "Report demo") }
9
+
10
+ test "the show page has a preview and a pdf link that leave the turbo frame" do
11
+ get form_element_showcase_path(@showcase)
12
+
13
+ assert_response :success
14
+ assert_select %(a.pdf_preview[href="/report/#{@showcase.id}"][data-turbo="false"][target="_blank"])
15
+ assert_select %(a.pdf_open[href="/report/#{@showcase.id}.pdf"][data-turbo="false"])
16
+ assert_select %(a.pdf_open[target]), false
17
+ assert_match %r{>preview</a> \| <a[^>]*>download pdf</a>}, response.body
18
+ end
19
+
20
+ test "the new form renders with the pdf_link row" do
21
+ frame = "form_element_showcases_list"
22
+ get new_form_element_showcase_path(update: frame), headers: { "Turbo-Frame" => frame, "Accept" => "text/html" }
23
+
24
+ assert_response :success
25
+ end
26
+
27
+ test "preview renders the record" do
28
+ get "/report/#{@showcase.id}"
29
+
30
+ assert_response :success
31
+ assert_select "#showcase_report"
32
+ assert_includes response.body, "Report demo"
33
+ end
34
+
35
+ test "pdf downloads a PDF" do
36
+ get "/report/#{@showcase.id}.pdf"
37
+
38
+ assert_response :success
39
+ assert_equal "application/pdf", response.media_type
40
+ assert_match(/\Aattachment/, response.headers["Content-Disposition"])
41
+ assert response.body.start_with?("%PDF-")
42
+ end
43
+
44
+ test "guests get neither" do
45
+ sign_out example_app_admin_user
46
+
47
+ get "/report/#{@showcase.id}"
48
+ assert_response :redirect
49
+
50
+ get "/report/#{@showcase.id}.pdf"
51
+ assert_response :unauthorized
52
+ end
53
+ end
@@ -0,0 +1,2 @@
1
+ <h1><%= @showcase._presentation %></h1>
2
+ <p id="showcase_report">The preview of this record's report. The download pdf link downloads it.</p>
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.61
4
+ version: 8.1.65
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -74,6 +74,7 @@ files:
74
74
  - lib/installer_templates/example_app_assets/3stars.png
75
75
  - lib/installer_templates/example_app_assets/4stars.png
76
76
  - lib/installer_templates/example_app_assets/5stars.png
77
+ - lib/installer_templates/example_app_assets/sample.pdf
77
78
  - lib/installer_templates/example_app_assets/sample.txt
78
79
  - lib/installer_templates/example_app_assets/sample.wav
79
80
  - lib/installer_templates/example_app_assets/sample_cover.png
@@ -111,6 +112,7 @@ files:
111
112
  - lib/installer_templates/example_app_tests/test/integration/example_app_routing_test.rb
112
113
  - lib/installer_templates/example_app_tests/test/integration/example_app_sass_deprecations_test.rb
113
114
  - lib/installer_templates/example_app_tests/test/integration/example_app_schema_edit_test.rb
115
+ - lib/installer_templates/example_app_tests/test/integration/example_app_seed_rollback_test.rb
114
116
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_choice_scale_fields_test.rb
115
117
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_date_time_fields_test.rb
116
118
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_file_slot_test.rb
@@ -119,6 +121,7 @@ files:
119
121
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_money_update_test.rb
120
122
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_numeric_fields_test.rb
121
123
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_page_render_test.rb
124
+ - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_pdf_link_test.rb
122
125
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_row_turbo_test.rb
123
126
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_text_fields_test.rb
124
127
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_validation_hints_test.rb
@@ -136,6 +139,7 @@ files:
136
139
  - lib/installer_templates/example_app_views/inline_forms/_model_top_bar_left.html.erb
137
140
  - lib/installer_templates/example_app_views/owners/_owner_tabs.html.erb
138
141
  - lib/installer_templates/example_app_views/owners/show_with_tabs.html.erb
142
+ - lib/installer_templates/example_app_views/showcase_reports/show.html.erb
139
143
  - lib/installer_templates/unicorn/production.rb
140
144
  homepage: http://github.com/acesuares/inline_forms
141
145
  licenses: