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
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<%
|
|
2
|
+
attachment = PublishingPlatformPublishingComponents::Presenters::AttachmentHelper.new(attachment)
|
|
3
|
+
target ||= "_self"
|
|
4
|
+
attributes = []
|
|
5
|
+
local_assigns[:margin_bottom] ||= 3
|
|
6
|
+
shared_helper = PublishingPlatformPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
|
7
|
+
|
|
8
|
+
component_helper = PublishingPlatformPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
|
9
|
+
component_helper.add_class("gem-c-attachment")
|
|
10
|
+
|
|
11
|
+
case attachment.type
|
|
12
|
+
when "file"
|
|
13
|
+
if attachment.content_type_name
|
|
14
|
+
content = if attachment.content_type_abbr
|
|
15
|
+
raw tag.abbr(attachment.content_type.abbr,
|
|
16
|
+
title: attachment.content_type_name,
|
|
17
|
+
class: "gem-c-attachment__abbr")
|
|
18
|
+
else
|
|
19
|
+
attachment.content_type_name
|
|
20
|
+
end
|
|
21
|
+
attributes << tag.span(content, class: "gem-c-attachment__attribute")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
if attachment.file_size
|
|
25
|
+
attributes << tag.span(
|
|
26
|
+
number_to_human_size(attachment.file_size),
|
|
27
|
+
class: "gem-c-attachment__attribute",
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
if attachment.number_of_pages
|
|
32
|
+
attributes << tag.span(
|
|
33
|
+
"#{attachment.number_of_pages} pages",
|
|
34
|
+
class: "gem-c-attachment__attribute",
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
when "html"
|
|
39
|
+
attributes << tag.span(
|
|
40
|
+
"HTML",
|
|
41
|
+
class: "gem-c-attachment__attribute",
|
|
42
|
+
)
|
|
43
|
+
when "external"
|
|
44
|
+
attributes << tag.span(
|
|
45
|
+
attachment.url,
|
|
46
|
+
class: "gem-c-attachment__attribute",
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
%>
|
|
50
|
+
<%= tag.section(**component_helper.all_attributes) do %>
|
|
51
|
+
<%= tag.div class: "gem-c-attachment__thumbnail" do %>
|
|
52
|
+
<%= link_to attachment.url,
|
|
53
|
+
target: target,
|
|
54
|
+
tabindex: "-1",
|
|
55
|
+
"aria-hidden": true do %>
|
|
56
|
+
<% if attachment.thumbnail_url.present? %>
|
|
57
|
+
<% image_tag(attachment.thumbnail_url, alt: "", class: "gem-c-attachment__thumbnail-image gem-c-attachment__thumbnail-image--custom") %>
|
|
58
|
+
<% elsif attachment.html? %>
|
|
59
|
+
<%= render "publishing_platform_publishing_components/components/attachment/thumbnail_html" %>
|
|
60
|
+
<% elsif attachment.document? %>
|
|
61
|
+
<%= render "publishing_platform_publishing_components/components/attachment/thumbnail_document" %>
|
|
62
|
+
<% elsif attachment.spreadsheet? %>
|
|
63
|
+
<%= render "publishing_platform_publishing_components/components/attachment/thumbnail_spreadsheet" %>
|
|
64
|
+
<% elsif attachment.pdf? %>
|
|
65
|
+
<%= render "publishing_platform_publishing_components/components/attachment/thumbnail_pdf" %>
|
|
66
|
+
<% elsif attachment.external? %>
|
|
67
|
+
<%= render "publishing_platform_publishing_components/components/attachment/thumbnail_external" %>
|
|
68
|
+
<% else %>
|
|
69
|
+
<%= render "publishing_platform_publishing_components/components/attachment/thumbnail_generic" %>
|
|
70
|
+
<% end %>
|
|
71
|
+
<% end %>
|
|
72
|
+
<% end %>
|
|
73
|
+
|
|
74
|
+
<%= tag.div class: "gem-c-attachment__details" do %>
|
|
75
|
+
<%= content_tag(shared_helper.get_heading_level, class: "gem-c-attachment__title") do %>
|
|
76
|
+
<%= link_to attachment.title, attachment.url, target: target %>
|
|
77
|
+
<% end %>
|
|
78
|
+
|
|
79
|
+
<% if attachment.reference.present? %>
|
|
80
|
+
<%= tag.p "Ref: #{attachment.reference}", class: "gem-c-attachment__metadata gem-c-attachment__metadata--compact" %>
|
|
81
|
+
<% end %>
|
|
82
|
+
|
|
83
|
+
<% if attributes.any? %>
|
|
84
|
+
<%= tag.p raw(attributes.join(", ")), class: "gem-c-attachment__metadata" %>
|
|
85
|
+
<% end %>
|
|
86
|
+
|
|
87
|
+
<% if attachment.preview_url.present? %>
|
|
88
|
+
<%= tag.p link_to("View online", attachment.preview_url, "aria-label": "View #{attachment.title}", class: "gem-c-attachment__metadata") %>
|
|
89
|
+
<% end %>
|
|
90
|
+
<% end %>
|
|
91
|
+
<% end %>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<%
|
|
2
|
+
id ||= "error-summary-#{SecureRandom.hex(4)}"
|
|
3
|
+
title ||= false
|
|
4
|
+
description ||= false
|
|
5
|
+
items ||= []
|
|
6
|
+
if items.empty? && !title
|
|
7
|
+
raise ArgumentError, "The error_summary component needs at least one item or a title in order to render."
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
component_helper = PublishingPlatformPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
|
11
|
+
component_helper.add_class("gem-c-error-summary alert alert-danger")
|
|
12
|
+
component_helper.add_role("alert")
|
|
13
|
+
%>
|
|
14
|
+
<%= tag.div(**component_helper.all_attributes) do %>
|
|
15
|
+
<% if title %>
|
|
16
|
+
<h2 class="alert-heading"><%= title %></h2>
|
|
17
|
+
<% end %>
|
|
18
|
+
|
|
19
|
+
<% if description %>
|
|
20
|
+
<p><%= description %></p>
|
|
21
|
+
<% end %>
|
|
22
|
+
|
|
23
|
+
<% if items.present? %>
|
|
24
|
+
<ul class="list-unstyled mb-0">
|
|
25
|
+
<% items.each_with_index do |item, index| %>
|
|
26
|
+
<li>
|
|
27
|
+
<% if item[:href] %>
|
|
28
|
+
<%= link_to item[:text], item[:href], target: item[:target], data: item[:data_attributes] %>
|
|
29
|
+
<% else %>
|
|
30
|
+
<%= tag.span data: item[:data_attributes] do %>
|
|
31
|
+
<%= item[:text] %>
|
|
32
|
+
<% end %>
|
|
33
|
+
<% end %>
|
|
34
|
+
</li>
|
|
35
|
+
<% end %>
|
|
36
|
+
</ul>
|
|
37
|
+
<% end %>
|
|
38
|
+
<% end %>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<%
|
|
2
|
+
local_assigns[:heading_level] ||= 3
|
|
3
|
+
local_assigns[:heading_size] ||= 4
|
|
4
|
+
shared_helper = PublishingPlatformPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
|
5
|
+
|
|
6
|
+
title ||= nil
|
|
7
|
+
borderless ||= false
|
|
8
|
+
edit ||= {}
|
|
9
|
+
delete ||= {}
|
|
10
|
+
items ||= []
|
|
11
|
+
block ||= yield
|
|
12
|
+
wide_title ||= false
|
|
13
|
+
|
|
14
|
+
component_helper = PublishingPlatformPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
|
15
|
+
component_helper.add_class("gem-c-summary-list")
|
|
16
|
+
%>
|
|
17
|
+
<% if title || items.any? %>
|
|
18
|
+
<%= tag.div(**component_helper.all_attributes) do %>
|
|
19
|
+
<% if title %>
|
|
20
|
+
<%= content_tag(shared_helper.get_heading_level, title, class: "#{shared_helper.get_heading_size} gem-c-summary-list__group-title") %>
|
|
21
|
+
|
|
22
|
+
<% if edit.any? %>
|
|
23
|
+
<% edit_main_link = capture do %>
|
|
24
|
+
<%
|
|
25
|
+
edit_section_link_text = edit[:link_text] || "Change"
|
|
26
|
+
%>
|
|
27
|
+
<%= link_to edit.fetch(:href),
|
|
28
|
+
data: edit.fetch(:data_attributes, {}) do %>
|
|
29
|
+
<%= edit_section_link_text %><%= tag.span " #{title}", class: "visually-hidden" unless edit[:link_text_no_enhance] -%>
|
|
30
|
+
<% end %>
|
|
31
|
+
<% end %>
|
|
32
|
+
<% end %>
|
|
33
|
+
|
|
34
|
+
<% if delete.any? %>
|
|
35
|
+
<% delete_main_link = capture do %>
|
|
36
|
+
<% delete_section_link_text = delete[:link_text] || "Delete" %>
|
|
37
|
+
<%= link_to delete.fetch(:href),
|
|
38
|
+
class: "link-danger",
|
|
39
|
+
data: delete.fetch(:data_attributes, {}) do %>
|
|
40
|
+
<%= delete_section_link_text %><%= tag.span " #{title}", class: "visually-hidden" unless delete[:link_text_no_enhance] -%>
|
|
41
|
+
<% end %>
|
|
42
|
+
<% end %>
|
|
43
|
+
<% end %>
|
|
44
|
+
|
|
45
|
+
<% if edit_main_link && delete_main_link %>
|
|
46
|
+
<%= tag.ul class: "gem-c-summary-list__actions-list gem-c-summary-list__group-actions-list" do %>
|
|
47
|
+
<%- if edit.any? %>
|
|
48
|
+
<%= tag.li class: "gem-c-summary-list__actions-list-item" do -%>
|
|
49
|
+
<%= edit_main_link %>
|
|
50
|
+
<% end %>
|
|
51
|
+
<% end %>
|
|
52
|
+
<% if delete.any? %>
|
|
53
|
+
<%= tag.li class: "gem-c-summary-list__actions-list-item" do -%>
|
|
54
|
+
<%= delete_main_link %>
|
|
55
|
+
<% end %>
|
|
56
|
+
<% end %>
|
|
57
|
+
<% end %>
|
|
58
|
+
<% else %>
|
|
59
|
+
<%= tag.div class: "gem-c-summary-list__group-actions-list" do %>
|
|
60
|
+
<%= edit_main_link %>
|
|
61
|
+
<%= delete_main_link %>
|
|
62
|
+
<% end %>
|
|
63
|
+
<% end %>
|
|
64
|
+
<% end %>
|
|
65
|
+
|
|
66
|
+
<% any_body_actions = items.detect { |item| item.has_key?("edit") || item.has_key?("delete") } %>
|
|
67
|
+
<% if items.any? %>
|
|
68
|
+
<%= tag.dl class: "gem-c-summary-list__items" do %>
|
|
69
|
+
<% items.each do |item| %>
|
|
70
|
+
<%
|
|
71
|
+
item_body_actions = (item.fetch(:edit, {}).any? || item.fetch(:delete, {}).any?)
|
|
72
|
+
|
|
73
|
+
if any_body_actions.present? && item_body_actions.blank?
|
|
74
|
+
classes = "gem-c-summary-list__row gem-c-summary-list__row--no-actions"
|
|
75
|
+
else
|
|
76
|
+
classes = "gem-c-summary-list__row"
|
|
77
|
+
end
|
|
78
|
+
%>
|
|
79
|
+
<%= tag.div class: classes, data: item[:data] do %>
|
|
80
|
+
|
|
81
|
+
<%= tag.dt item[:field], class: "gem-c-summary-list__key" %>
|
|
82
|
+
<%= tag.dd item[:value], class: "gem-c-summary-list__value" %>
|
|
83
|
+
|
|
84
|
+
<% if item.fetch(:edit, {}).any? %>
|
|
85
|
+
<% edit_link = capture do %>
|
|
86
|
+
<% edit_link_text = item[:edit][:link_text] || "Change" %>
|
|
87
|
+
<%= link_to item[:edit].fetch(:href),
|
|
88
|
+
data: item[:edit].fetch(:data_attributes, {}) do %>
|
|
89
|
+
<%= edit_link_text %>
|
|
90
|
+
<%= tag.span " #{item[:field]}", class: "visually-hidden" unless item[:edit][:link_text_no_enhance] -%>
|
|
91
|
+
<% end %>
|
|
92
|
+
<% end %>
|
|
93
|
+
<% end %>
|
|
94
|
+
|
|
95
|
+
<% if item.fetch(:delete, {}).any? %>
|
|
96
|
+
<% delete_link = capture do %>
|
|
97
|
+
<% delete_link_text = item[:delete][:link_text] || "Delete" %>
|
|
98
|
+
<%= link_to item[:delete].fetch(:href),
|
|
99
|
+
class: "link-danger",
|
|
100
|
+
data: item[:delete].fetch(:data_attributes, {}) do %>
|
|
101
|
+
<%= delete_link_text %>
|
|
102
|
+
<%= tag.span " #{item[:field]}", class: "visually-hidden" unless item[:delete][:link_text_no_enhance] -%>
|
|
103
|
+
<% end %>
|
|
104
|
+
<% end %>
|
|
105
|
+
<% end %>
|
|
106
|
+
|
|
107
|
+
<% if edit_link && delete_link %>
|
|
108
|
+
<%= tag.dd class: "gem-c-summary-list__actions" do %>
|
|
109
|
+
<%= tag.ul class: "gem-c-summary-list__actions-list" do %>
|
|
110
|
+
<% if edit_link %>
|
|
111
|
+
<%= tag.li class: "gem-c-summary-list__actions-list-item" do %>
|
|
112
|
+
<%= edit_link %>
|
|
113
|
+
<% end %>
|
|
114
|
+
<% end %>
|
|
115
|
+
<% if delete_link %>
|
|
116
|
+
<%= tag.li class: "gem-c-summary-list__actions-list-item" do %>
|
|
117
|
+
<%= delete_link %>
|
|
118
|
+
<% end %>
|
|
119
|
+
<% end %>
|
|
120
|
+
<% end %>
|
|
121
|
+
<% end %>
|
|
122
|
+
<% elsif edit_link || delete_link %>
|
|
123
|
+
<%= tag.dd class: "gem-c-summary-list__actions" do %>
|
|
124
|
+
<%= edit_link %>
|
|
125
|
+
<%= delete_link %>
|
|
126
|
+
<% end %>
|
|
127
|
+
<% end %>
|
|
128
|
+
<% end %>
|
|
129
|
+
<% end %>
|
|
130
|
+
<% end %>
|
|
131
|
+
<% end %>
|
|
132
|
+
|
|
133
|
+
<%= tag.div block, class: "gem-c-summary__block" if block %>
|
|
134
|
+
<% end %>
|
|
135
|
+
<% end %>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg class="gem-c-attachment__thumbnail-image gem-c-attachment__thumbnail-image--document" version="1.1" viewBox="0 0 99 140" width="99" height="140" aria-hidden="true">
|
|
2
|
+
<path d="M12 12h75v27H12zM12 59h9v9h-9zM12 77h9v9h-9zM12 95h9v9h-9zM12 113h9v9h-9zM30 59h57v9H30zM30 77h39v9H30zM30 95h57v9H30zM30 113h48v9H30z" stroke-width="0" />
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg class="gem-c-attachment__thumbnail-image gem-c-attachment__thumbnail-image--external" version="1.1" viewBox="0 0 99 140" aria-hidden="true">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M21 59H12V68H21V59ZM30 86V77H69V86H30ZM87 104H30V95H87V104ZM78 122H30V113H78V122ZM21 86H12V77H21V86ZM21 122H12V113H21V122ZM21 104H12V95H21V104ZM87 68H30V59H87V68ZM87 39V12H12V39H87ZM77.9699 29.2919H77.9202L75.2756 17H71.2279L68.5088 29.2919H68.4591L66.1249 17H62.2014L66.1746 34.8047H70.5699L73.2145 22.0409L75.9088 34.8047H80.3289L84.3021 17H80.391L77.9699 29.2919ZM53.8195 29.2919H53.8692L56.2903 17H60.2014L56.2282 34.8047H51.8081L49.1138 22.0409L46.4692 34.8047H42.0739L38.1007 17H42.0242L44.3584 29.2919H44.4081L47.1272 17H51.1749L53.8195 29.2919ZM29.7684 29.2919H29.7188L27.0742 17H23.0265L20.3074 29.2919H20.2577L17.9235 17H14L17.9732 34.8047H22.3685L25.0131 22.0409L27.7074 34.8047H32.1275L36.1007 17H32.1896L29.7684 29.2919Z" />
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg class="gem-c-attachment__thumbnail-image gem-c-attachment__thumbnail-image--generic" version="1.1" viewBox="0 0 84 120" width="84" height="120" aria-hidden="true">
|
|
2
|
+
<path d="M74.85 5v106H5" fill="none" stroke-miterlimit="10" stroke-width="2" />
|
|
3
|
+
<path d="M79.85 10v106H10" fill="none" stroke-miterlimit="10" stroke-width="2" />
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg class="gem-c-attachment__thumbnail-image gem-c-attachment__thumbnail-image--html" version="1.1" viewBox="0 0 99 140" width="99" height="140" aria-hidden="true">
|
|
2
|
+
<path d="M30,95h57v9H30V95z M30,77v9h39v-9H30z M30,122h48v-9H30V122z M12,68h9v-9h-9V68z M12,104h9v-9h-9V104z M12,86h9v-9h-9V86z M12,122h9v-9h-9V122z M87,12v27H12V12H87z M33,17h-4v8h-6v-8h-4v18h4v-7l6,0v7l4,0V17z M49,17H35l0,3h5v15h4V20l5,0V17z M68,17h-4 l-5,6l-5-6h-4v18h4l0-12l5,6l5-6l0,12h4V17z M81,32h-6V17h-4v18h10V32z M30,68h57v-9H30V68z" stroke-width="0" />
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg class="gem-c-attachment__thumbnail-image gem-c-attachment__thumbnail-image--pdf" version="1.1" viewBox="0 0 99 140">
|
|
2
|
+
<path d="M12,59h9v9h-9v-9ZM30,77v9h39v-9H30ZM30,104h57v-9H30v9ZM30,122h48v-9H30v9ZM12,86h9v-9h-9v9ZM12,122h9v-9h-9v9ZM12,104h9v-9h-9v9ZM30,68h57v-9H30v9ZM35.2,21c-.3-.2-.6-.4-1-.5s-.8-.2-1.3-.2h-2.6v5.5h2.6c.5,0,1,0,1.3-.2s.7-.3,1-.5c.3-.2.5-.5.7-.8s.2-.7.2-1.1h0c0-.5,0-.9-.2-1.2-.2-.3-.4-.6-.7-.8h0ZM52.4,21.9c-.4-.5-1-.9-1.6-1.1-.7-.3-1.5-.4-2.4-.4h-2.7v11.5h2.7c.9,0,1.7-.1,2.4-.4s1.2-.7,1.6-1.1c.4-.5.7-1.1.9-1.7.2-.7.3-1.4.3-2.1v-.7c0-.8,0-1.5-.3-2.1-.2-.6-.5-1.2-.9-1.7h0ZM87,12v27H12V12h75ZM39.8,23c0-.9-.1-1.6-.4-2.4-.3-.7-.7-1.4-1.2-1.9-.5-.5-1.2-1-1.9-1.2-.8-.3-1.6-.5-2.5-.5h-7.2v17.9h3.6v-6h3.2c.9,0,1.8-.1,2.6-.5.8-.3,1.4-.7,2-1.2.5-.5,1-1.2,1.3-1.9.3-.7.5-1.5.5-2.4h0ZM57.4,26c0-1.3-.2-2.6-.5-3.7s-.9-2-1.6-2.8c-.7-.8-1.6-1.4-2.7-1.8-1.1-.4-2.3-.6-3.8-.6h-6.6v17.9h6.6c1.5,0,2.7-.2,3.8-.6,1.1-.4,2-1,2.7-1.8.7-.8,1.3-1.7,1.6-2.8.4-1.1.5-2.3.5-3.7h0ZM72.4,17.1h-12.1v17.9h3.6v-7.5h7.8v-3.3h-7.8v-3.8h8.4s0-3.3,0-3.3Z" />
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg class="gem-c-attachment__thumbnail-image gem-c-attachment__thumbnail-image--spreadsheet" version="1.1" viewBox="0 0 99 140" width="99" height="140" aria-hidden="true">
|
|
2
|
+
<path d="M12 12h75v27H12zm0 47h18.75v63H12zm55 2v59H51V61h16m2-2H49v63h20V59z" stroke-width="0" />
|
|
3
|
+
<path d="M49 61.05V120H32.8V61.05H49m2-2H30.75v63H51V59zm34 2V120H69.05V61.05H85m2-2H67v63h20V59z" stroke-width="0" />
|
|
4
|
+
<path d="M30 68.5h56.5M30 77.34h56.5M30 112.7h56.5M30 95.02h56.5M30 86.18h56.5M30 103.86h56.5" fill="none" stroke-miterlimit="10" stroke-width="2" />
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
name: Attachment
|
|
2
|
+
description: Displays a link to download an attachment and metadata about the file
|
|
3
|
+
body: |
|
|
4
|
+
This component shows a link to a document that is attached to Publishing Platform
|
|
5
|
+
content along with a thumbnail and relevant file data.
|
|
6
|
+
|
|
7
|
+
It is intended to be rendered in markdown and as an attachment 'preview' in
|
|
8
|
+
Content Publisher.
|
|
9
|
+
shared_accessibility_criteria:
|
|
10
|
+
- link
|
|
11
|
+
accessibility_criteria: |
|
|
12
|
+
The thumbnail image, and the link wrapping it, must not focusable or shown to
|
|
13
|
+
screenreaders.
|
|
14
|
+
uses_component_wrapper_helper: true
|
|
15
|
+
examples:
|
|
16
|
+
default:
|
|
17
|
+
data:
|
|
18
|
+
attachment:
|
|
19
|
+
title: "Information asset register"
|
|
20
|
+
url: https://assets.publishing.service.publishing-platform.co.uk/uploads/system/uploads/attachment_data/file/747661/information-asset-register.csv
|
|
21
|
+
filename: information-asset-register.csv
|
|
22
|
+
content_type: text/csv
|
|
23
|
+
file_size: 20000
|
|
24
|
+
with_number_of_pages:
|
|
25
|
+
data:
|
|
26
|
+
attachment:
|
|
27
|
+
title: "Temporary snow ploughs: guidance note"
|
|
28
|
+
url: https://assets.publishing.service.publishing-platform.co.uk/uploads/system/uploads/attachment_data/file/259634/temporary-snow-ploughs.pdf
|
|
29
|
+
filename: temporary-snow-ploughs.pdf
|
|
30
|
+
content_type: application/pdf
|
|
31
|
+
file_size: 20000
|
|
32
|
+
number_of_pages: 7
|
|
33
|
+
opendocument:
|
|
34
|
+
data:
|
|
35
|
+
attachment:
|
|
36
|
+
title: "Information Asset Register"
|
|
37
|
+
url: https://assets.publishing.service.publishing-platform.co.uk/uploads/system/uploads/attachment_data/file/744083/Information_Asset_Register_.ods
|
|
38
|
+
filename: Information_Asset_Register_.ods
|
|
39
|
+
content_type: application/vnd.oasis.opendocument.spreadsheet
|
|
40
|
+
file_size: 20000
|
|
41
|
+
# embedded_in_markdown:
|
|
42
|
+
# description: |
|
|
43
|
+
# This component can be embedded in markdown with the `[Attachment:]` code.
|
|
44
|
+
# embed: |
|
|
45
|
+
# <%= render "publishing_platform_publishing_components/components/publishing_platform_markdown" do %>
|
|
46
|
+
# <p>Some text.</p>
|
|
47
|
+
# <%= component %>
|
|
48
|
+
# <% end %>
|
|
49
|
+
# data:
|
|
50
|
+
# attachment:
|
|
51
|
+
# title: "Information asset register"
|
|
52
|
+
# url: https://assets.publishing.service.publishing-platform.co.uk/uploads/system/uploads/attachment_data/file/744083/Information_Asset_Register_.ods
|
|
53
|
+
# filename: Information_Asset_Register_.ods
|
|
54
|
+
# content_type: application/vnd.oasis.opendocument.spreadsheet
|
|
55
|
+
# file_size: 20000
|
|
56
|
+
with_margin_bottom:
|
|
57
|
+
description: The component accepts a number for margin bottom from `0` to `5`. It defaults to no margin bottom.
|
|
58
|
+
data:
|
|
59
|
+
attachment:
|
|
60
|
+
title: "Information asset register"
|
|
61
|
+
url: https://assets.publishing.service.publishing-platform.co.uk/uploads/system/uploads/attachment_data/file/747661/information-asset-register.csv
|
|
62
|
+
filename: information-asset-register.csv
|
|
63
|
+
content_type: application/pdf
|
|
64
|
+
file_size: 20000
|
|
65
|
+
margin_bottom: 9
|
|
66
|
+
with_custom_heading_level:
|
|
67
|
+
description: Default is `h2`.
|
|
68
|
+
data:
|
|
69
|
+
heading_level: 3
|
|
70
|
+
attachment:
|
|
71
|
+
title: "Information asset register"
|
|
72
|
+
url: https://assets.publishing.service.publishing-platform.co.uk/uploads/system/uploads/attachment_data/file/747661/information-asset-register.csv
|
|
73
|
+
filename: information-asset-register.csv
|
|
74
|
+
content_type: text/csv
|
|
75
|
+
file_size: 20000
|
|
76
|
+
pdf_attachment:
|
|
77
|
+
data:
|
|
78
|
+
attachment:
|
|
79
|
+
title: "Temporary snow ploughs: guidance note"
|
|
80
|
+
url: https://assets.publishing.service.publishing-platform.co.uk/uploads/system/uploads/attachment_data/file/259634/temporary-snow-ploughs.pdf
|
|
81
|
+
filename: temporary-snow-ploughs.pdf
|
|
82
|
+
content_type: application/pdf
|
|
83
|
+
file_size: 20000
|
|
84
|
+
with_preview_link:
|
|
85
|
+
data:
|
|
86
|
+
attachment:
|
|
87
|
+
title: "Finance data: February 2018"
|
|
88
|
+
url: https://assets.publishing.service.publishing-platform.co.uk/uploads/system/uploads/attachment_data/file/687542/February_2018_Finance_Data.csv
|
|
89
|
+
filename: February_2018_Finance_Data.csv
|
|
90
|
+
content_type: text/csv
|
|
91
|
+
file_size: 51496
|
|
92
|
+
preview_url: https://assets.publishing.service.publishing-platform.co.uk/uploads/system/uploads/attachment_data/file/687542/February_2018_Finance_Data.csv/preview
|
|
93
|
+
html_attachment:
|
|
94
|
+
data:
|
|
95
|
+
attachment:
|
|
96
|
+
title: "Smart meters: unlocking the future"
|
|
97
|
+
url: https://www.publishing-platform.co.uk/publications/smart-meters-unlocking-the-future/smart-meters-unlocking-the-future
|
|
98
|
+
type: html
|
|
99
|
+
external_attachment:
|
|
100
|
+
data:
|
|
101
|
+
attachment:
|
|
102
|
+
title: "Architects Registration Board annual report 2021"
|
|
103
|
+
url: https://arb.org.uk/wpcontent/uploads/ARBAnnualReportandFinancialStatement2021published.pdf
|
|
104
|
+
type: external
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Form error summary
|
|
2
|
+
description: Used at the top of the page, to summarise validation errors.
|
|
3
|
+
accessibility_criteria: |
|
|
4
|
+
- should be focused on page load, to ensure this error is noticed by assistive tech
|
|
5
|
+
- list of errors should be clickable and focus the inputs with errors
|
|
6
|
+
shared_accessibility_criteria:
|
|
7
|
+
- link
|
|
8
|
+
accessibility_excluded_rules:
|
|
9
|
+
- skip-link # This component is creating references to to sections on the page that do not exist in examples
|
|
10
|
+
examples:
|
|
11
|
+
default:
|
|
12
|
+
data:
|
|
13
|
+
id: error-summary
|
|
14
|
+
title: Message to alert the user to a problem goes here
|
|
15
|
+
description: Optional description of the errors and how to correct them
|
|
16
|
+
items:
|
|
17
|
+
- text: Descriptive link to the question with an error
|
|
18
|
+
href: '#example-error-1'
|
|
19
|
+
with_many_errors:
|
|
20
|
+
data:
|
|
21
|
+
title: Message to alert the user to a problem goes here
|
|
22
|
+
description: Optional description of the errors and how to correct them
|
|
23
|
+
items:
|
|
24
|
+
- text: Descriptive link to the question with an error 1
|
|
25
|
+
href: '#example-error-1'
|
|
26
|
+
- text: Descriptive link to the question with an error 2
|
|
27
|
+
href: '#example-error-2'
|
|
28
|
+
- text: Description of error without link
|
|
29
|
+
with_data_attributes:
|
|
30
|
+
description: |
|
|
31
|
+
The example shown applies a tracking attribute specifically for use by Google Tag Manager.
|
|
32
|
+
|
|
33
|
+
Other data attributes can also be applied as required. Note that the component does not include built in tracking.
|
|
34
|
+
data:
|
|
35
|
+
title: Message to alert the user to a problem goes here
|
|
36
|
+
description: Optional description of the errors and how to correct them
|
|
37
|
+
data_attributes:
|
|
38
|
+
tracking: GTM-123AB
|
|
39
|
+
items:
|
|
40
|
+
- text: Descriptive link to the question with an error 1
|
|
41
|
+
with_custom_target_on_links:
|
|
42
|
+
data:
|
|
43
|
+
title: Message to alert the user to a problem goes here
|
|
44
|
+
description: Optional description of the errors and how to correct them
|
|
45
|
+
items:
|
|
46
|
+
- text: Descriptive link to the question with an error opening in a new window
|
|
47
|
+
href: '#example-error-1'
|
|
48
|
+
target: '_blank'
|
|
49
|
+
- text: Descriptive link to the question with an error opening in the same window
|
|
50
|
+
href: '#example-error-2'
|
|
51
|
+
target: '_self'
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
name: Summary list
|
|
2
|
+
description: Use the summary list to summarise information, for example, a user’s responses at the end of a form.
|
|
3
|
+
body: This component allows the rendering of multiple groups of lists, and actions at the group level.
|
|
4
|
+
accessibility_criteria: |
|
|
5
|
+
Action links in the component must:
|
|
6
|
+
|
|
7
|
+
* indicate what the action refers to (e.g. Change _name_)
|
|
8
|
+
shared_accessibility_criteria:
|
|
9
|
+
- link
|
|
10
|
+
uses_component_wrapper_helper: true
|
|
11
|
+
examples:
|
|
12
|
+
default:
|
|
13
|
+
data: &default-example-data
|
|
14
|
+
title: "Title, summary and body"
|
|
15
|
+
items:
|
|
16
|
+
- field: "Title"
|
|
17
|
+
value: "Ethical standards for public service providers"
|
|
18
|
+
- field: "Summary"
|
|
19
|
+
value: "Find out more about our reviews on the subject of ethical standards for public service providers, including our 2014 report, 2015 guidance and 2018 follow-up publication."
|
|
20
|
+
- field: "Body"
|
|
21
|
+
value: "After the government decided in 2013 to expand the remit of the Committee to include public service providers, the Committee on Standards in Public Life produced our first report on the issue: Ethical Standards for Providers of Public Services in 2014."
|
|
22
|
+
|
|
23
|
+
without_title:
|
|
24
|
+
data:
|
|
25
|
+
items:
|
|
26
|
+
- field: "Title"
|
|
27
|
+
value: "Ethical standards for public service providers"
|
|
28
|
+
- field: "Summary"
|
|
29
|
+
value: "Find out more about our reviews on the subject of ethical standards for public service providers, including our 2014 report, 2015 guidance and 2018 follow-up publication."
|
|
30
|
+
|
|
31
|
+
with_edit_on_section:
|
|
32
|
+
description: For all links shown in the component, see the <a href="/component-guide/summary_list/with_customised_links">with customised links example</a> for guidance.
|
|
33
|
+
data:
|
|
34
|
+
<<: *default-example-data
|
|
35
|
+
edit:
|
|
36
|
+
href: "edit-title-summary-body"
|
|
37
|
+
data_attributes:
|
|
38
|
+
gtm: "edit-title-summary-body"
|
|
39
|
+
|
|
40
|
+
with_delete_on_section:
|
|
41
|
+
description: For all links shown in the component, see the <a href="/component-guide/summary_list/with_customised_links">with customised links example</a> for guidance.
|
|
42
|
+
data:
|
|
43
|
+
<<: *default-example-data
|
|
44
|
+
delete:
|
|
45
|
+
href: "delete-title-summary-body"
|
|
46
|
+
data_attributes:
|
|
47
|
+
gtm: "delete-title-summary-body"
|
|
48
|
+
|
|
49
|
+
with_edit_and_delete_on_section:
|
|
50
|
+
description: For all links shown in the component, see the <a href="/component-guide/summary_list/with_customised_links">with customised links example</a> for guidance.
|
|
51
|
+
data:
|
|
52
|
+
<<: *default-example-data
|
|
53
|
+
edit:
|
|
54
|
+
href: "edit-title-summary-body"
|
|
55
|
+
data_attributes:
|
|
56
|
+
gtm: "edit-title-summary-body"
|
|
57
|
+
delete:
|
|
58
|
+
href: "delete-title-summary-body"
|
|
59
|
+
data_attributes:
|
|
60
|
+
gtm: "delete-title-summary-body"
|
|
61
|
+
|
|
62
|
+
with_customised_links:
|
|
63
|
+
description: |
|
|
64
|
+
For all links shown in the component, visually hidden text containing the name of the thing it refers to is automatically appended. This offers a better experience for screen reader users by making the link text unique and more explicit. In the example below, the link text would be `Change Title, summary and body`.
|
|
65
|
+
|
|
66
|
+
The text of the link can be customised using the `link_text` option. Take care that the provided `link_text` still makes sense to screen readers when combined with the title. For instance, `Reorder` link text and `Items` title becomes `Reorder Items`, which reads fine, but link text of `Summary` would read as `Summary Items`, which does not make sense.
|
|
67
|
+
|
|
68
|
+
To override this behaviour, use `link_text_no_enhance` on the link in question, as shown. This will remove the visually hidden text, allowing you to add your own. The component will render a `span` element with a class of `visually-hidden` included in a passed [capture block](https://apidock.com/rails/ActionView/Helpers/CaptureHelper/capture) as the `link_text` parameter.
|
|
69
|
+
data:
|
|
70
|
+
title: "Title, summary and body"
|
|
71
|
+
items:
|
|
72
|
+
- field: "Title"
|
|
73
|
+
value: "Rural conservation techniques"
|
|
74
|
+
edit:
|
|
75
|
+
href: "edit-title"
|
|
76
|
+
text: "Edit"
|
|
77
|
+
data_attributes:
|
|
78
|
+
gtm: "edit-title"
|
|
79
|
+
- field: "Body"
|
|
80
|
+
value: "Following the land use committee change to overreaching rural byelaws in 2009, further policies were adopted."
|
|
81
|
+
edit:
|
|
82
|
+
href: "edit-body"
|
|
83
|
+
link_text: "Edit"
|
|
84
|
+
delete:
|
|
85
|
+
href: "delete-body"
|
|
86
|
+
link_text: "Remove"
|
|
87
|
+
link_text_no_enhance: true
|
|
88
|
+
edit:
|
|
89
|
+
href: "edit-title-summary-body"
|
|
90
|
+
link_text: Edit this document <span class="visually-hidden">my hidden text for screenreaders</span>
|
|
91
|
+
link_text_no_enhance: true
|
|
92
|
+
|
|
93
|
+
with_custom_section_heading:
|
|
94
|
+
data:
|
|
95
|
+
<<: *default-example-data
|
|
96
|
+
heading_level: 2
|
|
97
|
+
heading_size: 1
|
|
98
|
+
|
|
99
|
+
with_edit_on_some_individual_items:
|
|
100
|
+
description: For all links shown in the component, see the <a href="/component-guide/summary_list/with_customised_links">with customised links example</a> for guidance.
|
|
101
|
+
data:
|
|
102
|
+
title: "Title, summary and body"
|
|
103
|
+
items:
|
|
104
|
+
- field: "Title"
|
|
105
|
+
value: "Ethical standards for public service providers"
|
|
106
|
+
- field: "Summary"
|
|
107
|
+
value: "Find out more about our reviews on the subject of ethical standards for public service providers, including our 2014 report, 2015 guidance and 2018 follow-up publication."
|
|
108
|
+
edit:
|
|
109
|
+
href: "edit-summary"
|
|
110
|
+
delete:
|
|
111
|
+
href: "delete-summary"
|
|
112
|
+
- field: "Body"
|
|
113
|
+
value: "After the government decided in 2013 to expand the remit of the Committee to include public service providers, the Committee on Standards in Public Life produced our first report on the issue: Ethical Standards for Providers of Public Services in 2014."
|
|
114
|
+
edit:
|
|
115
|
+
href: "edit-body"
|
|
116
|
+
link_text: "Edit"
|
|
117
|
+
delete:
|
|
118
|
+
href: "delete-body"
|
|
119
|
+
link_text: "Remove"
|
|
120
|
+
|
|
121
|
+
with_data_attributes:
|
|
122
|
+
description: |
|
|
123
|
+
Data attributes can be passed to individual items within the component as shown.
|
|
124
|
+
data:
|
|
125
|
+
title: "Title, summary and body"
|
|
126
|
+
items:
|
|
127
|
+
- field: "Title"
|
|
128
|
+
value: "Ethical standards for public service providers"
|
|
129
|
+
data:
|
|
130
|
+
module: "something"
|
|
131
|
+
|
|
132
|
+
with_block:
|
|
133
|
+
description: Use the summary list with a block when you need to show an empty state message or load another component.
|
|
134
|
+
data:
|
|
135
|
+
title: "Topics"
|
|
136
|
+
block: |
|
|
137
|
+
<p>No topics specified for this document.</p>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
return unless Rails.application.config.respond_to?(:assets)
|
|
2
|
+
|
|
3
|
+
# Include the govuk_publishing_components manifest into list of assets to
|
|
4
|
+
# be pre-compiled. This allows that the same Sprockets manifest to be used 0
|
|
5
|
+
# with Sprockets 3 and 4 without applications needing to manually require it.
|
|
6
|
+
#
|
|
7
|
+
# In future we may want applications to link directly to this from their
|
|
8
|
+
# manifest file as the use of `config.assets.precompile` is discouraged
|
|
9
|
+
# from version 4: https://github.com/rails/sprockets/blob/58cca17aa447fcee17703e4ab4dbfaab630e7ed4/UPGRADING.md
|
|
10
|
+
Rails.application.config.assets.precompile += %w[publishing_platform_publishing_components_manifest.js]
|
|
11
|
+
|
|
12
|
+
Rails.application.config.assets.paths << Rails.root.join("node_modules")
|
|
13
|
+
|
|
14
|
+
Rails.application.config.assets.paths += %W[
|
|
15
|
+
#{__dir__}/../../node_modules/bootstrap/scss
|
|
16
|
+
#{__dir__}/../../node_modules/
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
# We've experienced segmentation faults when pre-compiling assets with libsass.
|
|
20
|
+
# Disabling Sprockets 4's export_concurrent setting seems to resolve the issues
|
|
21
|
+
# see: https://github.com/rails/sprockets/issues/633
|
|
22
|
+
Rails.application.config.assets.configure do |env|
|
|
23
|
+
env.export_concurrent = false if env.respond_to?(:export_concurrent=)
|
|
24
|
+
end
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module PublishingPlatformPublishingComponents
|
|
2
|
+
def self.configure
|
|
3
|
+
yield(Config)
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
module Config
|
|
7
|
+
APP_COMPONENT_DIRECTORY = "components".freeze
|
|
8
|
+
|
|
9
|
+
def self.component_directory_name
|
|
10
|
+
APP_COMPONENT_DIRECTORY
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.gem_directory
|
|
14
|
+
Gem::Specification.find_by_name("publishing_platform_publishing_components").gem_dir
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.all_stylesheets
|
|
18
|
+
stylesheets = Dir.glob("#{gem_directory}/app/assets/stylesheets/publishing_platform_publishing_components/components/*.scss")
|
|
19
|
+
|
|
20
|
+
stylesheets.index_with do |path|
|
|
21
|
+
"publishing_platform_publishing_components/components/#{File.basename(path, '.*')}.css"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|