publishing_platform_publishing_components 0.1.0
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 +7 -0
- data/LICENSE +22 -0
- data/README.md +2 -0
- data/Rakefile +41 -0
- data/app/assets/builds/gemkeep +0 -0
- data/app/assets/config/publishing_platform_publishing_components_manifest.js +2 -0
- data/app/assets/images/publishing_platform_publishing_components/gemkeep +0 -0
- data/app/assets/stylesheets/publishing_platform_publishing_components/_all_components.scss +3 -0
- data/app/assets/stylesheets/publishing_platform_publishing_components/components/_attachment.scss +117 -0
- data/app/assets/stylesheets/publishing_platform_publishing_components/components/_summary-list.scss +169 -0
- data/app/controllers/publishing_platform_publishing_components/application_controller.rb +4 -0
- data/app/helpers/publishing_platform_publishing_components/application_helper.rb +4 -0
- data/app/models/publishing_platform_publishing_components/component_doc.rb +90 -0
- data/app/models/publishing_platform_publishing_components/component_docs.rb +57 -0
- data/app/models/publishing_platform_publishing_components/component_example.rb +104 -0
- data/app/models/publishing_platform_publishing_components/shared_accessibility_criteria.rb +37 -0
- data/app/views/publishing_platform_publishing_components/component_doc/_component_output.html.erb +15 -0
- data/app/views/publishing_platform_publishing_components/components/_attachment.html.erb +91 -0
- data/app/views/publishing_platform_publishing_components/components/_error_summary.html.erb +38 -0
- data/app/views/publishing_platform_publishing_components/components/_summary_list.html.erb +135 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_document.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_external.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_generic.html.erb +4 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_html.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_pdf.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_spreadsheet.html.erb +5 -0
- data/app/views/publishing_platform_publishing_components/components/docs/attachment.yml +104 -0
- data/app/views/publishing_platform_publishing_components/components/docs/error_summary.yml +51 -0
- data/app/views/publishing_platform_publishing_components/components/docs/summary_list.yml +137 -0
- data/config/initializers/assets.rb +24 -0
- data/config/routes.rb +2 -0
- data/lib/publishing_platform_publishing_components/config.rb +25 -0
- data/lib/publishing_platform_publishing_components/engine.rb +5 -0
- data/lib/publishing_platform_publishing_components/presenters/attachment_helper.rb +176 -0
- data/lib/publishing_platform_publishing_components/presenters/component_wrapper_helper.rb +290 -0
- data/lib/publishing_platform_publishing_components/presenters/shared_helper.rb +24 -0
- data/lib/publishing_platform_publishing_components/version.rb +3 -0
- data/lib/publishing_platform_publishing_components.rb +10 -0
- data/lib/tasks/publishing_platform_publishing_components_tasks.rake +4 -0
- data/node_modules/bootstrap/LICENSE +21 -0
- data/node_modules/bootstrap/README.md +246 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.css +4085 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css +4084 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.css +601 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css +598 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.css +5406 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css +5397 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.css +12048 -0
- data/node_modules/bootstrap/dist/css/bootstrap.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.css +12021 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.js +6312 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js +7 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.js +4447 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js +7 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.js +4494 -0
- data/node_modules/bootstrap/dist/js/bootstrap.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.min.js +7 -0
- data/node_modules/bootstrap/dist/js/bootstrap.min.js.map +1 -0
- data/node_modules/bootstrap/js/dist/alert.js +90 -0
- data/node_modules/bootstrap/js/dist/alert.js.map +1 -0
- data/node_modules/bootstrap/js/dist/base-component.js +86 -0
- data/node_modules/bootstrap/js/dist/base-component.js.map +1 -0
- data/node_modules/bootstrap/js/dist/button.js +79 -0
- data/node_modules/bootstrap/js/dist/button.js.map +1 -0
- data/node_modules/bootstrap/js/dist/carousel.js +388 -0
- data/node_modules/bootstrap/js/dist/carousel.js.map +1 -0
- data/node_modules/bootstrap/js/dist/collapse.js +249 -0
- data/node_modules/bootstrap/js/dist/collapse.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/data.js +63 -0
- data/node_modules/bootstrap/js/dist/dom/data.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/event-handler.js +237 -0
- data/node_modules/bootstrap/js/dist/dom/event-handler.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/manipulator.js +72 -0
- data/node_modules/bootstrap/js/dist/dom/manipulator.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/selector-engine.js +104 -0
- data/node_modules/bootstrap/js/dist/dom/selector-engine.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dropdown.js +402 -0
- data/node_modules/bootstrap/js/dist/dropdown.js.map +1 -0
- data/node_modules/bootstrap/js/dist/modal.js +320 -0
- data/node_modules/bootstrap/js/dist/modal.js.map +1 -0
- data/node_modules/bootstrap/js/dist/offcanvas.js +246 -0
- data/node_modules/bootstrap/js/dist/offcanvas.js.map +1 -0
- data/node_modules/bootstrap/js/dist/popover.js +96 -0
- data/node_modules/bootstrap/js/dist/popover.js.map +1 -0
- data/node_modules/bootstrap/js/dist/scrollspy.js +275 -0
- data/node_modules/bootstrap/js/dist/scrollspy.js.map +1 -0
- data/node_modules/bootstrap/js/dist/tab.js +285 -0
- data/node_modules/bootstrap/js/dist/tab.js.map +1 -0
- data/node_modules/bootstrap/js/dist/toast.js +198 -0
- data/node_modules/bootstrap/js/dist/toast.js.map +1 -0
- data/node_modules/bootstrap/js/dist/tooltip.js +546 -0
- data/node_modules/bootstrap/js/dist/tooltip.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/backdrop.js +139 -0
- data/node_modules/bootstrap/js/dist/util/backdrop.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/component-functions.js +42 -0
- data/node_modules/bootstrap/js/dist/util/component-functions.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/config.js +68 -0
- data/node_modules/bootstrap/js/dist/util/config.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/focustrap.js +113 -0
- data/node_modules/bootstrap/js/dist/util/focustrap.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/index.js +281 -0
- data/node_modules/bootstrap/js/dist/util/index.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/sanitizer.js +113 -0
- data/node_modules/bootstrap/js/dist/util/sanitizer.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/scrollbar.js +113 -0
- data/node_modules/bootstrap/js/dist/util/scrollbar.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/swipe.js +135 -0
- data/node_modules/bootstrap/js/dist/util/swipe.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/template-factory.js +151 -0
- data/node_modules/bootstrap/js/dist/util/template-factory.js.map +1 -0
- data/node_modules/bootstrap/js/index.esm.js +19 -0
- data/node_modules/bootstrap/js/index.umd.js +34 -0
- data/node_modules/bootstrap/js/src/alert.js +87 -0
- data/node_modules/bootstrap/js/src/base-component.js +86 -0
- data/node_modules/bootstrap/js/src/button.js +72 -0
- data/node_modules/bootstrap/js/src/carousel.js +474 -0
- data/node_modules/bootstrap/js/src/collapse.js +297 -0
- data/node_modules/bootstrap/js/src/dom/data.js +55 -0
- data/node_modules/bootstrap/js/src/dom/event-handler.js +317 -0
- data/node_modules/bootstrap/js/src/dom/manipulator.js +71 -0
- data/node_modules/bootstrap/js/src/dom/selector-engine.js +126 -0
- data/node_modules/bootstrap/js/src/dropdown.js +455 -0
- data/node_modules/bootstrap/js/src/modal.js +378 -0
- data/node_modules/bootstrap/js/src/offcanvas.js +282 -0
- data/node_modules/bootstrap/js/src/popover.js +97 -0
- data/node_modules/bootstrap/js/src/scrollspy.js +296 -0
- data/node_modules/bootstrap/js/src/tab.js +315 -0
- data/node_modules/bootstrap/js/src/toast.js +224 -0
- data/node_modules/bootstrap/js/src/tooltip.js +633 -0
- data/node_modules/bootstrap/js/src/util/backdrop.js +151 -0
- data/node_modules/bootstrap/js/src/util/component-functions.js +35 -0
- data/node_modules/bootstrap/js/src/util/config.js +65 -0
- data/node_modules/bootstrap/js/src/util/focustrap.js +115 -0
- data/node_modules/bootstrap/js/src/util/index.js +306 -0
- data/node_modules/bootstrap/js/src/util/sanitizer.js +116 -0
- data/node_modules/bootstrap/js/src/util/scrollbar.js +114 -0
- data/node_modules/bootstrap/js/src/util/swipe.js +146 -0
- data/node_modules/bootstrap/js/src/util/template-factory.js +160 -0
- data/node_modules/bootstrap/package.json +210 -0
- data/node_modules/bootstrap/scss/_accordion.scss +153 -0
- data/node_modules/bootstrap/scss/_alert.scss +68 -0
- data/node_modules/bootstrap/scss/_badge.scss +38 -0
- data/node_modules/bootstrap/scss/_breadcrumb.scss +40 -0
- data/node_modules/bootstrap/scss/_button-group.scss +147 -0
- data/node_modules/bootstrap/scss/_buttons.scss +216 -0
- data/node_modules/bootstrap/scss/_card.scss +238 -0
- data/node_modules/bootstrap/scss/_carousel.scss +226 -0
- data/node_modules/bootstrap/scss/_close.scss +66 -0
- data/node_modules/bootstrap/scss/_containers.scss +41 -0
- data/node_modules/bootstrap/scss/_dropdown.scss +250 -0
- data/node_modules/bootstrap/scss/_forms.scss +9 -0
- data/node_modules/bootstrap/scss/_functions.scss +302 -0
- data/node_modules/bootstrap/scss/_grid.scss +39 -0
- data/node_modules/bootstrap/scss/_helpers.scss +12 -0
- data/node_modules/bootstrap/scss/_images.scss +42 -0
- data/node_modules/bootstrap/scss/_list-group.scss +199 -0
- data/node_modules/bootstrap/scss/_maps.scss +174 -0
- data/node_modules/bootstrap/scss/_mixins.scss +42 -0
- data/node_modules/bootstrap/scss/_modal.scss +240 -0
- data/node_modules/bootstrap/scss/_nav.scss +197 -0
- data/node_modules/bootstrap/scss/_navbar.scss +289 -0
- data/node_modules/bootstrap/scss/_offcanvas.scss +147 -0
- data/node_modules/bootstrap/scss/_pagination.scss +109 -0
- data/node_modules/bootstrap/scss/_placeholders.scss +51 -0
- data/node_modules/bootstrap/scss/_popover.scss +196 -0
- data/node_modules/bootstrap/scss/_progress.scss +68 -0
- data/node_modules/bootstrap/scss/_reboot.scss +617 -0
- data/node_modules/bootstrap/scss/_root.scss +187 -0
- data/node_modules/bootstrap/scss/_spinners.scss +86 -0
- data/node_modules/bootstrap/scss/_tables.scss +171 -0
- data/node_modules/bootstrap/scss/_toasts.scss +73 -0
- data/node_modules/bootstrap/scss/_tooltip.scss +119 -0
- data/node_modules/bootstrap/scss/_transitions.scss +27 -0
- data/node_modules/bootstrap/scss/_type.scss +106 -0
- data/node_modules/bootstrap/scss/_utilities.scss +806 -0
- data/node_modules/bootstrap/scss/_variables-dark.scss +102 -0
- data/node_modules/bootstrap/scss/_variables.scss +1753 -0
- data/node_modules/bootstrap/scss/bootstrap-grid.scss +62 -0
- data/node_modules/bootstrap/scss/bootstrap-reboot.scss +10 -0
- data/node_modules/bootstrap/scss/bootstrap-utilities.scss +19 -0
- data/node_modules/bootstrap/scss/bootstrap.scss +52 -0
- data/node_modules/bootstrap/scss/forms/_floating-labels.scss +97 -0
- data/node_modules/bootstrap/scss/forms/_form-check.scss +189 -0
- data/node_modules/bootstrap/scss/forms/_form-control.scss +214 -0
- data/node_modules/bootstrap/scss/forms/_form-range.scss +91 -0
- data/node_modules/bootstrap/scss/forms/_form-select.scss +80 -0
- data/node_modules/bootstrap/scss/forms/_form-text.scss +11 -0
- data/node_modules/bootstrap/scss/forms/_input-group.scss +132 -0
- data/node_modules/bootstrap/scss/forms/_labels.scss +36 -0
- data/node_modules/bootstrap/scss/forms/_validation.scss +12 -0
- data/node_modules/bootstrap/scss/helpers/_clearfix.scss +3 -0
- data/node_modules/bootstrap/scss/helpers/_color-bg.scss +7 -0
- data/node_modules/bootstrap/scss/helpers/_colored-links.scss +30 -0
- data/node_modules/bootstrap/scss/helpers/_focus-ring.scss +5 -0
- data/node_modules/bootstrap/scss/helpers/_icon-link.scss +25 -0
- data/node_modules/bootstrap/scss/helpers/_position.scss +36 -0
- data/node_modules/bootstrap/scss/helpers/_ratio.scss +26 -0
- data/node_modules/bootstrap/scss/helpers/_stacks.scss +15 -0
- data/node_modules/bootstrap/scss/helpers/_stretched-link.scss +15 -0
- data/node_modules/bootstrap/scss/helpers/_text-truncation.scss +7 -0
- data/node_modules/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
- data/node_modules/bootstrap/scss/helpers/_vr.scss +8 -0
- data/node_modules/bootstrap/scss/mixins/_alert.scss +18 -0
- data/node_modules/bootstrap/scss/mixins/_backdrop.scss +14 -0
- data/node_modules/bootstrap/scss/mixins/_banner.scss +7 -0
- data/node_modules/bootstrap/scss/mixins/_border-radius.scss +78 -0
- data/node_modules/bootstrap/scss/mixins/_box-shadow.scss +24 -0
- data/node_modules/bootstrap/scss/mixins/_breakpoints.scss +127 -0
- data/node_modules/bootstrap/scss/mixins/_buttons.scss +70 -0
- data/node_modules/bootstrap/scss/mixins/_caret.scss +69 -0
- data/node_modules/bootstrap/scss/mixins/_clearfix.scss +9 -0
- data/node_modules/bootstrap/scss/mixins/_color-mode.scss +21 -0
- data/node_modules/bootstrap/scss/mixins/_color-scheme.scss +7 -0
- data/node_modules/bootstrap/scss/mixins/_container.scss +11 -0
- data/node_modules/bootstrap/scss/mixins/_deprecate.scss +10 -0
- data/node_modules/bootstrap/scss/mixins/_forms.scss +163 -0
- data/node_modules/bootstrap/scss/mixins/_gradients.scss +47 -0
- data/node_modules/bootstrap/scss/mixins/_grid.scss +151 -0
- data/node_modules/bootstrap/scss/mixins/_image.scss +16 -0
- data/node_modules/bootstrap/scss/mixins/_list-group.scss +26 -0
- data/node_modules/bootstrap/scss/mixins/_lists.scss +7 -0
- data/node_modules/bootstrap/scss/mixins/_pagination.scss +10 -0
- data/node_modules/bootstrap/scss/mixins/_reset-text.scss +17 -0
- data/node_modules/bootstrap/scss/mixins/_resize.scss +6 -0
- data/node_modules/bootstrap/scss/mixins/_table-variants.scss +24 -0
- data/node_modules/bootstrap/scss/mixins/_text-truncate.scss +8 -0
- data/node_modules/bootstrap/scss/mixins/_transition.scss +26 -0
- data/node_modules/bootstrap/scss/mixins/_utilities.scss +97 -0
- data/node_modules/bootstrap/scss/mixins/_visually-hidden.scss +38 -0
- data/node_modules/bootstrap/scss/utilities/_api.scss +47 -0
- data/node_modules/bootstrap/scss/vendor/_rfs.scss +348 -0
- metadata +448 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: fd01d35952a87cf92b3a809b7628e56626ece151e2d565e50a01b3f2b9f2e061
|
|
4
|
+
data.tar.gz: ba093a8a4bdaf481ee512f9591b1e8c5c1ac07e7c47b282d67d6e6040b6d4b65
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 3d2483aaec570385b5ccb72fa91d69f6a823e4759f89bcca713ad1581611a7ddf7e2dda58ceb02f6443bfb25467039828530f78d25e84baf9fd5987768eb334c
|
|
7
|
+
data.tar.gz: 0eec104aef8ff7d932dbffc0b218707c8ba0c7032d9d89c62b4c025baea141693ed3a7886f813499717ffc4add6eaf82b5407e3da1d7be8369263767d3660a33
|
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Publishing Platform
|
|
4
|
+
Copyright (c) 2017 Crown Copyright (Government Digital Service)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require "bundler/setup"
|
|
2
|
+
require "rubocop/rake_task"
|
|
3
|
+
require "rspec/core/rake_task"
|
|
4
|
+
APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
|
|
5
|
+
|
|
6
|
+
load "rails/tasks/engine.rake"
|
|
7
|
+
load "rails/tasks/statistics.rake"
|
|
8
|
+
|
|
9
|
+
require "bundler/gem_tasks"
|
|
10
|
+
|
|
11
|
+
RuboCop::RakeTask.new
|
|
12
|
+
RSpec::Core::RakeTask.new
|
|
13
|
+
|
|
14
|
+
namespace :assets do
|
|
15
|
+
desc "Test precompiling assets through dummy application"
|
|
16
|
+
task precompile: :environment do
|
|
17
|
+
Rake::Task["app:assets:precompile"].invoke
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
desc "Test cleaning assets through dummy application"
|
|
21
|
+
task clean: :environment do
|
|
22
|
+
Rake::Task["app:assets:clean"].invoke
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
desc "Test clobbering assets through dummy application"
|
|
26
|
+
task clobber: :environment do
|
|
27
|
+
Rake::Task["app:assets:clobber"].invoke
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
desc "Build the Sass files"
|
|
32
|
+
task dartsass: :environment do
|
|
33
|
+
Rake::Task["app:dartsass:build"].invoke
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
desc "Linting for Ruby, JS and SASS"
|
|
37
|
+
task lint: %i[rubocop environment] do
|
|
38
|
+
sh "yarn run lint"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
task default: %i[dartsass lint spec]
|
|
File without changes
|
|
File without changes
|
data/app/assets/stylesheets/publishing_platform_publishing_components/components/_attachment.scss
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
@import 'functions';
|
|
2
|
+
@import 'variables';
|
|
3
|
+
@import 'mixins';
|
|
4
|
+
|
|
5
|
+
$thumbnail-width: 99px;
|
|
6
|
+
$thumbnail-height: 140px;
|
|
7
|
+
$thumbnail-border-width: 5px;
|
|
8
|
+
$thumbnail-background: $white;
|
|
9
|
+
$thumbnail-border-colour: rgba(11, 12, 12, .1); /* stylelint-disable-line */
|
|
10
|
+
$thumbnail-shadow-colour: rgba(11, 12, 12, .4); /* stylelint-disable-line */
|
|
11
|
+
$thumbnail-shadow-width: 0 2px 2px;
|
|
12
|
+
$thumbnail-icon-border-colour: $gray-500;
|
|
13
|
+
|
|
14
|
+
.gem-c-attachment {
|
|
15
|
+
position: relative;
|
|
16
|
+
|
|
17
|
+
@include clearfix;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.gem-c-attachment__thumbnail {
|
|
21
|
+
position: relative;
|
|
22
|
+
width: auto;
|
|
23
|
+
padding: $thumbnail-border-width;
|
|
24
|
+
float: left;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.gem-c-attachment__thumbnail-image {
|
|
28
|
+
display: block;
|
|
29
|
+
width: auto; // for IE8
|
|
30
|
+
max-width: calc($thumbnail-width / 1.5);
|
|
31
|
+
height: calc($thumbnail-height / 1.5);
|
|
32
|
+
border: $thumbnail-border-colour; // for IE9 & IE10
|
|
33
|
+
outline: $thumbnail-border-width solid $thumbnail-border-colour;
|
|
34
|
+
background: $thumbnail-background;
|
|
35
|
+
box-shadow: $thumbnail-shadow-width $thumbnail-shadow-colour;
|
|
36
|
+
fill: $thumbnail-icon-border-colour;
|
|
37
|
+
stroke: $thumbnail-icon-border-colour;
|
|
38
|
+
|
|
39
|
+
@include media-breakpoint-up(sm) {
|
|
40
|
+
max-width: $thumbnail-width;
|
|
41
|
+
height: $thumbnail-height;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.gem-c-attachment__details {
|
|
46
|
+
padding-left: calc(($thumbnail-width + $thumbnail-border-width * 2 + 30px) / 1.5);
|
|
47
|
+
|
|
48
|
+
@include media-breakpoint-up(sm) {
|
|
49
|
+
padding-left: $thumbnail-width + $thumbnail-border-width * 2 + 25px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.gem-c-details {
|
|
53
|
+
margin-top: 15px;
|
|
54
|
+
word-break: break-word;
|
|
55
|
+
word-wrap: break-word;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.gem-c-attachment__title {
|
|
60
|
+
margin: 0 0 15px;
|
|
61
|
+
font-size: $h5-font-size;
|
|
62
|
+
|
|
63
|
+
@include media-breakpoint-up(sm) {
|
|
64
|
+
font-size: $h3-font-size;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.gem-c-attachment__metadata {
|
|
69
|
+
margin: 0 0 15px;
|
|
70
|
+
color: $gray-600;
|
|
71
|
+
word-wrap:break-word;
|
|
72
|
+
overflow-wrap: break-word;
|
|
73
|
+
|
|
74
|
+
&:last-of-type {
|
|
75
|
+
margin-bottom: 0;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.publishing-platform-markdown,
|
|
80
|
+
.gem-c-publishing-platform-markdown {
|
|
81
|
+
.gem-c-attachment__title {
|
|
82
|
+
margin: 0 0 15px;
|
|
83
|
+
font-size: $h5-font-size;
|
|
84
|
+
|
|
85
|
+
@include media-breakpoint-up(sm) {
|
|
86
|
+
font-size: $h3-font-size;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.gem-c-attachment__metadata {
|
|
91
|
+
margin: 0 0 15px;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.gem-c-attachment__metadata--compact {
|
|
96
|
+
margin-bottom: 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.gem-c-attachment__abbr {
|
|
100
|
+
text-decoration: none !important;
|
|
101
|
+
cursor: help;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@media print {
|
|
105
|
+
.gem-c-attachment__details {
|
|
106
|
+
padding: 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.gem-c-attachment__metadata {
|
|
110
|
+
color: $black;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.gem-c-attachment__metadata,
|
|
114
|
+
.gem-c-attachment__metadata .govuk-link::after {
|
|
115
|
+
font-size: 12pt;
|
|
116
|
+
}
|
|
117
|
+
}
|
data/app/assets/stylesheets/publishing_platform_publishing_components/components/_summary-list.scss
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
@import 'functions';
|
|
2
|
+
@import 'variables';
|
|
3
|
+
@import 'mixins';
|
|
4
|
+
|
|
5
|
+
.gem-c-summary-list {
|
|
6
|
+
margin-top: 1rem;
|
|
7
|
+
|
|
8
|
+
&:nth-of-type(1) {
|
|
9
|
+
margin-top: 0;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.gem-c-summary-list__group-title {
|
|
14
|
+
@include media-breakpoint-up(sm) {
|
|
15
|
+
display: inline-block;
|
|
16
|
+
margin-right: 15px;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.gem-c-summary-list__items {
|
|
21
|
+
clear: both;
|
|
22
|
+
|
|
23
|
+
@include media-breakpoint-up(sm) {
|
|
24
|
+
display: table;
|
|
25
|
+
width: 100%;
|
|
26
|
+
table-layout: fixed; // Required to allow us to wrap words that overflow.
|
|
27
|
+
border-collapse: collapse;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
margin: 0; // Reset default user agent styles
|
|
31
|
+
margin-bottom: 30px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.gem-c-summary-list__row {
|
|
35
|
+
border-bottom: 1px solid $border-color;
|
|
36
|
+
|
|
37
|
+
@include media-breakpoint-down(sm){
|
|
38
|
+
margin-bottom: 15px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@include media-breakpoint-up(sm){
|
|
42
|
+
display: table-row;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Remove right padding from the last column in the row
|
|
47
|
+
.gem-c-summary-list__row:not(.gem-c-summary-list__row--no-actions) > :last-child {
|
|
48
|
+
padding-right: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.gem-c-summary-list__row--no-actions {
|
|
52
|
+
@include media-breakpoint-up(sm) {
|
|
53
|
+
&::after {
|
|
54
|
+
content: "";
|
|
55
|
+
display: table-cell;
|
|
56
|
+
width: 20%;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.gem-c-summary-list__key,
|
|
62
|
+
.gem-c-summary-list__value,
|
|
63
|
+
.gem-c-summary-list__actions {
|
|
64
|
+
margin: 0; // Reset default user agent styles
|
|
65
|
+
|
|
66
|
+
@include media-breakpoint-up(sm) {
|
|
67
|
+
display: table-cell;
|
|
68
|
+
padding-top: 10px;
|
|
69
|
+
padding-right: 20px;
|
|
70
|
+
padding-bottom: 10px;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.gem-c-summary-list__key,
|
|
75
|
+
.gem-c-summary-list__value {
|
|
76
|
+
// Automatic wrapping for unbreakable text (e.g. URLs)
|
|
77
|
+
word-wrap: break-word; // Fallback for older browsers only
|
|
78
|
+
overflow-wrap: break-word;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.gem-c-summary-list__key {
|
|
82
|
+
margin-bottom: 5px;
|
|
83
|
+
font-weight: $font-weight-bold;
|
|
84
|
+
|
|
85
|
+
@include media-breakpoint-up(sm) {
|
|
86
|
+
width: 30%;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.gem-c-summary-list__value {
|
|
91
|
+
@include media-breakpoint-down(sm){
|
|
92
|
+
margin-bottom: 15px;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.gem-c-summary-list__value > p {
|
|
97
|
+
margin-bottom: 10px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.gem-c-summary-list__value > :last-child {
|
|
101
|
+
margin-bottom: 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.gem-c-summary-list__actions {
|
|
105
|
+
margin-bottom: 15px;
|
|
106
|
+
|
|
107
|
+
@include media-breakpoint-up(sm) {
|
|
108
|
+
width: 20%;
|
|
109
|
+
text-align: right;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.gem-c-summary-list__actions-list {
|
|
114
|
+
width: 100%;
|
|
115
|
+
margin: 0; // Reset default user agent styles
|
|
116
|
+
padding: 0; // Reset default user agent styles
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.gem-c-summary-list__actions-list-item {
|
|
120
|
+
display: inline-block;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@include media-breakpoint-down(sm){
|
|
124
|
+
.gem-c-summary-list__actions-list-item {
|
|
125
|
+
margin-right: 10px;
|
|
126
|
+
padding-right: 10px;
|
|
127
|
+
border-right: 1px solid $border-color;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.gem-c-summary-list__actions-list-item:last-child {
|
|
131
|
+
margin-right: 0;
|
|
132
|
+
padding-right: 0;
|
|
133
|
+
border: 0;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@include media-breakpoint-up(sm){
|
|
138
|
+
.gem-c-summary-list__actions-list-item {
|
|
139
|
+
margin-left: 10px;
|
|
140
|
+
padding-left: 10px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.gem-c-summary-list__actions-list-item:not(:first-child) {
|
|
144
|
+
border-left: 1px solid $border-color;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.gem-c-summary-list__actions-list-item:first-child {
|
|
148
|
+
margin-left: 0;
|
|
149
|
+
padding-left: 0;
|
|
150
|
+
border: 0;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.gem-c-summary-list__group-actions-list {
|
|
155
|
+
margin-bottom: 15px;
|
|
156
|
+
|
|
157
|
+
@include media-breakpoint-up(sm) {
|
|
158
|
+
float: right;
|
|
159
|
+
width: auto;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.gem-c-summary__block {
|
|
164
|
+
margin-bottom: 20px;
|
|
165
|
+
|
|
166
|
+
@include media-breakpoint-up(sm) {
|
|
167
|
+
margin-bottom: 30px;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
module PublishingPlatformPublishingComponents
|
|
2
|
+
class ComponentDoc
|
|
3
|
+
attr_reader :id,
|
|
4
|
+
:name,
|
|
5
|
+
:description,
|
|
6
|
+
:body,
|
|
7
|
+
:component,
|
|
8
|
+
:accessibility_excluded_rules,
|
|
9
|
+
:source,
|
|
10
|
+
:embed
|
|
11
|
+
|
|
12
|
+
def initialize(component)
|
|
13
|
+
@component = component
|
|
14
|
+
@id = component[:id]
|
|
15
|
+
@name = component[:name]
|
|
16
|
+
@description = component[:description]
|
|
17
|
+
@body = component[:body]
|
|
18
|
+
@accessibility_excluded_rules = component[:accessibility_excluded_rules]
|
|
19
|
+
@source = component[:source]
|
|
20
|
+
@embed = component[:embed]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def accessibility_criteria
|
|
24
|
+
shared_accessibility_criteria = []
|
|
25
|
+
|
|
26
|
+
if component[:shared_accessibility_criteria].present?
|
|
27
|
+
component[:shared_accessibility_criteria].each do |criteria|
|
|
28
|
+
shared_accessibility_criteria << SharedAccessibilityCriteria.send(criteria) if SharedAccessibilityCriteria.respond_to? criteria
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
"#{component[:accessibility_criteria]}\n#{shared_accessibility_criteria.join("\n")}"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def example
|
|
36
|
+
examples.first
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def other_examples
|
|
40
|
+
examples.slice(1..-1)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def display_html?
|
|
44
|
+
component[:display_html]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def display_preview?
|
|
48
|
+
component[:display_preview].nil? || component[:display_preview]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def html_body
|
|
52
|
+
markdown_to_html(body) if body.present?
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def html_accessibility_criteria
|
|
56
|
+
markdown_to_html(accessibility_criteria) if accessibility_criteria.present?
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def partial_path
|
|
60
|
+
if source == "gem"
|
|
61
|
+
"publishing_platform_publishing_components/components/#{id}"
|
|
62
|
+
else
|
|
63
|
+
"#{PublishingPlatformPublishingComponents::Config.component_directory_name}/#{id}"
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def publishing_platform_frontend_components
|
|
68
|
+
component[:publishing_platform_frontend_components].to_a
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def github_search_url
|
|
72
|
+
params = { q: "org:publishing-platform components/components/#{id}", type: "Code" }
|
|
73
|
+
"https://github.com/search?#{params.to_query}"
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def examples
|
|
77
|
+
@examples ||= component[:examples].map do |id, example_data|
|
|
78
|
+
example_data ||= {}
|
|
79
|
+
example_data["embed"] ||= embed
|
|
80
|
+
ComponentExample.new(id.to_s, example_data)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
private
|
|
85
|
+
|
|
86
|
+
def markdown_to_html(markdown)
|
|
87
|
+
Kramdown::Document.new(markdown).to_html
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module PublishingPlatformPublishingComponents
|
|
2
|
+
# @private
|
|
3
|
+
class ComponentDocs
|
|
4
|
+
def initialize(gem_components: false)
|
|
5
|
+
@documentation_directory = gem_components ? gem_documentation_directory : app_documentation_directory
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def get(id)
|
|
9
|
+
component = fetch_component_doc(id)
|
|
10
|
+
build(component)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def all
|
|
14
|
+
fetch_component_docs.map { |component| build(component) }.sort_by(&:name)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def used_in_this_app
|
|
18
|
+
fetch_component_docs.map { |component| build(component) if component_in_use(component[:id]) }.compact.sort_by(&:name)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def build(component)
|
|
24
|
+
ComponentDoc.new(component)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def fetch_component_docs
|
|
28
|
+
doc_files = Rails.root.join(@documentation_directory, "*.yml")
|
|
29
|
+
Dir[doc_files].sort.map { |file| parse_documentation(file) }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def fetch_component_doc(id)
|
|
33
|
+
file = Rails.root.join(@documentation_directory, "#{id}.yml")
|
|
34
|
+
if !file.exist?
|
|
35
|
+
file = gem_documentation_directory.join("#{id}.yml")
|
|
36
|
+
parse_documentation(file).merge(source: "gem")
|
|
37
|
+
else
|
|
38
|
+
parse_documentation(file).merge(source: "application")
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def parse_documentation(file)
|
|
43
|
+
# Psych 4's YAML.unsafe_load_file === Psych 3's YAML.load_file
|
|
44
|
+
# but until we drop support for Ruby 2.7 and Ruby 3.0, we need to support both major versions of Psych
|
|
45
|
+
yaml = YAML.respond_to?(:unsafe_load_file) ? YAML.unsafe_load_file(file) : YAML.load_file(file)
|
|
46
|
+
{ id: File.basename(file, ".yml") }.merge(yaml).with_indifferent_access
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def app_documentation_directory
|
|
50
|
+
Rails.root.join("app", "views", PublishingPlatformPublishingComponents::Config.component_directory_name, "docs")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def gem_documentation_directory
|
|
54
|
+
Pathname.new(PublishingPlatformPublishingComponents::Config.gem_directory).join("app", "views", "publishing_platform_publishing_components", "components", "docs")
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
require "rouge"
|
|
2
|
+
|
|
3
|
+
module PublishingPlatformPublishingComponents
|
|
4
|
+
class ComponentExample
|
|
5
|
+
attr_reader :id,
|
|
6
|
+
:data,
|
|
7
|
+
:context,
|
|
8
|
+
:description,
|
|
9
|
+
:block,
|
|
10
|
+
:embed
|
|
11
|
+
|
|
12
|
+
def initialize(id, example)
|
|
13
|
+
@id = id
|
|
14
|
+
@data = example["data"] || {}
|
|
15
|
+
@context = example["context"] || {}
|
|
16
|
+
@description = example["description"] || false
|
|
17
|
+
@block = @data.delete(:block) || false
|
|
18
|
+
@embed = example["embed"]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def name
|
|
22
|
+
id.humanize
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def highlight_code(string_to_format = "")
|
|
26
|
+
formatter = Rouge::Formatters::HTML.new
|
|
27
|
+
lexer = Rouge::Lexers::ERB.new
|
|
28
|
+
formatter.format(lexer.lex(string_to_format)).html_safe
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def pretty_data
|
|
32
|
+
json_key_regex = /"(\w*)":/ # matches quoted keys ending with a colon, i.e. "key":
|
|
33
|
+
output = JSON.pretty_generate(data).gsub('\\n', "\n ").gsub(json_key_regex, '\1:')
|
|
34
|
+
|
|
35
|
+
quoted_string_regex = /"((?:[^"\\]|\\.)*)"/ # matches "some text" - ignores escaped quotes, i.e. \"
|
|
36
|
+
output.gsub(quoted_string_regex) do |group|
|
|
37
|
+
match = Regexp.last_match[1]
|
|
38
|
+
contains_html?(match) ? "sanitize(#{group})" : group
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def contains_html?(input)
|
|
43
|
+
ActionController::Base.helpers.strip_tags(input) != input
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def data?
|
|
47
|
+
data.any?
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def html_safe_data
|
|
51
|
+
html_safe_strings(data.dup)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Iterate through data object and recursively mark
|
|
55
|
+
# any found string as html_safe
|
|
56
|
+
#
|
|
57
|
+
# Safe HTML can be passed to components, simulate
|
|
58
|
+
# by marking any string that comes from YAML as safe
|
|
59
|
+
def html_safe_strings(obj)
|
|
60
|
+
case obj
|
|
61
|
+
when String
|
|
62
|
+
obj.html_safe
|
|
63
|
+
when Hash
|
|
64
|
+
obj.each do |key, value|
|
|
65
|
+
obj[key] = html_safe_strings(value)
|
|
66
|
+
end
|
|
67
|
+
when Array
|
|
68
|
+
obj.map! { |e| html_safe_strings(e) }
|
|
69
|
+
else
|
|
70
|
+
obj
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def right_to_left?
|
|
75
|
+
context["right_to_left"].present?
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def dark_background?
|
|
79
|
+
context["dark_background"].present?
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def black_background?
|
|
83
|
+
!!context["black_background"]
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def html_description
|
|
87
|
+
markdown_to_html(description) if description.present?
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def has_block?
|
|
91
|
+
block.present?
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def has_embed?
|
|
95
|
+
embed.present?
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
private
|
|
99
|
+
|
|
100
|
+
def markdown_to_html(markdown)
|
|
101
|
+
Kramdown::Document.new(markdown).to_html
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module PublishingPlatformPublishingComponents
|
|
2
|
+
module SharedAccessibilityCriteria
|
|
3
|
+
def self.link
|
|
4
|
+
"
|
|
5
|
+
Links in the component must:
|
|
6
|
+
|
|
7
|
+
- accept focus
|
|
8
|
+
- be focusable with a keyboard
|
|
9
|
+
- be usable with a keyboard
|
|
10
|
+
- indicate when they have focus
|
|
11
|
+
- change in appearance when touched (in the touch-down state)
|
|
12
|
+
- change in appearance when hovered
|
|
13
|
+
- be usable with touch
|
|
14
|
+
- be usable with [voice commands](https://www.w3.org/WAI/perspectives/voice.html)
|
|
15
|
+
- have visible text
|
|
16
|
+
- have meaningful text
|
|
17
|
+
"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.button
|
|
21
|
+
"
|
|
22
|
+
Buttons in the component must:
|
|
23
|
+
|
|
24
|
+
- accept focus
|
|
25
|
+
- be focusable with a keyboard
|
|
26
|
+
- be usable with a keyboard
|
|
27
|
+
- indicate when they have focus
|
|
28
|
+
- change in appearance when touched (in the touch-down state)
|
|
29
|
+
- change in appearance when hovered
|
|
30
|
+
- be usable with touch
|
|
31
|
+
- be usable with [voice commands](https://www.w3.org/WAI/perspectives/voice.html)
|
|
32
|
+
- have visible text
|
|
33
|
+
- have meaningful text
|
|
34
|
+
"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/app/views/publishing_platform_publishing_components/component_doc/_component_output.html.erb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<% component = capture do %>
|
|
2
|
+
<% if example.has_block? %>
|
|
3
|
+
<%= render component_doc.partial_path, example.html_safe_data do %>
|
|
4
|
+
<%= render inline: example.block %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<% else %>
|
|
7
|
+
<%= render component_doc.partial_path, example.html_safe_data %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
10
|
+
|
|
11
|
+
<% if example.has_embed? %>
|
|
12
|
+
<%= render inline: example.embed, locals: { component: component } %>
|
|
13
|
+
<% else %>
|
|
14
|
+
<%= component %>
|
|
15
|
+
<% end %>
|