publishing_platform_publishing_components 0.1.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd01d35952a87cf92b3a809b7628e56626ece151e2d565e50a01b3f2b9f2e061
4
- data.tar.gz: ba093a8a4bdaf481ee512f9591b1e8c5c1ac07e7c47b282d67d6e6040b6d4b65
3
+ metadata.gz: 880dc872b87762ba00037fcc59c2837f5cddc7a797659a266d4787766332bb50
4
+ data.tar.gz: c6290dcd1ded6493eaf8d12cdb4d00d98faacd96427617a43111bd41556a8e59
5
5
  SHA512:
6
- metadata.gz: 3d2483aaec570385b5ccb72fa91d69f6a823e4759f89bcca713ad1581611a7ddf7e2dda58ceb02f6443bfb25467039828530f78d25e84baf9fd5987768eb334c
7
- data.tar.gz: 0eec104aef8ff7d932dbffc0b218707c8ba0c7032d9d89c62b4c025baea141693ed3a7886f813499717ffc4add6eaf82b5407e3da1d7be8369263767d3660a33
6
+ metadata.gz: c68380feededbb45e24b3671262a57d233181c097d4cd970583fb36ac6a3c3d76c248ffc1b6939aaae2541f2b38349a6f4af1481355245f26d5e92ccd46e9c2c
7
+ data.tar.gz: 44aef9f3d4b325fc07173b7c8bb7353c7341e6b0730adc9f04665a828306f271f27aa560f4f0208f4a818c6957466a18782f5a638e1d1dee2fe6a0a84aea93d0
@@ -1,3 +1,5 @@
1
1
  @import "bootstrap";
2
2
  @import "components/attachment";
3
+ @import "components/attachment-link";
4
+ @import "components/layout";
3
5
  @import "components/summary-list";
@@ -0,0 +1,21 @@
1
+ @import 'functions';
2
+ @import 'variables';
3
+ @import 'mixins';
4
+
5
+ .gem-c-attachment-link__abbr {
6
+ text-decoration: none !important;
7
+ cursor: help;
8
+ }
9
+
10
+ // stylelint-disable declaration-no-important
11
+ @media print {
12
+ .gem-c-attachment-link .govuk-link {
13
+ color: $black!important;
14
+
15
+ &::after {
16
+ font-size: inherit;
17
+ color: inherit;
18
+ }
19
+ }
20
+ }
21
+ // stylelint-enable declaration-no-important
@@ -0,0 +1,3 @@
1
+ .gem-c-layout {
2
+ max-width: 960px !important;
3
+ }
@@ -0,0 +1,38 @@
1
+ <%
2
+ attachment = PublishingPlatformPublishingComponents::Presenters::AttachmentHelper.new(attachment)
3
+ target ||= nil
4
+ attributes = []
5
+ if attachment.content_type_name
6
+ content = if attachment.content_type_abbr
7
+ raw tag.abbr(attachment.content_type.abbr,
8
+ title: attachment.content_type_name,
9
+ class: "gem-c-attachment-link__abbr")
10
+ else
11
+ attachment.content_type_name
12
+ end
13
+
14
+ attributes << tag.span(content, class: "gem-c-attachment-link__attribute")
15
+ end
16
+
17
+ if attachment.file_size
18
+ attributes << tag.span(
19
+ number_to_human_size(attachment.file_size),
20
+ class: "gem-c-attachment-link__attribute",
21
+ )
22
+ end
23
+
24
+ if attachment.number_of_pages
25
+ attributes << tag.span(
26
+ "#{attachment.number_of_pages} pages",
27
+ class: "gem-c-attachment-link__attribute",
28
+ )
29
+ end
30
+
31
+ component_helper = PublishingPlatformPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
32
+ component_helper.add_class("gem-c-attachment-link")
33
+ %>
34
+ <%= tag.span(**component_helper.all_attributes) do %>
35
+ <%= link_to(attachment.title, attachment.url,
36
+ target: target) -%>
37
+ <%= raw("(#{attributes.join(', ')})") if attributes.any? -%>
38
+ <% end %>
@@ -0,0 +1,40 @@
1
+ <%
2
+
3
+ title ||= "Publishing Platform"
4
+ navigation_items ||= []
5
+
6
+ -%>
7
+
8
+ <!DOCTYPE html>
9
+ <html>
10
+ <head>
11
+ <%= tag.title title %>
12
+ <meta name="viewport" content="width=device-width,initial-scale=1">
13
+ <%= csrf_meta_tags %>
14
+ <%= csp_meta_tag %>
15
+
16
+ <%= stylesheet_link_tag "application" %>
17
+
18
+ <%= yield :head %>
19
+ </head>
20
+ <body>
21
+ <div class="gem-c-layout container py-3">
22
+ <header class="d-flex flex-wrap align-items-center justify-content-center justify-content-md-between py-3 mb-4 border-bottom">
23
+ <div class="col-md-3 mb-2 mb-md-0">
24
+ <a href="/" class="d-flex align-items-center link-body-emphasis text-decoration-none">
25
+ <span class="fs-4">Publishing Platform</span>
26
+ </a>
27
+ </div>
28
+ <% if navigation_items.present? %>
29
+ <%= render "publishing_platform_publishing_components/components/navigation", { navigation_items: }%>
30
+ <% end %>
31
+ </header>
32
+
33
+ <main>
34
+ <%= yield %>
35
+ </main>
36
+ </div>
37
+ <%= javascript_include_tag "application" %>
38
+ </body>
39
+ </html>
40
+
@@ -0,0 +1,20 @@
1
+ <%
2
+ navigation_items ||= []
3
+ -%>
4
+ <% if navigation_items.present? %>
5
+ <ul class="gem-c-navigation nav col-12 col-md-auto mb-2 justify-content-center mb-md-0">
6
+ <% navigation_items.each_with_index do |item, index| %>
7
+ <%
8
+ link_classes = %w(py-2 link-body-emphasis text-decoration-none)
9
+ link_classes << "me-3" unless index == navigation_items.size() -1
10
+ %>
11
+ <li>
12
+ <%= link_to(
13
+ item[:text],
14
+ item[:href],
15
+ class: link_classes
16
+ ) %>
17
+ </li>
18
+ <% end %>
19
+ </ul>
20
+ <% end %>
@@ -4,12 +4,10 @@
4
4
  shared_helper = PublishingPlatformPublishingComponents::Presenters::SharedHelper.new(local_assigns)
