-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Take part document #4218
Take part document #4218
Changes from all commits
7bd197f
64e1b6c
5578bb3
1bfaed7
601ca74
540dba8
21e0954
2d16b62
19303b6
75b6e31
e014bc7
3e53100
cb0c966
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@import "govuk_publishing_components/individual_component_support"; | ||
|
||
.app-c-figure { | ||
border-top: 1px solid $govuk-border-colour; | ||
padding-top: govuk-spacing(3); | ||
margin: 0; | ||
margin-bottom: govuk-spacing(8); | ||
|
||
@include govuk-clearfix; | ||
@include govuk-media-query($until: tablet) { | ||
margin-bottom: govuk-spacing(6); | ||
} | ||
} | ||
|
||
.app-c-figure__image { | ||
display: block; | ||
width: 100%; | ||
|
||
@include govuk-media-query($from: tablet) { | ||
float: left; | ||
width: 50%; | ||
} | ||
} | ||
|
||
.app-c-figure__figcaption { | ||
@include govuk-font(16); | ||
|
||
@include govuk-media-query($from: tablet) { | ||
display: block; | ||
vertical-align: top; | ||
box-sizing: border-box; | ||
float: left; | ||
padding-left: govuk-spacing(3); | ||
width: 50%; | ||
} | ||
|
||
@include govuk-media-query($until: tablet) { | ||
margin-top: govuk-spacing(2); | ||
} | ||
} | ||
|
||
.app-c-figure__figcaption-text { | ||
margin: 0; | ||
margin-bottom: govuk-spacing(2); | ||
|
||
@include govuk-font(16); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class TakePartController < ContentItemsController | ||
end |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you link to the files in government-frontend, rather than the commits or the "blame". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,30 @@ def lang_attribute(locale) | |
def page_text_direction | ||
I18n.t("i18n.direction", locale: I18n.locale, default: "ltr") | ||
end | ||
|
||
def native_language_name_for(locale) | ||
I18n.t("language_names.#{locale}", locale:) | ||
end | ||
Comment on lines
+10
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method is in the content item presenter. Could that file be linked to in the commit message as well. |
||
|
||
def translations_for_nav(translations) | ||
KludgeKML marked this conversation as resolved.
Show resolved
Hide resolved
|
||
translations.map do |translation| | ||
{ | ||
locale: translation["locale"], | ||
base_path: translation["base_path"], | ||
text: native_language_name_for(translation["locale"]), | ||
}.tap do |h| | ||
h[:active] = true if h[:locale] == I18n.locale.to_s | ||
end | ||
end | ||
end | ||
|
||
def t_locale_fallback(key, options = {}) | ||
KludgeKML marked this conversation as resolved.
Show resolved
Hide resolved
|
||
options[:locale] = I18n.locale | ||
options[:fallback] = nil | ||
translation = I18n.t(key, **options) | ||
|
||
if translation.nil? || translation.downcase.include?("translation missing") | ||
I18n.default_locale | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<% add_app_component_stylesheet("figure") %> | ||
<% | ||
alt ||= '' | ||
caption ||= '' | ||
credit ||= '' | ||
%> | ||
<figure class="app-c-figure" lang="en"> | ||
<% if src.present? %> | ||
<img class="app-c-figure__image" src="<%= src %>" alt="<%= alt %>"> | ||
<% end %> | ||
<% if caption.present? || credit.present? %> | ||
<figcaption class="app-c-figure__figcaption"> | ||
<% if caption.present? %> | ||
<p class="app-c-figure__figcaption-text"> | ||
<%= caption %> | ||
</p> | ||
<% end %> | ||
<% if credit.present? %> | ||
<p class="app-c-figure__figcaption-text"> | ||
<%= I18n.t("components.figure.image_credit", credit: credit) %> | ||
</p> | ||
<% end %> | ||
</figcaption> | ||
<% end %> | ||
</figure> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Figure | ||
description: A figure containing an image that never exceeds the component’s width | ||
body: | | ||
A figure should be used for images that are referenced within a page, but which can be moved around without affecting the flow of the page [(see guidance here)](https://developer.mozilla.org/en/docs/Web/HTML/Element/figure) | ||
|
||
Examples: | ||
|
||
- [Case Study containing an image](/government/case-studies/2013-elections-in-swaziland) | ||
- [Travel Advice containing a map (image)](/foreign-travel-advice/nepal) | ||
accessibility_criteria: | | ||
The figure must: | ||
|
||
- provide an informative text description, as alt text or caption | ||
|
||
examples: | ||
default: | ||
data: | ||
src: 'https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/54374/s630_the_lords_chamber.jpg' | ||
figure_with_alt_text: | ||
data: | ||
src: 'https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/54374/s630_the_lords_chamber.jpg' | ||
alt: 'An image of the lords chamber' | ||
figure_with_caption: | ||
data: | ||
src: 'https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/54374/s630_the_lords_chamber.jpg' | ||
alt: 'An image of the lords chamber' | ||
caption: 'The Lords Chamber' | ||
right_to_left_with_caption: | ||
data: | ||
src: 'https://assets.publishing.service.gov.uk/government/uploads/system/uploads/image_data/file/31637/s300_Visas_-_Website.jpg' | ||
alt: 'تأشيرات' | ||
caption: 'تأشيرات' | ||
context: | ||
right_to_left: true | ||
figure_with_credit: | ||
data: | ||
src: 'https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/54374/s630_the_lords_chamber.jpg' | ||
credit: Wallis Crankled | ||
figure_with_caption_and_credit: | ||
data: | ||
src: 'https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/54374/s630_the_lords_chamber.jpg' | ||
caption: The Lords Chamber | ||
credit: Wallis Crankled |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<% if @content_item.available_translations.any? %> | ||
<div class="govuk-grid-column-one-third"> | ||
<%= render 'govuk_publishing_components/components/translation_nav', | ||
translations: translations_for_nav(@content_item.available_translations) %> | ||
</div> | ||
<% end %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<% content_for :title do %> | ||
<%= @content_item.title %> - GOV.UK | ||
<% end %> | ||
|
||
<% content_for :extra_headers do %> | ||
<%= render "govuk_publishing_components/components/machine_readable_metadata", { content_item: @content_item.to_h, schema: :article } %> | ||
<meta name="description" content="<%= strip_tags(@content_item.description) %>"> | ||
<% end %> | ||
|
||
|
||
<main role="main" id="content" class="take-part" <%= lang_attribute(@content_item.locale) %>> | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<%= render "govuk_publishing_components/components/title", { | ||
title: @content_item.title, | ||
context: I18n.t("formats.#{@content_item.document_type}", count: 1), | ||
context_locale: t_locale_fallback("formats.#{@content_item.document_type}", count: 1), | ||
} | ||
%> | ||
<%= render "govuk_publishing_components/components/lead_paragraph", text: @content_item.description %> | ||
</div> | ||
|
||
<%= render 'shared/translations' %> | ||
</div> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<%= render 'components/figure', | ||
src: @content_item.image["url"], | ||
alt: @content_item.image["alt_text"], | ||
credit: @content_item.image["credit"], | ||
caption: @content_item.image["caption"] if @content_item.image %> | ||
|
||
<%= render "govuk_publishing_components/components/govspeak", { | ||
direction: page_text_direction | ||
} do %> | ||
<%= raw(@content_item.body) %> | ||
<% end %> | ||
</div> | ||
<%= render 'shared/sidebar_navigation' %> | ||
</div> | ||
</main> | ||
|
||
<%= render 'shared/footer_navigation' %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,89 @@ | ||
--- | ||
ar: | ||
components: | ||
figure: | ||
image_credit: 'حقوق ملكية الصورة: %{credit}' | ||
published_dates: | ||
hidden_heading: | ||
hide_all_updates: إخفاء كافة التحديثات | ||
last_updated: تاريخ آخر تحديث %{date} | ||
published: تاريخ النشر %{date} | ||
see_all_updates: اطلع على كل التحديثات | ||
show_all_updates: إظهار كل التحديثات | ||
formats: | ||
take_part: | ||
few: | ||
many: | ||
one: | ||
other: شارك | ||
two: | ||
zero: | ||
i18n: | ||
direction: rtl | ||
language_names: | ||
ar: العربيَّة | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's great that these locale updates are in a separate commit. Could this commit also link to the locale files rather than a commit diff. Linking to the top-level folder is probably enough. e.g. https://github.com/alphagov/government-frontend/tree/c4bea9e232e929995c4fb5539951cadae8c740c8/config/locales There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
az: | ||
be: | ||
bg: | ||
bn: | ||
cs: | ||
cy: | ||
da: | ||
de: | ||
dr: | ||
el: | ||
en: | ||
es: | ||
es-419: | ||
et: | ||
fa: | ||
fi: | ||
fr: | ||
gd: | ||
gu: | ||
he: | ||
hi: | ||
hr: | ||
hu: | ||
hy: | ||
id: | ||
is: | ||
it: | ||
ja: | ||
ka: | ||
kk: | ||
ko: | ||
lt: | ||
lv: | ||
ms: | ||
mt: | ||
ne: | ||
nl: | ||
'no': | ||
pa: | ||
pa-pk: | ||
pl: | ||
ps: | ||
pt: | ||
ro: | ||
ru: | ||
si: | ||
sk: | ||
sl: | ||
so: | ||
sq: | ||
sr: | ||
sv: | ||
sw: | ||
ta: | ||
th: | ||
tk: | ||
tr: | ||
uk: | ||
ur: | ||
uz: | ||
vi: | ||
yi: | ||
zh: | ||
zh-hk: | ||
zh-tw: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The content of this commit looks good, but can you update commit message to point to the actual files in government-frontend rather than the commits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done