Skip to content

Commit

Permalink
Add "Claim 2i" button
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtrussler committed May 31, 2024
1 parent 7cd4e6f commit 5537dec
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 20 deletions.
23 changes: 16 additions & 7 deletions app/assets/stylesheets/components/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
border-bottom: 0;
}

button {
border: none;
padding: 0;
.govuk-accordion__section-heading {
button {
border: none;
padding: 0;
}
}
}

Expand Down Expand Up @@ -91,6 +93,17 @@

.govuk-table__cell {
border-bottom: 0;
padding: 0 govuk-spacing(2);

.govuk-accordion__section-content {
position: relative;

& > button {
position: absolute;
top: govuk-spacing(2);
right: 0;
}
}
}

.govuk-accordion {
Expand All @@ -105,10 +118,6 @@
.gem-c-summary__block {
margin-bottom: 0;
}

.govuk-table__cell {
padding: 0 govuk-spacing(2);
}
}
}

Expand Down
50 changes: 37 additions & 13 deletions app/views/components/_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,43 @@
<% rows.each_with_index do |row, rowindex| %>
<%
summary = render "govuk_publishing_components/components/summary_list", {
items: [
{field: "Edition", value: row[:edition]},
{field: "Format", value: row[:format]},
*([{field: "Important Note", value: row[:note]}] if row[:note].present?),
*([{field: "Awaiting review", value: row[:awaiting_review]}] if row[:awaiting_review].present?),
*([{field: "Reviewer", value: row[:reviewer]}] if row[:reviewer].present?),
*([{field: "Sent Out", value: row[:sent]}] if row[:sent].present?),
*([{field: "Scheduled", value: row[:scheduled]}] if row[:scheduled].present?),
*([{field: "Published by", value: row[:published]}] if row[:published].present?)
],
borderless: true
}
if row[:status] === "Awaiting 2i"
button = render "govuk_publishing_components/components/button", {
text: "Claim 2i"
}
else
button = nil
end

if button
summary = button + (render "govuk_publishing_components/components/summary_list", {
items: [
{field: "Edition", value: row[:edition]},
{field: "Format", value: row[:format]},
*([{field: "Important Note", value: row[:note]}] if row[:note].present?),
*([{field: "Awaiting review", value: row[:awaiting_review]}] if row[:awaiting_review].present?),
*([{field: "2i reviewer", value: row[:reviewer]}] if row[:reviewer].present?),
*([{field: "Sent Out", value: row[:sent]}] if row[:sent].present?),
*([{field: "Scheduled", value: row[:scheduled]}] if row[:scheduled].present?),
*([{field: "Published by", value: row[:published]}] if row[:published].present?)
],
borderless: true
})
else
summary = render "govuk_publishing_components/components/summary_list", {
items: [
{field: "Edition", value: row[:edition]},
{field: "Format", value: row[:format]},
*([{field: "Important Note", value: row[:note]}] if row[:note].present?),
*([{field: "Awaiting review", value: row[:awaiting_review]}] if row[:awaiting_review].present?),
*([{field: "2i reviewer", value: row[:reviewer]}] if row[:reviewer].present?),
*([{field: "Sent Out", value: row[:sent]}] if row[:sent].present?),
*([{field: "Scheduled", value: row[:scheduled]}] if row[:scheduled].present?),
*([{field: "Published by", value: row[:published]}] if row[:published].present?)
],
borderless: true
}
end

accordion = render "govuk_publishing_components/components/accordion", {
disable_ga4: true,
Expand Down

0 comments on commit 5537dec

Please sign in to comment.