5
5
 
6
6
  title ||= nil
7
- borderless ||= false
8
7
  edit ||= {}
9
8
  delete ||= {}
10
9
  items ||= []
11
10
  block ||= yield
12
- wide_title ||= false
13
11
 
14
12
  component_helper = PublishingPlatformPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
15
13
  component_helper.add_class("gem-c-summary-list")
@@ -0,0 +1,61 @@
1
+ name: Attachment link
2
+ description: A link to a file with metadata of the file contents
3
+ body: |
4
+ This component provides a means to show a link to an attachment with some
5
+ relevant file data.
6
+
7
+ It is expected to be embedded inside an element that provides text styles
8
+ so does not provide its own text styling.
9
+ accessibility_criteria: |
10
+ All touch targets (e.g the attachment link) must be 24px large, or leave sufficient space (target-size). See [Understanding Success Criterion 2.5.8: Target Size (Minimum))](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html).
11
+
12
+ To achieve this, you can embed the attachment link within another element that maintains sufficient space above and below the target. For instance, you can place individual links inside a paragraph element, or as a list item.
13
+
14
+ Attachment links within paragraphs of text do not need to meet the 24 by 24 CSS pixels requirements.
15
+ shared_accessibility_criteria:
16
+ - link
17
+ uses_component_wrapper_helper: true
18
+ examples:
19
+ default:
20
+ data:
21
+ attachment:
22
+ title: "Temporary snow ploughs: guidance note"
23
+ url: https://assets.publishing.service.publishing-platform.co.uk/uploads/system/uploads/attachment_data/file/259634/temporary-snow-ploughs.pdf
24
+ filename: temporary-snow-ploughs.pdf
25
+ content_type: application/pdf
26
+ file_size: 20000
27
+ number_of_pages: 1
28
+ embedded_in_paragraph:
29
+ embed: |
30
+ <p>
31
+ <%= component %>
32
+ </p>
33
+ data:
34
+ attachment:
35
+ title: "Temporary snow ploughs: guidance note"
36
+ url: https://assets.publishing.service.publishing-platform.co.uk/uploads/system/uploads/attachment_data/file/259634/temporary-snow-ploughs.pdf
37
+ filename: temporary-snow-ploughs.pdf
38
+ content_type: application/pdf
39
+ file_size: 20000
40
+ number_of_pages: 1
41
+ embedded_in_markdown:
42
+ description: |
43
+ This component can be embedded in markdown with the `[AttachmentLink:]` code.
44
+ embed: |
45
+ <%= render "publishing_platform_publishing_components/components/publishing_platform_markdown" do %>
46
+ <p>Some introductory information about <%= component %>.</p>
47
+ <% end %>
48
+ data:
49
+ attachment:
50
+ title: "Temporary snow ploughs: guidance note"
51
+ url: https://assets.publishing.service.publishing-platform.co.uk/uploads/system/uploads/attachment_data/file/259634/temporary-snow-ploughs.pdf
52
+ filename: temporary-snow-ploughs.pdf
53
+ content_type: application/pdf
54
+ file_size: 20000
55
+ number_of_pages: 1
56
+ with_target_blank:
57
+ data:
58
+ attachment:
59
+ title: "Temporary snow ploughs: guidance note"
60
+ url: https://assets.publishing.service.publishing-platform.co.uk/uploads/system/uploads/attachment_data/file/259634/temporary-snow-ploughs.pdf
61
+ target: _blank
@@ -0,0 +1,21 @@
1
+ name: Navigation
2
+ description: The navigation used by the layout component.
3
+ body: |
4
+ shared_accessibility_criteria:
5
+ - link
6
+ accessibility_criteria: |
7
+ The component must:
8
+
9
+ * have a text contrast ratio higher than 4.5:1 against the background colour to meet WCAG AA
10
+ * follow the expected tabbing border
11
+ * allow menus to be closed when the escape key is pressed
12
+ examples:
13
+ default:
14
+ data:
15
+ navigation_items:
16
+ - text: Example link 1
17
+ href: "#"
18
+ - text: Example link 2
19
+ href: "#"
20
+ - text: Example link 3
21
+ href: "#"
@@ -1,3 +1,3 @@
1
1
  module PublishingPlatformPublishingComponents
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: publishing_platform_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Publishing Platform
@@ -175,7 +175,9 @@ files:
175
175
  - app/assets/config/publishing_platform_publishing_components_manifest.js
