govuk_publishing_components 16.1.0 → 16.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_textarea.scss +4 -0
- data/app/views/govuk_publishing_components/components/_accordion.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_back_link.html.erb +6 -6
- data/app/views/govuk_publishing_components/components/_details.html.erb +10 -3
- data/app/views/govuk_publishing_components/components/_heading.html.erb +2 -1
- data/app/views/govuk_publishing_components/components/_hint.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_image_card.html.erb +2 -1
- data/app/views/govuk_publishing_components/components/_subscription-links.html.erb +5 -2
- data/app/views/govuk_publishing_components/components/_textarea.html.erb +7 -4
- data/app/views/govuk_publishing_components/components/docs/back_link.yml +5 -0
- data/app/views/govuk_publishing_components/components/docs/textarea.yml +7 -0
- data/lib/govuk_publishing_components.rb +1 -1
- data/lib/govuk_publishing_components/presenters/heading_helper.rb +0 -2
- data/lib/govuk_publishing_components/presenters/image_card_helper.rb +0 -6
- data/lib/govuk_publishing_components/presenters/shared_helper.rb +23 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/package.json +1 -1
- metadata +3 -3
- data/lib/govuk_publishing_components/presenters/accordion_helper.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8194e57a52a4ba7a9d41fb80f0dd76903f299fac60f35e2b45fa8d2803c51d5
|
4
|
+
data.tar.gz: 130f165b192cbc3a54d1c87d0cabd5ab0b17f2e6c1907fb43735c028f9bf387d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2de1d21a69fb4a855c07d06e241abdc570c182933c84c3af06889e8978742d74f9bbae3596ff9fb6382239b9f2b9ae433186f23ea2df267d479359e9ac776a84
|
7
|
+
data.tar.gz: bd1673a83c3b7acfd8d95d1d6922c2ace5336fe7d31adefb6b9401caef5a43321632a3b48221bdd6dc0db0ba3069172512a1a011919bdf936c4cbec2ce052a9c
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%
|
2
|
-
|
2
|
+
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
3
3
|
|
4
4
|
id ||= "default-id-#{SecureRandom.hex(4)}"
|
5
5
|
items ||= []
|
@@ -31,7 +31,7 @@
|
|
31
31
|
<div class="govuk-accordion__section-header">
|
32
32
|
<%=
|
33
33
|
content_tag(
|
34
|
-
|
34
|
+
shared_helper.get_heading_level,
|
35
35
|
content_tag('span', item[:heading][:text], class: "govuk-accordion__section-button", id: "#{id}-heading-#{index}", data: item[:data_attributes]),
|
36
36
|
class: 'govuk-accordion__section-heading'
|
37
37
|
)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<%
|
2
2
|
text ||= t('components.back_link.back')
|
3
|
+
data_attributes ||= nil
|
3
4
|
%>
|
4
|
-
<%= link_to
|
5
|
+
<%= link_to(
|
6
|
+
text,
|
5
7
|
href,
|
6
|
-
class: %w(
|
7
|
-
|
8
|
-
|
9
|
-
)
|
10
|
-
%>
|
8
|
+
class: %w(gem-c-back-link govuk-back-link),
|
9
|
+
data: data_attributes
|
10
|
+
) %>
|
@@ -1,6 +1,13 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
|
1
|
+
<%
|
2
|
+
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
3
|
+
|
4
|
+
data_attributes ||= nil
|
5
|
+
open ||= nil
|
6
|
+
margin_bottom ||= 3
|
7
|
+
css_classes = %w(gem-c-details govuk-details)
|
8
|
+
css_classes << (shared_helper.get_margin_bottom)
|
9
|
+
%>
|
10
|
+
<%= tag.details class: css_classes, data: data_attributes, open: open do %>
|
4
11
|
<summary class="govuk-details__summary">
|
5
12
|
<span class="govuk-details__summary-text">
|
6
13
|
<%= title %>
|
@@ -2,8 +2,9 @@
|
|
2
2
|
brand ||= false
|
3
3
|
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
4
4
|
heading_helper = GovukPublishingComponents::Presenters::HeadingHelper.new(local_assigns)
|
5
|
+
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
5
6
|
%>
|
6
|
-
<%= content_tag(
|
7
|
+
<%= content_tag(shared_helper.get_heading_level, text,
|
7
8
|
class: "gem-c-heading #{heading_helper.classes} #{brand_helper.brand_class} #{brand_helper.border_color_class}",
|
8
9
|
id: heading_helper.id
|
9
10
|
) %>
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%
|
2
2
|
id ||= "hint-#{SecureRandom.hex(4)}"
|
3
|
-
|
3
|
+
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
4
4
|
|
5
5
|
css_classes = %w( gem-c-hint govuk-hint )
|
6
|
-
css_classes << (
|
6
|
+
css_classes << (shared_helper.get_margin_bottom)
|
7
7
|
%>
|
8
8
|
|
9
9
|
<%= tag.span id: id, class: css_classes do %>
|
@@ -2,6 +2,7 @@
|
|
2
2
|
brand ||= false
|
3
3
|
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
4
4
|
card_helper = GovukPublishingComponents::Presenters::ImageCardHelper.new(local_assigns)
|
5
|
+
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
5
6
|
%>
|
6
7
|
<% if card_helper.href || card_helper.extra_links.any? %>
|
7
8
|
<div class="gem-c-image-card <%= "gem-c-image-card--large" if card_helper.large %> <%= brand_helper.brand_class %>"
|
@@ -13,7 +14,7 @@
|
|
13
14
|
<%= card_helper.context %>
|
14
15
|
|
15
16
|
<% if card_helper.heading_text %>
|
16
|
-
<%= content_tag(
|
17
|
+
<%= content_tag(shared_helper.get_heading_level,
|
17
18
|
class: "gem-c-image-card__title") do %>
|
18
19
|
<% if card_helper.href %>
|
19
20
|
<%= link_to card_helper.heading_text, card_helper.href,
|
@@ -1,11 +1,14 @@
|
|
1
1
|
<%
|
2
2
|
brand ||= false
|
3
|
-
margin_bottom ||= 0
|
4
3
|
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
5
4
|
sl_helper = GovukPublishingComponents::Presenters::SubscriptionLinksHelper.new(local_assigns)
|
5
|
+
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
6
|
+
|
7
|
+
local_assigns[:margin_bottom] ||= 0
|
8
|
+
local_assigns[:margin_bottom] = 0 if local_assigns[:margin_bottom] > 9
|
6
9
|
|
7
10
|
css_classes = %w( gem-c-subscription-links )
|
8
|
-
css_classes << (
|
11
|
+
css_classes << (shared_helper.get_margin_bottom) unless local_assigns[:margin_bottom] == 0
|
9
12
|
css_classes << brand_helper.brand_class
|
10
13
|
data = {"module": "gem-toggle"} if sl_helper.feed_link_box_value
|
11
14
|
%>
|
@@ -7,7 +7,8 @@
|
|
7
7
|
|
8
8
|
label ||= nil
|
9
9
|
hint ||= nil
|
10
|
-
margin_bottom ||=
|
10
|
+
local_assigns[:margin_bottom] ||= 6
|
11
|
+
local_assigns[:margin_bottom] = 6 if local_assigns[:margin_bottom] > 9
|
11
12
|
error_message ||= nil
|
12
13
|
error_items ||= nil
|
13
14
|
character_count ||= nil
|
@@ -16,12 +17,14 @@
|
|
16
17
|
has_error ||= error_message || error_items&.any?
|
17
18
|
error_id = "error-#{SecureRandom.hex(4)}"
|
18
19
|
|
19
|
-
|
20
|
+
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
21
|
+
|
22
|
+
css_classes = %w(govuk-textarea)
|
20
23
|
css_classes << "js-character-count" if character_count
|
21
24
|
css_classes << "govuk-textarea--error" if has_error
|
22
|
-
|
23
|
-
form_group_css_classes = %w(govuk-form-group)
|
25
|
+
form_group_css_classes = %w(gem-c-textarea govuk-form-group)
|
24
26
|
form_group_css_classes << "govuk-form-group--error" if has_error
|
27
|
+
form_group_css_classes << (shared_helper.get_margin_bottom)
|
25
28
|
|
26
29
|
aria_described_by ||= nil
|
27
30
|
if hint || has_error
|
@@ -20,6 +20,13 @@ examples:
|
|
20
20
|
label:
|
21
21
|
text: "Can you provide more detail?"
|
22
22
|
name: "more-detail"
|
23
|
+
with_margin_bottom:
|
24
|
+
description: The component accepts a number for margin bottom from 0 to 9 (0px to 60px) using the [GOV.UK Frontend spacing scale](http://govuk-frontend-review.herokuapp.com/docs/#settings/spacing-variable-govuk-spacing-points). It defaults to a margin bottom of 6 (30px).
|
25
|
+
data:
|
26
|
+
margin_bottom: 9
|
27
|
+
label:
|
28
|
+
text: "Can you provide more detail?"
|
29
|
+
name: "more-detail"
|
23
30
|
specific_rows:
|
24
31
|
description: Textarea with 10 rows
|
25
32
|
data:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "govuk_publishing_components/config"
|
2
2
|
require "govuk_publishing_components/engine"
|
3
|
-
require "govuk_publishing_components/presenters/
|
3
|
+
require "govuk_publishing_components/presenters/shared_helper"
|
4
4
|
require "govuk_publishing_components/presenters/breadcrumbs"
|
5
5
|
require "govuk_publishing_components/presenters/button_helper"
|
6
6
|
require "govuk_publishing_components/presenters/contextual_navigation"
|
@@ -16,7 +16,6 @@ module GovukPublishingComponents
|
|
16
16
|
@description = local_assigns[:description]
|
17
17
|
@large = local_assigns[:large]
|
18
18
|
@heading_text = local_assigns[:heading_text]
|
19
|
-
@heading_level = local_assigns[:heading_level] || 2
|
20
19
|
@extra_links_no_indent = local_assigns[:extra_links_no_indent]
|
21
20
|
@metadata = local_assigns[:metadata]
|
22
21
|
end
|
@@ -59,11 +58,6 @@ module GovukPublishingComponents
|
|
59
58
|
end
|
60
59
|
end
|
61
60
|
|
62
|
-
def heading_tag
|
63
|
-
return "h#{@heading_level}" if [1, 2, 3, 4, 5, 6].include? @heading_level
|
64
|
-
return "span" if @heading_level.zero?
|
65
|
-
end
|
66
|
-
|
67
61
|
def description
|
68
62
|
content_tag(:div, @description, class: "gem-c-image-card__description") if @description
|
69
63
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module GovukPublishingComponents
|
2
|
+
module Presenters
|
3
|
+
class SharedHelper
|
4
|
+
attr_reader :options, :margin_bottom, :heading_level
|
5
|
+
|
6
|
+
def initialize(local_assigns)
|
7
|
+
@options = local_assigns
|
8
|
+
@margin_bottom = @options[:margin_bottom] || 3
|
9
|
+
@heading_level = @options[:heading_level] || 2
|
10
|
+
end
|
11
|
+
|
12
|
+
def get_margin_bottom
|
13
|
+
[*0..9].include?(@margin_bottom) ? "govuk-!-margin-bottom-#{margin_bottom}" : "govuk-!-margin-bottom-3"
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_heading_level
|
17
|
+
return [*1..6].include?(@heading_level) ? "h#{@heading_level}" : "h2" unless @heading_level.zero?
|
18
|
+
|
19
|
+
"span"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"/"
|
50
50
|
],
|
51
51
|
"_resolved": "git://github.com/alphagov/accessible-autocomplete.git#0c518b4fa79b9a95b544410858486ed9e6403c84",
|
52
|
-
"_shasum": "
|
52
|
+
"_shasum": "3766842c6201eea1fb4369b0494b7539e51bb988",
|
53
53
|
"_shrinkwrap": null,
|
54
54
|
"_spec": "accessible-autocomplete@git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
55
55
|
"_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 16.
|
4
|
+
version: 16.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govspeak
|
@@ -594,7 +594,6 @@ files:
|
|
594
594
|
- lib/govuk_publishing_components/config.rb
|
595
595
|
- lib/govuk_publishing_components/engine.rb
|
596
596
|
- lib/govuk_publishing_components/minitest/component_guide_test.rb
|
597
|
-
- lib/govuk_publishing_components/presenters/accordion_helper.rb
|
598
597
|
- lib/govuk_publishing_components/presenters/breadcrumbs.rb
|
599
598
|
- lib/govuk_publishing_components/presenters/button_helper.rb
|
600
599
|
- lib/govuk_publishing_components/presenters/checkboxes_helper.rb
|
@@ -622,6 +621,7 @@ files:
|
|
622
621
|
- lib/govuk_publishing_components/presenters/schema_org.rb
|
623
622
|
- lib/govuk_publishing_components/presenters/select.rb
|
624
623
|
- lib/govuk_publishing_components/presenters/services.rb
|
624
|
+
- lib/govuk_publishing_components/presenters/shared_helper.rb
|
625
625
|
- lib/govuk_publishing_components/presenters/step_by_step_nav_helper.rb
|
626
626
|
- lib/govuk_publishing_components/presenters/subscription_links_helper.rb
|
627
627
|
- lib/govuk_publishing_components/presenters/taxonomy_list_helper.rb
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module GovukPublishingComponents
|
2
|
-
module Presenters
|
3
|
-
class AccordionHelper
|
4
|
-
attr_reader :heading_tag
|
5
|
-
|
6
|
-
def initialize(options)
|
7
|
-
@heading_tag = "h2"
|
8
|
-
@heading_tag = "h#{options[:heading_level]}" if [1, 2, 3, 4, 5, 6].include? options[:heading_level]
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|