-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX - add welsh for take_part content_item
- Loading branch information
Showing
14 changed files
with
111 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
class TakePartController < ApplicationController | ||
include ContentItemLoader | ||
|
||
def model_type | ||
TakePart | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module GovukChatPromoHelper | ||
def show_govuk_chat_promo?(_base_path) | ||
false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module MachineReadableMetadataHelper | ||
def machine_readable_metadata(args) | ||
locals = { content_item: @content_item }.merge(args) # rubocop:disable Rails/HelperInstanceVariable | ||
# render("govuk_publishing_components/components/machine_readable_metadata", locals) | ||
def machine_readable_metadata(content_item, args) | ||
locals = { content_item: content_item.content_item }.merge(args) | ||
render("govuk_publishing_components/components/machine_readable_metadata", locals) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module TitleHelper | ||
def title_and_context(title, document_type, view_context) | ||
{ | ||
title:, | ||
context: I18n.t("content_item.schema_name.#{document_type}", count: 1), | ||
context_locale: view_context.t_locale_fallback("content_item.schema_name.#{document_type}", count: 1), | ||
average_title_length: "long", | ||
} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
class ContentItem | ||
attr_reader :content_item, :body, :image, :description, :document_type, :title, :base_path | ||
|
||
def initialize(content_store_response) | ||
@content_item = content_store_response | ||
@body = content_item.dig("details", "body") | ||
@image = content_item.dig("details", "image") | ||
@description = content_item["description"] | ||
@document_type = content_item["document_type"] | ||
@title = content_item["title"] | ||
@base_path = content_item["base_path"] | ||
end | ||
|
||
def available_translations | ||
translations = content_item["links"]["available_translations"] || [] | ||
|
||
mapped_locales(sorted_locales(translations)) | ||
end | ||
|
||
def sorted_locales(translations) | ||
translations.sort_by { |t| t["locale"] == I18n.default_locale.to_s ? "" : t["locale"] } | ||
end | ||
|
||
private | ||
|
||
def mapped_locales(translations) | ||
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 native_language_name_for(locale) | ||
I18n.t("language_names.#{locale}", locale:) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class TakePart < ContentItem | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<% if available_translations(@content_item).length > 1 %> | ||
<% if @content_item.available_translations.any? %> | ||
<div class="govuk-grid-column-one-third"> | ||
<%= render 'govuk_publishing_components/components/translation_nav', | ||
translations: available_translations(@content_item) %> | ||
translations: @content_item.available_translations %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters