inline_forms_installer 8.1.60 → 8.1.64
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 +29 -1
- data/lib/inline_forms_installer/version.rb +1 -1
- data/lib/installer_templates/example_app_assets/sample.pdf +32 -0
- data/lib/installer_templates/example_app_tests/test/integration/example_app_showcase_page_render_test.rb +1 -0
- data/lib/installer_templates/example_app_tests/test/integration/example_app_showcase_pdf_link_test.rb +53 -0
- data/lib/installer_templates/example_app_views/showcase_reports/show.html.erb +2 -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: 985f35cc68f826abf85b9a461fb0c481c639b58d6ad51a77812f45a59ade346d
|
|
4
|
+
data.tar.gz: 5cad9b48ccbfb27bcf615b8363cd8dd614ceabcd6fa590314259ab6e481aaa35
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 22bcb95c084a52985bb336bbcd86b9a142073ddb05691e2762782e5763108be2ff32bfdb861c8f25334d293c42e0f8279b31d7f35bb466f1cfc369d22a55075b
|
|
7
|
+
data.tar.gz: d7e76dbaff6c33c22da19eb1ea8962ed6579562d35e6d3e8c49b7701c1e41635902a96e1c15c78f1ed6c881070735e6c2e27495f561fc78d03fb45c87a143b94
|
|
@@ -1417,6 +1417,33 @@ 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; pdf_link_edit still reads the attribute.
|
|
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
|
+
inject_into_file "app/models/form_element_showcase.rb",
|
|
1426
|
+
"\n def report\n end\n",
|
|
1427
|
+
after: "class FormElementShowcase < ApplicationRecord\n"
|
|
1428
|
+
create_file "app/controllers/showcase_reports_controller.rb", <<-'SHOWCASE_REPORTS'.strip_heredoc
|
|
1429
|
+
# The two routes behind FormElementShowcase's :report pdf_link row.
|
|
1430
|
+
class ShowcaseReportsController < ApplicationController
|
|
1431
|
+
def show
|
|
1432
|
+
@showcase = FormElementShowcase.find(params[:id])
|
|
1433
|
+
authorize! :read, @showcase
|
|
1434
|
+
|
|
1435
|
+
respond_to do |format|
|
|
1436
|
+
format.html
|
|
1437
|
+
format.pdf do
|
|
1438
|
+
send_file Rails.root.join("db/seed_uploads/sample.pdf"),
|
|
1439
|
+
filename: "showcase_#{@showcase.id}.pdf", type: "application/pdf"
|
|
1440
|
+
end
|
|
1441
|
+
end
|
|
1442
|
+
end
|
|
1443
|
+
end
|
|
1444
|
+
SHOWCASE_REPORTS
|
|
1445
|
+
route 'get "report/:id", to: "showcase_reports#show", as: :showcase_report'
|
|
1446
|
+
|
|
1420
1447
|
# Locale keys for the showcase attributes. Headers + the timestamps
|
|
1421
1448
|
# need explicit labels so `human_attribute_name` does not fall back to
|
|
1422
1449
|
# "Header basics" / "Created at". The leading two-space indent puts
|
|
@@ -1456,6 +1483,7 @@ if ENV['install_example'] == 'true'
|
|
|
1456
1483
|
cover: Cover
|
|
1457
1484
|
gallery: Gallery (multiple images)
|
|
1458
1485
|
manual: Manual (file slot with trash)
|
|
1486
|
+
report: Report
|
|
1459
1487
|
description: Description
|
|
1460
1488
|
locales: Locales (editable)
|
|
1461
1489
|
locales_display: Locales (read-only)
|
|
@@ -1478,7 +1506,7 @@ if ENV['install_example'] == 'true'
|
|
|
1478
1506
|
# under db/seed_uploads so the seed migration can read them at
|
|
1479
1507
|
# db:migrate time and store them through CarrierWave. Mirrors the
|
|
1480
1508
|
# db/seed_images convention used for the Photo gallery seed above.
|
|
1481
|
-
%w[sample.txt sample.wav sample_cover.png].each do |basename|
|
|
1509
|
+
%w[sample.txt sample.wav sample_cover.png sample.pdf].each do |basename|
|
|
1482
1510
|
src = File.join(showcase_assets_root, basename)
|
|
1483
1511
|
copy_file src, File.join("db/seed_uploads", basename) if File.exist?(src)
|
|
1484
1512
|
end
|
|
@@ -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,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
|
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.64
|
|
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
|
|
@@ -119,6 +120,7 @@ files:
|
|
|
119
120
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_money_update_test.rb
|
|
120
121
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_numeric_fields_test.rb
|
|
121
122
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_page_render_test.rb
|
|
123
|
+
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_pdf_link_test.rb
|
|
122
124
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_row_turbo_test.rb
|
|
123
125
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_text_fields_test.rb
|
|
124
126
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_validation_hints_test.rb
|
|
@@ -136,6 +138,7 @@ files:
|
|
|
136
138
|
- lib/installer_templates/example_app_views/inline_forms/_model_top_bar_left.html.erb
|
|
137
139
|
- lib/installer_templates/example_app_views/owners/_owner_tabs.html.erb
|
|
138
140
|
- lib/installer_templates/example_app_views/owners/show_with_tabs.html.erb
|
|
141
|
+
- lib/installer_templates/example_app_views/showcase_reports/show.html.erb
|
|
139
142
|
- lib/installer_templates/unicorn/production.rb
|
|
140
143
|
homepage: http://github.com/acesuares/inline_forms
|
|
141
144
|
licenses:
|