Skip to content

Commit

Permalink
AO3-6058 Add 'translation into' to download preface (#4652)
Browse files Browse the repository at this point in the history
* AO3-6058 Add 'translation into' to download preface

* Remove full stop
  • Loading branch information
brianjaustin authored Nov 6, 2023
1 parent d876523 commit bd0f170
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/views/downloads/_download_preface.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,24 @@
<% end %>
<% end %>

<%# i18n-tasks-use t("downloads.download_preface.translated_to.restricted_html") %>
<%# i18n-tasks-use t("downloads.download_preface.translated_to.revealed_html") %>
<%# i18n-tasks-use t("downloads.download_preface.translated_to.unrevealed_html") %>
<%# i18n-tasks-use t("downloads.download_preface.inspired_by.restricted_html") %>
<%# i18n-tasks-use t("downloads.download_preface.inspired_by.revealed_html") %>
<%# i18n-tasks-use t("downloads.download_preface.inspired_by.unrevealed") %>
<%# i18n-tasks-use t("downloads.download_preface.translation_of.restricted_html") %>
<%# i18n-tasks-use t("downloads.download_preface.translation_of.revealed_html") %>
<%# i18n-tasks-use t("downloads.download_preface.translation_of.unrevealed") %>
<% translations = @work.approved_related_works.where(translation: true) %>
<% related_works = @work.parent_work_relationships.reject { |wr| !wr.parent } %>
<% if related_works.length > 0 %>
<% if translations.any? || related_works.any? %>
<ul>
<% translations.each do |related_work| %>
<li>
<%= related_work_note(related_work.work, "translated_to", download: true) %>
</li>
<% end %>
<% related_works.each do |work| %>
<li>
<% relation = work.translation ? "translation_of" : "inspired_by" %>
Expand Down
4 changes: 4 additions & 0 deletions config/locales/views/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ en:
restricted_html: Inspired by [Restricted Work] by %{creator_link}
revealed_html: Inspired by %{work_link} by %{creator_link}
unrevealed: Inspired by a work in an unrevealed collection
translated_to:
restricted_html: 'Translation into %{language} available: [Restricted Work] by %{creator_link}'
revealed_html: 'Translation into %{language} available: %{work_link} by %{creator_link}'
unrevealed_html: 'Translation into %{language} available: A work in an unrevealed collection'
translation_of:
restricted_html: A translation of [Restricted Work] by %{creator_link}
revealed_html: A translation of %{work_link} by %{creator_link}
Expand Down
35 changes: 35 additions & 0 deletions features/works/work_download.feature
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,38 @@ Feature: Download a work
And I view the work "Followup"
And I follow "HTML"
Then I should see "Inspired by [Restricted Work] by inspiration"

Scenario: Downloads of translated work update when translation's revealed status changes.

Given a hidden collection "Hidden"
And I have related works setup
And a translation has been posted and approved
And I log out
When I view the work "Worldbuilding"
And I follow "HTML"
Then I should see "Worldbuilding Translated by translator"
# Going from revealed to unrevealed
When I am logged in as "translator"
And I edit the work "Worldbuilding Translated" to be in the collection "Hidden"
And I log out
And I view the work "Worldbuilding"
And I follow "HTML"
Then I should not see "Worldbuilding Translated by translator"
And I should see "A work in an unrevealed collection"
# Going from unrevealed to revealed
When I reveal works for "Hidden"
And I log out
And I view the work "Worldbuilding"
And I follow "HTML"
Then I should see "Worldbuilding Translated by translator"

Scenario: Downloads hide titles of restricted work translations

Given I have related works setup
And a translation has been posted and approved
And I am logged in as "translator"
And I lock the work "Worldbuilding Translated"
When I am logged out
And I view the work "Worldbuilding"
And I follow "HTML"
Then I should see "[Restricted Work] by translator"

0 comments on commit bd0f170

Please sign in to comment.