176
176
  - app/assets/images/publishing_platform_publishing_components/gemkeep
177
177
  - app/assets/stylesheets/publishing_platform_publishing_components/_all_components.scss
178
+ - app/assets/stylesheets/publishing_platform_publishing_components/components/_attachment-link.scss
178
179
  - app/assets/stylesheets/publishing_platform_publishing_components/components/_attachment.scss
180
+ - app/assets/stylesheets/publishing_platform_publishing_components/components/_layout.scss
179
181
  - app/assets/stylesheets/publishing_platform_publishing_components/components/_summary-list.scss
180
182
  - app/controllers/publishing_platform_publishing_components/application_controller.rb
181
183
  - app/helpers/publishing_platform_publishing_components/application_helper.rb
@@ -185,7 +187,10 @@ files:
185
187
  - app/models/publishing_platform_publishing_components/shared_accessibility_criteria.rb
186
188
  - app/views/publishing_platform_publishing_components/component_doc/_component_output.html.erb
187
189
  - app/views/publishing_platform_publishing_components/components/_attachment.html.erb
190
+ - app/views/publishing_platform_publishing_components/components/_attachment_link.html.erb
188
191
  - app/views/publishing_platform_publishing_components/components/_error_summary.html.erb
192
+ - app/views/publishing_platform_publishing_components/components/_layout.html.erb
193
+ - app/views/publishing_platform_publishing_components/components/_navigation.html.erb
189
194
  - app/views/publishing_platform_publishing_components/components/_summary_list.html.erb
190
195
  - app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_document.html.erb
191
196
  - app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_external.html.erb
@@ -194,7 +199,9 @@ files:
194
199
  - app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_pdf.html.erb
195
200
  - app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_spreadsheet.html.erb
196
201
  - app/views/publishing_platform_publishing_components/components/docs/attachment.yml
202
+ - app/views/publishing_platform_publishing_components/components/docs/attachment_link.yml
197
203
  - app/views/publishing_platform_publishing_components/components/docs/error_summary.yml
204
+ - app/views/publishing_platform_publishing_components/components/docs/navigation.yml
198
205
  - app/views/publishing_platform_publishing_components/components/docs/summary_list.yml
199
206
  - config/initializers/assets.rb
200
207
  - config/routes.rb