Skip to content

Commit

Permalink
Merge pull request #250 from alphagov/corp-about-parts
Browse files Browse the repository at this point in the history
Render further corporate information at bottom of about pages
  • Loading branch information
fofr committed Feb 20, 2017
2 parents 9f4ec27 + ddd0fe7 commit d74a05c
Show file tree
Hide file tree
Showing 55 changed files with 631 additions and 2 deletions.
78 changes: 78 additions & 0 deletions app/presenters/corporate_information_groups.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
module CorporateInformationGroups
include Linkable

def corporate_information?
corporate_information_groups.any?
end

def corporate_information
corporate_information_groups.map do |group|
{
heading: content_tag(:h3, group["name"], id: group_title_id(group["name"])),
links: normalised_group_links(group)
}
end
end

def corporate_information_heading_tag
content_tag(:h2, corporate_information_heading[:text], id: corporate_information_heading[:id])
end

def further_information
[
further_information_about("publication_scheme"),
further_information_about("welsh_language_scheme"),
further_information_about("personal_information_charter"),
further_information_about("social_media_use"),
further_information_about("about_our_services")
].join(' ').html_safe
end

private

def further_information_link(type)
link = corporate_information_page_links.find { |l| l["document_type"] == type }
link_to(link["title"], link["base_path"]) if link
end

def further_information_about(type)
link = further_information_link(type)
I18n.t("corporate_information_page.#{type}_html", link: link) if link
end

def corporate_information_heading
heading_text = I18n.t('corporate_information_page.corporate_information')

{
text: heading_text,
id: group_title_id(heading_text)
}
end

def group_title_id(title)
title.tr(' ', '-').downcase
end

def normalised_group_links(group)
group["contents"].map do |group_item|
normalised_group_item_link(group_item)
end
end

def normalised_group_item_link(group_item)
if group_item.is_a?(String)
group_item_link = corporate_information_page_links.find { |l| l["content_id"] == group_item }
link_to(group_item_link["title"], group_item_link["base_path"])
else
link_to(group_item["title"], group_item["path"] || group_item["url"])
end
end

def corporate_information_page_links
expanded_links_from_content_item('corporate_information_pages')
end

def corporate_information_groups
content_item["details"]["corporate_information_groups"] || []
end
end
11 changes: 11 additions & 0 deletions app/presenters/corporate_information_page_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class CorporateInformationPagePresenter < ContentItemPresenter
include ContentsList
include TitleAndContext
include OrganisationBranding
include CorporateInformationGroups

def body
content_item["details"]["body"]
Expand All @@ -18,8 +19,18 @@ def title_and_context
end
end

def contents_items
super + extra_headings
end

private

def extra_headings
extra_headings = []
extra_headings << corporate_information_heading if corporate_information?
extra_headings
end

