Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update citation logic to match updated designs
Browse files Browse the repository at this point in the history
martikat committed Jul 19, 2024
1 parent e1f039a commit 1906e44
Showing 6 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions app/helpers/content_helper.rb
Original file line number Diff line number Diff line change
@@ -73,4 +73,9 @@ def service_name
def privacy_policy_url
Course.config.privacy_policy_url
end

# @return [Boolean]
def updated_content?
content.created_at.to_fs(:long) < content.updated_at.to_fs(:long)
end
end
4 changes: 0 additions & 4 deletions app/models/page.rb
Original file line number Diff line number Diff line change
@@ -31,8 +31,4 @@ def self.footer
def title
heading
end

def created_at
released_at || super
end
end
8 changes: 3 additions & 5 deletions app/views/training/pages/_citation.html.slim
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
.hf-citation
.gem-c-metadata data-module="gem-toggle metadata" data-gem-toggle-module-started="true" data-metadata-module-started="true"
dl.gem-c-metadata__list data-module="gem-track-click" data-gem-track-click-module-started="true"
dt.gem-c-metadata__term From:
dd.gem-c-metadata__definition
a.govuk-link href="https://www.gov.uk/government/organisations/department-for-education" Department for Education
dt.gem-c-metadata__term Published:
dd.gem-c-metadata__definition = content.created_at.to_fs(:long)
dt.gem-c-metadata__term Updated:
dd.gem-c-metadata__definition data-module="ga4-link-tracker" data-ga4-track-links-only="" data-ga4-link="{&quot;event_name&quot;:&quot;navigation&quot;,&quot;type&quot;:&quot;content history&quot;,&quot;section&quot;:&quot;Top&quot;,&quot;action&quot;:&quot;opened&quot;}" data-ga4-link-tracker-module-started="true" #{content.updated_at.to_fs(:long)}
- if updated_content?
dt.gem-c-metadata__term Updated:
dd.gem-c-metadata__definition data-module="ga4-link-tracker" data-ga4-track-links-only="" data-ga4-link="{&quot;event_name&quot;:&quot;navigation&quot;,&quot;type&quot;:&quot;content history&quot;,&quot;section&quot;:&quot;Top&quot;,&quot;action&quot;:&quot;opened&quot;}" data-ga4-link-tracker-module-started="true" #{content.updated_at.to_fs(:long)}
2 changes: 2 additions & 0 deletions app/views/training/pages/section_intro.html.slim
Original file line number Diff line number Diff line change
@@ -18,3 +18,5 @@
.govuk-button-group
= link_to_previous
= link_to_next

= render 'citation'
2 changes: 2 additions & 0 deletions app/views/training/questions/_learning_check_boxes.html.slim
Original file line number Diff line number Diff line change
@@ -14,3 +14,5 @@ h1.govuk-heading-l Learning check
= f.govuk_check_boxes_fieldset :answers, legend: { text: content.legend, hidden: true } do
- response.options.each do |option|
= f.question_check_box(option)

= render 'training/pages/citation'
Original file line number Diff line number Diff line change
@@ -15,3 +15,5 @@ h1.govuk-heading-l Learning check
= f.hidden_field :answers
- response.options.each do |option|
= f.question_radio_button(option)

= render 'training/pages/citation'

0 comments on commit 1906e44

Please sign in to comment.