govuk_publishing_components 24.4.1 → 24.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +7 -5
- data/app/assets/javascripts/govuk_publishing_components/components/details.js +2 -1
- data/app/assets/javascripts/govuk_publishing_components/components/reorderable-list.js +108 -0
- data/app/assets/javascripts/govuk_publishing_components/lib/header-navigation.js +6 -2
- data/app/assets/javascripts/govuk_publishing_components/modules.js +3 -1
- data/app/assets/stylesheets/component_guide/application.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components_print.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +10 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +8 -7
- data/app/assets/stylesheets/govuk_publishing_components/components/_reorderable-list.scss +117 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +15 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_summary-list.scss +12 -0
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +48 -7
- data/app/views/govuk_publishing_components/components/_layout_header.html.erb +15 -12
- data/app/views/govuk_publishing_components/components/_list.html.erb +5 -5
- data/app/views/govuk_publishing_components/components/_reorderable_list.html.erb +45 -0
- data/app/views/govuk_publishing_components/components/_search.html.erb +27 -16
- data/app/views/govuk_publishing_components/components/_summary_list.html.erb +73 -31
- data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +3 -0
- data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +26 -0
- data/app/views/govuk_publishing_components/components/docs/reorderable_list.yml +85 -0
- data/app/views/govuk_publishing_components/components/docs/search.yml +10 -0
- data/app/views/govuk_publishing_components/components/docs/summary_list.yml +50 -19
- data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +8 -1
- data/app/views/govuk_publishing_components/components/layout_header/_search.html.erb +17 -3
- data/config/locales/ar.yml +1 -0
- data/config/locales/az.yml +1 -0
- data/config/locales/be.yml +1 -0
- data/config/locales/bg.yml +1 -0
- data/config/locales/bn.yml +1 -0
- data/config/locales/cs.yml +1 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +1 -0
- data/config/locales/dr.yml +1 -0
- data/config/locales/el.yml +1 -0
- data/config/locales/en.yml +24 -16
- data/config/locales/es-419.yml +1 -0
- data/config/locales/es.yml +1 -0
- data/config/locales/fa.yml +1 -0
- data/config/locales/fi.yml +1 -0
- data/config/locales/gd.yml +1 -0
- data/config/locales/gu.yml +1 -0
- data/config/locales/he.yml +1 -0
- data/config/locales/hi.yml +1 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +1 -0
- data/config/locales/hy.yml +1 -0
- data/config/locales/id.yml +1 -0
- data/config/locales/is.yml +1 -0
- data/config/locales/it.yml +1 -0
- data/config/locales/ja.yml +1 -0
- data/config/locales/ka.yml +1 -0
- data/config/locales/kk.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +1 -0
- data/config/locales/ms.yml +1 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +1 -0
- data/config/locales/no.yml +1 -0
- data/config/locales/pa-pk.yml +1 -0
- data/config/locales/pa.yml +1 -0
- data/config/locales/pl.yml +1 -0
- data/config/locales/ps.yml +1 -0
- data/config/locales/pt.yml +1 -0
- data/config/locales/ro.yml +1 -0
- data/config/locales/ru.yml +1 -0
- data/config/locales/si.yml +1 -0
- data/config/locales/sk.yml +1 -0
- data/config/locales/sl.yml +1 -0
- data/config/locales/so.yml +1 -0
- data/config/locales/sq.yml +1 -0
- data/config/locales/sr.yml +1 -0
- data/config/locales/sv.yml +1 -0
- data/config/locales/sw.yml +1 -0
- data/config/locales/ta.yml +1 -0
- data/config/locales/th.yml +1 -0
- data/config/locales/tk.yml +1 -0
- data/config/locales/tr.yml +1 -0
- data/config/locales/uk.yml +1 -0
- data/config/locales/ur.yml +1 -0
- data/config/locales/uz.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-hk.yml +1 -0
- data/config/locales/zh-tw.yml +1 -0
- data/config/locales/zh.yml +1 -0
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +5 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/sortablejs/LICENSE +21 -0
- data/node_modules/sortablejs/README.md +815 -0
- data/node_modules/sortablejs/Sortable.js +3721 -0
- data/node_modules/sortablejs/Sortable.min.js +2 -0
- data/node_modules/sortablejs/modular/sortable.complete.esm.js +3713 -0
- data/node_modules/sortablejs/modular/sortable.core.esm.js +3710 -0
- data/node_modules/sortablejs/modular/sortable.esm.js +3711 -0
- data/node_modules/sortablejs/package.json +56 -0
- metadata +78 -6
@@ -38,3 +38,15 @@
|
|
38
38
|
.gem-c-summary__block {
|
39
39
|
@include govuk-responsive-margin(6, "bottom");
|
40
40
|
}
|
41
|
+
|
42
|
+
.gem-c-summary-list--wide-title {
|
43
|
+
@include govuk-media-query($from: 'tablet') {
|
44
|
+
.govuk-summary-list__key {
|
45
|
+
width: 60%;
|
46
|
+
}
|
47
|
+
|
48
|
+
.govuk-summary-list__value {
|
49
|
+
width: 20%;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
@@ -1,10 +1,33 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
html_lang ||= "en"
|
2
|
+
emergency_banner ||= nil
|
4
3
|
full_width ||= false
|
4
|
+
global_bar ||= nil
|
5
|
+
html_lang ||= "en"
|
6
|
+
layout_helper = GovukPublishingComponents::Presenters::PublicLayoutHelper.new(local_assigns)
|
7
|
+
navigation_items ||= []
|
5
8
|
omit_header ||= false
|
6
9
|
show_search = local_assigns.include?(:show_search) ? local_assigns[:show_search] : true
|
7
|
-
|
10
|
+
title ||= "GOV.UK - The best place to find government services and information"
|
11
|
+
|
12
|
+
# This is a hack - but it's the only way I can find to not have two blue bars on
|
13
|
+
# constrained width layouts.
|
14
|
+
#
|
15
|
+
# The full width layout hides the blue bar underneath the blar header bar - so
|
16
|
+
# full width pages won't see the blue bar unless it's added by another component
|
17
|
+
# - and for most pages that component is the global banner.
|
18
|
+
#
|
19
|
+
# The constrained width layout doesn't hide the blue bar - so having the global
|
20
|
+
# banner on a constrained width layout means there are two blue bars.
|
21
|
+
#
|
22
|
+
# The global banner is shown with JavaScript, so users without JavaScript won't
|
23
|
+
# see it. So the constrained width blue bar can't be turned off as then it'll be
|
24
|
+
# off for everyone.
|
25
|
+
#
|
26
|
+
# This booleon adds a CSS class that shifts the banners up by the blue bar's
|
27
|
+
# height, making the two blue bars overlap and appear as one. The class is added
|
28
|
+
# when a) there's content for the emergency or global banner *and* b) when using
|
29
|
+
# the contrained width layout.
|
30
|
+
blue_bar_dedupe = !full_width && global_bar.present?
|
8
31
|
-%>
|
9
32
|
<!DOCTYPE html>
|
10
33
|
<!--[if lt IE 9]><html class="lte-ie8" lang="<%= html_lang %>"><![endif]-->
|
@@ -48,13 +71,31 @@
|
|
48
71
|
<% unless omit_header %>
|
49
72
|
<%= render "govuk_publishing_components/components/layout_header", {
|
50
73
|
search: show_search,
|
51
|
-
|
52
|
-
|
74
|
+
navigation_items: navigation_items,
|
75
|
+
|
76
|
+
# The (blue) bottom border needs to be underneath the emergency banner -
|
77
|
+
# so it has been turned off and added in manually.
|
78
|
+
remove_bottom_border: true,
|
53
79
|
} %>
|
54
80
|
<% end %>
|
55
|
-
|
81
|
+
|
82
|
+
<%= raw(emergency_banner) %>
|
83
|
+
|
84
|
+
<% unless full_width %>
|
85
|
+
<div class="gem-c-layout-for-public__blue-bar govuk-width-container"></div>
|
86
|
+
<% end %>
|
87
|
+
|
88
|
+
<% if global_bar.present? %>
|
89
|
+
<%= content_tag("div", {
|
90
|
+
class: blue_bar_dedupe ? "gem-c-layout-for-public__global-banner-wrapper" : nil,
|
91
|
+
}) do %>
|
92
|
+
<%= raw(global_bar) %>
|
93
|
+
<% end %>
|
94
|
+
<% end %>
|
95
|
+
|
96
|
+
<div id="wrapper" class="<%= "govuk-width-container" unless full_width %>">
|
56
97
|
<%= yield :before_content %>
|
57
|
-
<main class="govuk-main-wrapper">
|
98
|
+
<main class="govuk-main-wrapper" id="content">
|
58
99
|
<%= yield %>
|
59
100
|
</main>
|
60
101
|
</div>
|
@@ -1,16 +1,15 @@
|
|
1
1
|
<%
|
2
|
-
product_name ||= nil
|
3
2
|
environment ||= nil
|
4
3
|
full_width ||= false
|
5
|
-
search ||= false
|
6
|
-
search_left ||= false
|
7
|
-
navigation_items ||= []
|
8
4
|
navigation_aria_label ||= "Top level"
|
5
|
+
navigation_items ||= []
|
6
|
+
product_name ||= nil
|
9
7
|
remove_bottom_border ||= false
|
8
|
+
search ||= false
|
10
9
|
search_left ||= false
|
11
10
|
width_class = full_width ? "govuk-header__container--full-width" : "govuk-width-container"
|
12
11
|
|
13
|
-
header_classes = %w
|
12
|
+
header_classes = %w[gem-c-layout-header govuk-header]
|
14
13
|
header_classes << "gem-c-layout-header--#{environment}" if environment
|
15
14
|
header_classes << "gem-c-layout-header--no-bottom-border" if remove_bottom_border
|
16
15
|
header_classes << "gem-c-layout-header--search-left" if search_left
|
@@ -28,18 +27,22 @@
|
|
28
27
|
<div class="govuk-grid-column-full govuk-grid-column-one-third-from-desktop gem-c-layout-header__search">
|
29
28
|
<%= render "govuk_publishing_components/components/layout_header/search" %>
|
30
29
|
</div>
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
<% if navigation_items.any? %>
|
31
|
+
<div class="govuk-header__content gem-c-header__content govuk-grid-column-full">
|
32
|
+
<%= render "govuk_publishing_components/components/layout_header/navigation_items", navigation_items: navigation_items, navigation_aria_label: navigation_aria_label %>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
34
35
|
</div>
|
35
36
|
<% else %>
|
36
|
-
<div class="govuk-grid-row
|
37
|
+
<div class="govuk-grid-row">
|
37
38
|
<div class="gem-c-layout-header__logo govuk-grid-column-two-thirds">
|
38
39
|
<%= render "govuk_publishing_components/components/layout_header/header_logo", environment: environment, product_name: product_name %>
|
39
40
|
</div>
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
<% if navigation_items.any? %>
|
42
|
+
<div class="govuk-header__content gem-c-header__content govuk-grid-column-full">
|
43
|
+
<%= render "govuk_publishing_components/components/layout_header/navigation_items", navigation_items: navigation_items, navigation_aria_label: navigation_aria_label %>
|
44
|
+
</div>
|
45
|
+
<% end %>
|
43
46
|
<% if search %>
|
44
47
|
<div class="govuk-grid-column-one-third gem-c-layout-header__search">
|
45
48
|
<%= render "govuk_publishing_components/components/layout_header/search" %>
|
@@ -1,12 +1,12 @@
|
|
1
1
|
<%
|
2
|
-
|
2
|
+
aria_label ||= nil
|
3
3
|
extra_spacing ||= nil
|
4
|
+
id ||= nil
|
5
|
+
items ||= []
|
4
6
|
list_type ||= "unordered"
|
5
7
|
visible_counters ||= nil
|
6
|
-
items ||= []
|
7
|
-
aria_label ||= nil
|
8
8
|
|
9
|
-
classes = %w
|
9
|
+
classes = %w[gem-c-list govuk-list]
|
10
10
|
classes << "govuk-list--bullet" if visible_counters && list_type === "unordered"
|
11
11
|
classes << "govuk-list--number" if visible_counters && list_type === "number"
|
12
12
|
classes << "govuk-list--spaced" if extra_spacing
|
@@ -20,7 +20,7 @@
|
|
20
20
|
<% if items.any? %>
|
21
21
|
<%= content_tag list_tag, class: classes, id: id, "aria-label": aria_label do %>
|
22
22
|
<% items.each do |item| %>
|
23
|
-
<li><%=
|
23
|
+
<li><%= raw(item) %></li>
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
26
|
<% end %>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<%
|
2
|
+
items ||= []
|
3
|
+
input_name ||= "ordering"
|
4
|
+
data_attributes ||= {}
|
5
|
+
data_attributes[:module] = "reorderable-list"
|
6
|
+
%>
|
7
|
+
|
8
|
+
<%= tag.ol class: "gem-c-reorderable-list", data: data_attributes do %>
|
9
|
+
<% items.each_with_index do |item, index| %>
|
10
|
+
<%= tag.li class: "gem-c-reorderable-list__item" do %>
|
11
|
+
<%= tag.div class: "gem-c-reorderable-list__wrapper" do %>
|
12
|
+
<%= tag.div class: "gem-c-reorderable-list__content" do %>
|
13
|
+
<%= tag.p item[:title], class: "gem-c-reorderable-list__title" %>
|
14
|
+
<%= tag.p(item[:description], class: "gem-c-reorderable-list__description") if item[:description].present? %>
|
15
|
+
<% end %>
|
16
|
+
<%= tag.div class: "gem-c-reorderable-list__actions" do %>
|
17
|
+
<% label_text = capture do %>
|
18
|
+
Position<span class='govuk-visually-hidden'> for <%= item[:title] %></span>
|
19
|
+
<% end %>
|
20
|
+
<%= render "govuk_publishing_components/components/input", {
|
21
|
+
label: { text: label_text },
|
22
|
+
name: "#{input_name}[#{item[:id]}]",
|
23
|
+
type: "number",
|
24
|
+
value: index + 1,
|
25
|
+
width: 2
|
26
|
+
} %>
|
27
|
+
<%= render "govuk_publishing_components/components/button", {
|
28
|
+
text: "Up",
|
29
|
+
type: "button",
|
30
|
+
aria_label: "Move \"#{item[:title]}\" up",
|
31
|
+
classes: "js-reorderable-list-up",
|
32
|
+
secondary_solid: true
|
33
|
+
} %>
|
34
|
+
<%= render "govuk_publishing_components/components/button", {
|
35
|
+
text: "Down",
|
36
|
+
type: "button",
|
37
|
+
aria_label: "Move \"#{item[:title]}\" down",
|
38
|
+
classes: "js-reorderable-list-down",
|
39
|
+
secondary_solid: true
|
40
|
+
} %>
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
43
|
+
<% end %>
|
44
|
+
<% end %>
|
45
|
+
<% end %>
|
@@ -1,11 +1,19 @@
|
|
1
1
|
<%
|
2
|
-
size ||= ""
|
3
|
-
no_border ||= false
|
4
2
|
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
5
|
-
|
3
|
+
|
4
|
+
aria_controls ||= nil
|
5
|
+
button_text ||= t("components.search_box.search_button")
|
6
|
+
id ||= "search-main-" + SecureRandom.hex(4)
|
7
|
+
label_text ||= t("components.search_box.label")
|
8
|
+
name ||= "q"
|
9
|
+
no_border ||= false
|
10
|
+
size ||= ""
|
11
|
+
value ||= ""
|
12
|
+
|
13
|
+
classes = %w[gem-c-search]
|
6
14
|
classes << (shared_helper.get_margin_top)
|
7
15
|
classes << (shared_helper.get_margin_bottom) if local_assigns[:margin_bottom]
|
8
|
-
classes << "gem-c-search--large" if size ==
|
16
|
+
classes << "gem-c-search--large" if size == "large"
|
9
17
|
classes << "gem-c-search--no-border" if no_border
|
10
18
|
if local_assigns[:on_govuk_blue].eql?(true)
|
11
19
|
classes << "gem-c-search--on-govuk-blue"
|
@@ -13,25 +21,28 @@
|
|
13
21
|
classes << "gem-c-search--on-white"
|
14
22
|
end
|
15
23
|
classes << "gem-c-search--separate-label" if local_assigns.include?(:inline_label)
|
16
|
-
|
17
|
-
value ||= ""
|
18
|
-
id ||= "search-main-" + SecureRandom.hex(4)
|
19
|
-
label_text ||= "Search on GOV.UK"
|
20
|
-
name ||= 'q'
|
21
|
-
aria_controls ||= nil
|
22
24
|
%>
|
23
25
|
|
24
|
-
<div class="<%= classes.join(
|
26
|
+
<div class="<%= classes.join(" ") %>" data-module="gem-toggle-input-class-on-focus">
|
25
27
|
<label for="<%= id %>" class="gem-c-search__label">
|
26
28
|
<%= label_text %>
|
27
29
|
</label>
|
28
30
|
<div class="gem-c-search__item-wrapper">
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
<%= tag.input(
|
32
|
+
aria: {
|
33
|
+
controls: aria_controls,
|
34
|
+
},
|
35
|
+
class: "gem-c-search__item gem-c-search__input js-class-toggle",
|
36
|
+
id: id,
|
37
|
+
name: name,
|
38
|
+
title: t("components.search_box.input_title"),
|
39
|
+
type: "search",
|
40
|
+
value: value,
|
41
|
+
) %>
|
33
42
|
<div class="gem-c-search__item gem-c-search__submit-wrapper">
|
34
|
-
<button
|
43
|
+
<button class="gem-c-search__submit" type="submit">
|
44
|
+
<%= button_text %>
|
45
|
+
</button>
|
35
46
|
</div>
|
36
47
|
</div>
|
37
48
|
</div>
|
@@ -10,37 +10,59 @@
|
|
10
10
|
delete ||= {}
|
11
11
|
items ||= []
|
12
12
|
block ||= yield
|
13
|
+
wide_title ||= false
|
13
14
|
%>
|
14
15
|
<% if title || items.any? %>
|
15
|
-
<%= tag.div class: "gem-c-summary-list #{"govuk-summary-list--no-border" if borderless}", id: id do %>
|
16
|
+
<%= tag.div class: "gem-c-summary-list #{"govuk-summary-list--no-border" if borderless} #{"gem-c-summary-list--wide-title" if wide_title}", id: id do %>
|
16
17
|
<% if title %>
|
17
18
|
<%= content_tag(shared_helper.get_heading_level, title, class: "govuk-heading-#{heading_size} gem-c-summary-list__group-title") %>
|
18
|
-
|
19
|
+
|
20
|
+
<% if edit.any? %>
|
21
|
+
<% edit_main_link = capture do %>
|
22
|
+
<%
|
23
|
+
edit_section_link_text = edit[:link_text] || t("components.summary_list.edit")
|
24
|
+
%>
|
25
|
+
<%= link_to edit.fetch(:href),
|
26
|
+
class: "govuk-link",
|
27
|
+
data: edit.fetch(:data_attributes, {}) do %>
|
28
|
+
<%= edit_section_link_text %><%= tag.span " #{title}", class: "govuk-visually-hidden" unless edit[:link_text_no_enhance] -%>
|
29
|
+
<% end %>
|
30
|
+
<% end %>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
<% if delete.any? %>
|
34
|
+
<% delete_main_link = capture do %>
|
35
|
+
<%
|
36
|
+
delete_section_link_text = delete[:link_text] || t("components.summary_list.delete")
|
37
|
+
%>
|
38
|
+
<%= link_to delete.fetch(:href),
|
39
|
+
class: "govuk-link gem-link--destructive",
|
40
|
+
data: delete.fetch(:data_attributes, {}) do %>
|
41
|
+
<%= delete_section_link_text %><%= tag.span " #{title}", class: "govuk-visually-hidden" unless delete[:link_text_no_enhance] -%>
|
42
|
+
<% end %>
|
43
|
+
<% end %>
|
44
|
+
<% end %>
|
45
|
+
|
46
|
+
<% if edit_main_link && delete_main_link %>
|
19
47
|
<%= tag.ul class: "govuk-summary-list__actions-list gem-c-summary-list__group-actions-list" do %>
|
20
48
|
<%- if edit.any? %>
|
21
|
-
<% edit_section_link_text = edit[:link_text] || t("components.summary_list.edit") %>
|
22
49
|
<%= tag.li class: "govuk-summary-list__actions-list-item" do -%>
|
23
|
-
<%=
|
24
|
-
class: "govuk-link",
|
25
|
-
title: "#{edit_section_link_text} #{title}",
|
26
|
-
data: edit.fetch(:data_attributes, {}) do %>
|
27
|
-
<%= edit_section_link_text %><%= tag.span " #{title}", class: "govuk-visually-hidden" -%>
|
28
|
-
<% end %>
|
50
|
+
<%= edit_main_link %>
|
29
51
|
<% end %>
|
30
52
|
<% end %>
|
31
53
|
<% if delete.any? %>
|
32
|
-
<% delete_section_link_text = delete[:link_text] || t("components.summary_list.delete") %>
|
33
54
|
<%= tag.li class: "govuk-summary-list__actions-list-item" do -%>
|
34
|
-
<%=
|
35
|
-
class: "govuk-link gem-link--destructive",
|
36
|
-
title: "#{delete_section_link_text} #{title}",
|
37
|
-
data: delete.fetch(:data_attributes, {}) do %>
|
38
|
-
<%= delete_section_link_text %><%= tag.span " #{title}", class: "govuk-visually-hidden" -%>
|
39
|
-
<% end %>
|
55
|
+
<%= delete_main_link %>
|
40
56
|
<% end %>
|
41
57
|
<% end %>
|
42
58
|
<% end %>
|
59
|
+
<% else %>
|
60
|
+
<%= tag.div class: "govuk-summary-list__actions-list gem-c-summary-list__group-actions-list" do %>
|
61
|
+
<%= edit_main_link %>
|
62
|
+
<%= delete_main_link %>
|
63
|
+
<% end %>
|
43
64
|
<% end %>
|
65
|
+
|
44
66
|
<% end %>
|
45
67
|
|
46
68
|
<% if items.any? %>
|
@@ -51,34 +73,54 @@
|
|
51
73
|
<%= tag.dt item[:field], class: "govuk-summary-list__key" %>
|
52
74
|
<%= tag.dd item[:value], class: "govuk-summary-list__value" %>
|
53
75
|
|
54
|
-
<% if item.fetch(:edit, {}).any?
|
76
|
+
<% if item.fetch(:edit, {}).any? %>
|
77
|
+
<% edit_link = capture do %>
|
78
|
+
<%
|
79
|
+
edit_link_text = item[:edit][:link_text] || t("components.summary_list.edit")
|
80
|
+
%>
|
81
|
+
<%= link_to item[:edit].fetch(:href),
|
82
|
+
class: "govuk-link",
|
83
|
+
data: item[:edit].fetch(:data_attributes, {}) do %>
|
84
|
+
<%= edit_link_text %><%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" unless item[:edit][:link_text_no_enhance] -%>
|
85
|
+
<% end %>
|
86
|
+
<% end %>
|
87
|
+
<% end %>
|
88
|
+
|
89
|
+
<% if item.fetch(:delete, {}).any? %>
|
90
|
+
<% delete_link = capture do %>
|
91
|
+
<%
|
92
|
+
delete_link_text = item[:delete][:link_text] || t("components.summary_list.delete")
|
93
|
+
%>
|
94
|
+
<%= link_to item[:delete].fetch(:href),
|
95
|
+
class: "govuk-link gem-link--destructive",
|
96
|
+
data: item[:delete].fetch(:data_attributes, {}) do %>
|
97
|
+
<%= delete_link_text %><%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" unless item[:delete][:link_text_no_enhance] -%>
|
98
|
+
<% end %>
|
99
|
+
<% end %>
|
100
|
+
<% end %>
|
101
|
+
|
102
|
+
<% if edit_link && delete_link %>
|
55
103
|
<%= tag.dd class: "govuk-summary-list__actions" do %>
|
56
104
|
<%= tag.ul class: "govuk-summary-list__actions-list" do %>
|
57
105
|
<% if item.fetch(:edit, {}).any? %>
|
58
106
|
<%= tag.li class: "govuk-summary-list__actions-list-item" do %>
|
59
|
-
|
60
|
-
<%= link_to item[:edit].fetch(:href),
|
61
|
-
class: "govuk-link",
|
62
|
-
title: "#{edit_link_text} #{item[:field]}",
|
63
|
-
data: item[:edit].fetch(:data_attributes, {}) do %>
|
64
|
-
<%= edit_link_text %><%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" -%>
|
65
|
-
<% end %>
|
107
|
+
<%= edit_link %>
|
66
108
|
<% end %>
|
67
109
|
<% end %>
|
68
110
|
<% if item.fetch(:delete, {}).any? %>
|
69
111
|
<%= tag.li class: "govuk-summary-list__actions-list-item" do %>
|
70
|
-
|
71
|
-
<%= link_to item[:delete].fetch(:href),
|
72
|
-
class: "govuk-link gem-link--destructive",
|
73
|
-
title: "#{delete_link_text} #{item[:field]}",
|
74
|
-
data: item[:delete].fetch(:data_attributes, {}) do %>
|
75
|
-
<%= delete_link_text %><%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" -%>
|
76
|
-
<% end %>
|
112
|
+
<%= delete_link %>
|
77
113
|
<% end %>
|
78
114
|
<% end %>
|
79
115
|
<% end %>
|
80
116
|
<% end %>
|
117
|
+
<% else %>
|
118
|
+
<%= tag.dd class: "govuk-summary-list__actions" do %>
|
119
|
+
<%= edit_link %>
|
120
|
+
<%= delete_link %>
|
121
|
+
<% end %>
|
81
122
|
<% end %>
|
123
|
+
|
82
124
|
<% end %>
|
83
125
|
<% end %>
|
84
126
|
<% end %>
|
@@ -155,6 +155,7 @@ examples:
|
|
155
155
|
content_item:
|
156
156
|
title: "Transport news story"
|
157
157
|
content_id: "3c402d90-fe77-49b9-a8aa-1800d4fc2b3d"
|
158
|
+
locale: "en"
|
158
159
|
links:
|
159
160
|
ordered_related_items:
|
160
161
|
- title: Find an apprenticeship
|
@@ -180,6 +181,7 @@ examples:
|
|
180
181
|
content_item:
|
181
182
|
title: "30 creative teams awarded up to £100,000 each for Festival UK* 2022 R&D project"
|
182
183
|
content_id: "c3752802-f091-43a9-ba90-33568fccf391"
|
184
|
+
locale: "en"
|
183
185
|
links:
|
184
186
|
ordered_related_items:
|
185
187
|
- title: Find an apprenticeship
|
@@ -205,6 +207,7 @@ examples:
|
|
205
207
|
content_item:
|
206
208
|
title: "Local transport news story"
|
207
209
|
content_id: "5c82db20-7631-11e4-a3cb-005056011aef"
|
210
|
+
locale: "en"
|
208
211
|
links:
|
209
212
|
ordered_related_items:
|
210
213
|
- title: Find an apprenticeship
|