def default_organisation
organisation_content_id = content_item["details"]["organisation"]
organisation = content_item["links"]["organisations"].detect do |org|
Expand Down
24 changes: 23 additions & 1 deletion app/views/content_items/corporate_information_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,30 @@
</div>
<% end %>
<div class="column-two-thirds <% unless @content_item.contents.any? %>offset-one-third<% end %>">
<% @additional_body = capture do %>
<% if @content_item.corporate_information? %>
<%= @content_item.corporate_information_heading_tag %>
<% @content_item.corporate_information.each do |group| %>
<%= group[:heading] %>
<ul>
<% group[:links].each do |link| %>
<li>
<%= link %>
</li>
<% end %>
</ul>
<% end %>
<% if @content_item.further_information.present? %>
<p>
<%= @content_item.further_information %>
</p>
<% end %>
<% end %>
<% end %>
<%= render 'govuk_component/govspeak',
content: "#{@content_item.body}",
content: "#{@content_item.body}#{@additional_body}",
direction: page_text_direction %>
</div>
</div>
Expand Down
9 changes: 9 additions & 0 deletions config/locales/ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,12 @@ ar:
few:
many:
other: "وثائق"
corporate_information_page:
corporate_information: معلومات عن الوزارة
publication_scheme_html: إقرأ عن أنواع المعلومات التي ننشرها بشكل روتيني في موقعنا
%{link} الرابط.
personal_information_charter_html: "%{link} يشرح كيفية التعامل مع المعلومات الشخصية
الخاصة بك"
welsh_language_scheme_html: معرفة التزامنا النشر في%{link} الرابط.
social_media_use_html: اقرأ عن سياستنا تجاه %{link}
about_our_services_html:
7 changes: 7 additions & 0 deletions config/locales/az.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,10 @@ az:
documents:
one:
other:
corporate_information_page:
corporate_information:
publication_scheme_html:
personal_information_charter_html:
welsh_language_scheme_html:
social_media_use_html:
about_our_services_html:
9 changes: 9 additions & 0 deletions config/locales/be.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,12 @@ be:
few:
many:
other: "Дакументы"
corporate_information_page:
corporate_information: Карпаратыўная інфармацыя
publication_scheme_html: Чытайце пра тыпы інфармацыі, якую мы рэгулярна публікуем,
у нашым %{link}.
personal_information_charter_html: Наша %{link} тлумачыць, як мы ставімся да
Вашай асабістай інфармацыі.
welsh_language_scheme_html: Даведайцеся аб нашых абавязках да публікацыі ў %{link}.
social_media_use_html: Прачытайце пра нашу палітыку датычна %{link}.
about_our_services_html:
10 changes: 10 additions & 0 deletions config/locales/bg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,13 @@ bg:
documents:
one: "Документ"
other: "Документи"
corporate_information_page:
corporate_information: Корпоративна информация
publication_scheme_html: Прочетете какви видове информация публикуваме в нашия
%{link}.
personal_information_charter_html: Нашият %{link} дава информация за начина на
ползване на личните Ви данни
welsh_language_scheme_html: Разберете повече за нашето задължение да публикуваме
в %{link}.
social_media_use_html: Вижте политиката ни по %{link}.
about_our_services_html:
7 changes: 7 additions & 0 deletions config/locales/bn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,10 @@ bn:
documents:
one:
other:
corporate_information_page:
corporate_information:
publication_scheme_html:
personal_information_charter_html:
welsh_language_scheme_html:
social_media_use_html:
about_our_services_html:
9 changes: 9 additions & 0 deletions config/locales/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,12 @@ cs:
one: Dokument
few:
other: Dokumenty
corporate_information_page:
corporate_information: Korporátní informace
publication_scheme_html: Více o typech informací, které pravidelně zveřejňujeme
na %{link}.
personal_information_charter_html: Jak nakládáme s vašimi osobními informacemi
%{link}
welsh_language_scheme_html: Více o našem závazku zvěřejňovat informace na %{link}.
social_media_use_html: Více o naší strategii o %{link}.
about_our_services_html:
9 changes: 9 additions & 0 deletions config/locales/cy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,3 +334,12 @@ cy:
few:
many:
other: Dogfennau
corporate_information_page:
corporate_information: Gwybodaeth gorfforaethol
publication_scheme_html: Darllenwch am y mathau o wybodaeth rydym yn eu cyhoeddi'n
rheolaidd yn ein %{link}.
personal_information_charter_html: Mae ein %{link} yn egluro sut rydym yn trin
eich gwybodaeth bersonol.
welsh_language_scheme_html: Dysgwch am ein hymrwymiad i %{link}.
social_media_use_html: Darllenwch ein polisi ar %{link}
about_our_services_html: Canfod %{link}
10 changes: 10 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,13 @@ de:
documents:
one: Dokument
other: Dokumente
corporate_information_page:
corporate_information: Administrative Informationen
publication_scheme_html: Lesen Sie hier %{link}, welche Informationen wir routinemäßig
publizieren
personal_information_charter_html: Unser %{link} erklärt, wie wir Ihre personenbezogenen
Daten schützen.
welsh_language_scheme_html: Mehr zu unserer Verpflichtung zur Veröffentlichung
in %{link}
social_media_use_html: Unsere Politik zu %{link}
about_our_services_html:
9 changes: 9 additions & 0 deletions config/locales/dr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,12 @@ dr:
documents:
one: "سند"
other: "اسناد"
corporate_information_page:
corporate_information: معلومات یکی شده
publication_scheme_html: در مورد انواع معلوماتی بخوانید که ما به طور منظم نشر
می کنیم.
personal_information_charter_html: " %{link} ما شیوه برخود با معلومات شخصی را
تشریح مینماید"
welsh_language_scheme_html: در مورد تعهد ما به نشر در %{link} معلومات حاصل نمایید
social_media_use_html: پالیسی ما را در %{link} بخوانید
about_our_services_html:
10 changes: 10 additions & 0 deletions config/locales/el.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,13 @@ el:
documents:
one: "Έγγραφο"
other: "Έγγραφα"
corporate_information_page:
corporate_information: Πληροφορίες για τον Οργανισμό
publication_scheme_html: Μάθετε περισσότερα για τις πληροφορίας που δημοσιεύουμε
συνήθως στο %{link}
personal_information_charter_html: Το %{link} εξηγεί πώς χειριζόμαστε τα προσωπικά
σας δεδομένα
welsh_language_scheme_html: Μάθετε περισσότερα για την δέσμευση μας στη δημοσίευση
στο %{link}.
social_media_use_html: Μάθετε περισσότερα για την πολιτική μας στο %{link}.
about_our_services_html:
9 changes: 9 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,12 @@ en:
one: Document
other: Documents
details: Details
corporate_information_page:
corporate_information: Corporate information
publication_scheme_html: Read about the types of information we routinely publish
in our %{link}.
personal_information_charter_html: Our %{link} explains how we treat your personal
information.
welsh_language_scheme_html: Find out about our commitment to %{link}.
social_media_use_html: Read our policy on %{link}.
about_our_services_html: Find out %{link}.
10 changes: 10 additions & 0 deletions config/locales/es-419.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,13 @@ es-419:
documents:
one: Documento
other: Documentos
corporate_information_page:
corporate_information: Información institucional
publication_scheme_html: Lea sobre los tipos de información que usualmente publicamos
en nuestro %{link}
personal_information_charter_html: Nuestro %{link} explica cómo manejamos su información
personal
welsh_language_scheme_html: Descubra sobre nuestro compromiso de publicar en el
%{link}
social_media_use_html: Lea nuestra política en %{link}
about_our_services_html:
10 changes: 10 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,13 @@ es:
documents:
one: Documento
other: Documentos
corporate_information_page:
corporate_information: Información corporativa
publication_scheme_html: Lea acerca del tipo de información que publicamos en
el siguiente enlace %{link}
personal_information_charter_html: El siguiente enlace %{link} explica cómo tratamos
tu información personal
welsh_language_scheme_html: 'Encuentre más sobre nuestro compromiso de publicar
en %{link} '
social_media_use_html: Lea nuestra política en %{link}
about_our_services_html:
10 changes: 10 additions & 0 deletions config/locales/et.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,13 @@ et:
documents:
one: Dokument
other: Dokumendid
corporate_information_page:
corporate_information: Korporatiivne info
publication_scheme_html: 'Lugege lisaks infoliikide kohta, mida me regulaarselt
avalikustame: %{link}'
personal_information_charter_html: 'Meie %{link} selgitab kuidas me kohtleme Teie
eraelulist teavet. '
welsh_language_scheme_html: 'Lugege lisaks meie pühandumusest avaldamise osas:
%{link}'
social_media_use_html: 'Lugege meie poliitika kohta: %{link}'
about_our_services_html: 'Uuri lisaks: %{link}'
9 changes: 9 additions & 0 deletions config/locales/fa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,12 @@ fa:
documents:
one: "مدرک"
other: "مدارک"
corporate_information_page:
corporate_information: اطلاعات سازمانی
publication_scheme_html: 'درباره نوع اطلاعاتی که ما به طور روال در %{link} منتشر
می کنیم بخوانید '
personal_information_charter_html: "%{link} چگونگی نگهداری از اطلاعات شخصی شما
را توضیح می دهد"
welsh_language_scheme_html: درباره تعهد ما به انتشار مطالب به %{link} بخوانید
social_media_use_html: سیاست ما را درباره %{link} بخوانید
about_our_services_html:
10 changes: 10 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,13 @@ fr:
documents:
one: Document
other: Documents
corporate_information_page:
corporate_information: Informations générales
publication_scheme_html: En savoir plus sur les types d'informations régulièrement
publiés dans notre %{link}.
personal_information_charter_html: Notre %{link} explique comment nous traitons
vos renseignements personnels.
welsh_language_scheme_html: En savoir plus sur notre engagement à l'édition en
%{link}.
social_media_use_html: Lire notre politique d' %{link}.
about_our_services_html:
8 changes: 8 additions & 0 deletions config/locales/he.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,11 @@ he:
two:
many:
other: "מסמכים"
corporate_information_page:
corporate_information: מידע מסחרי
publication_scheme_html: קרא/י אודות סוגי מידע שאנחנו מפרסמים %{link}
personal_information_charter_html: ה%{link} מסביר אודות המדיניות שלנו כלפי מידע
פרטי
welsh_language_scheme_html: מידע נוסף על המחויבות שלנו לפרסום %{link}
social_media_use_html: קרא/י אודות המדיניות שלנו %{link}
about_our_services_html:
10 changes: 10 additions & 0 deletions config/locales/hi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,13 @@ hi:
documents:
one: "दस्तावेज़"
other: "दस्तावेजों"
corporate_information_page:
corporate_information: निकाय सूचना
publication_scheme_html: सूचना के उन प्रकारों के बारे में पढ़ें, जिन्हें हम अपने
%{link} में नियमित रूप से प्रकाशित करते हैं।
personal_information_charter_html: हमारे %{link} बताते हैं कि हम कैसे आपकी व्यक्तिगत
सूचना का उपयोग करते हैं।
welsh_language_scheme_html: हमारी प्रकाशन के प्रति वचनबद्धता के बारे में जानें
%(link)।
social_media_use_html: इस बारे में हमारी नीतियां पढ़ें %{link}
about_our_services_html:
10 changes: 10 additions & 0 deletions config/locales/hu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,13 @@ hu:
documents:
one: Dokumentum
other: Dokumentumok
corporate_information_page:
corporate_information: Szervezeti információk
publication_scheme_html: 'Tekintse meg, hogy milyen jellegű információkat teszünk
közzé: %{link}'
personal_information_charter_html: 'A következő oldalon olvashat róla, hogy hogyan
kezeljük a személyes adatokat: %{link}'
welsh_language_scheme_html: 'Tájékozódjon az információk közzétételével kapcsolatos
elkötelezettségünkről: %{link}'
social_media_use_html: 'Bővebb információk az alábbi témával kapcsolatban: %{link}'
about_our_services_html:
Loading

0 comments on commit d74a05c

Please sign in to comment.