Skip to content

Commit

Permalink
Merge pull request #394 from portagenetwork/aaron/issues/355
Browse files Browse the repository at this point in the history
Fix issue #355
  • Loading branch information
aaronskiba authored Jul 24, 2023
2 parents aa19a85 + 554d59c commit 0ec9829
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@

- Resolved problem when creating organisations [portagenetwork/roadmap#336](https://github.com/portagenetwork/roadmap/issues/336)
- Users can now download public templates without being logged in [#335](https://github.com/portagenetwork/roadmap/issues/335)
- Fixed equality checks in application_helper.rb [#355](https://github.com/portagenetwork/roadmap/issues/355)

### Changed

- Help-desk email now has correct address [portagenetwork/roadmap#338](https://github.com/portagenetwork/roadmap/issues/338)
- Password reset mail no longer instructs the user against replying to email. [portagenetwork/roadmap#338](https://github.com/portagenetwork/roadmap/issues/338)
- Edited terms-of-use and how-to-manage-your-data links to always be the localized routes in application_helper.rb [#397](https://github.com/portagenetwork/roadmap/issues/397)
- Temporarily hardcoded terms_of_use_path in application_helper.rb to always return en-CA route. This will have to be changed again when the French terms-of-use route is made available.

### Added

Expand Down
36 changes: 17 additions & 19 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def title(page_title)
content_for(:title) { page_title }
end

# This method assumes there will be an image file called dmp_logo_xx_XX.png
# Where xx_XX is the current locale in ww-WW format. Examples of this are
# en_CA, fr_CA
# This method assumes there will be an image file called dmp_logo_xx-XX.png
# where xx-XX is the string formatted I18n.locale.
# e.g. if I18n.locale == :'en_CA', then "#{I18n.locale}" == 'en-CA'
def current_locale_logo
if FeatureFlagHelper.enabled?(:on_sandbox)
"sandbox_logo_#{I18n.locale}.png"
Expand All @@ -53,42 +53,40 @@ def current_locale_logo
end
end

# We are overriding this method in order to provide different contact us urls
# based on the chosen locale. Using the branding.yml does not work for this as
# we need different urls. This will be changed when we move to DMPRoadmap 3.0
# as there is a service that handles fetching this information.
def contact_us_path
if I18n.locale == 'fr_CA'
if I18n.locale == :'fr-CA'
'https://portagenetwork.ca/fr/contactez-nous/'
else
# Handling "en_CA" locale
# Handling :'en-CA' locale
'https://portagenetwork.ca/contact-us/'
end
end

# TODO: Replace function body with the commented-out code when French version of this path is made available.
def terms_of_use_path
if I18n.locale == 'fr_CA'
'https://portagenetwork.ca/fr/outils-et-ressources/assistant-pgd/conditions-dutilisation-de-lassistant-pgd/'
else
# Handling "en_CA" locale
'https://assistant.portagenetwork.ca/terms'
end
'https://assistant.portagenetwork.ca/terms' # TEMPORARY FIX
# if I18n.locale == :'fr-CA'
# 'https://portagenetwork.ca/fr/outils-et-ressources/assistant-pgd/conditions-dutilisation-de-lassistant-pgd/'
# else
# # Handling :'en-CA' locale
# 'https://assistant.portagenetwork.ca/terms'
# end
end

def how_to_manage_your_data_path
if I18n.locale == 'fr_CA'
if I18n.locale == :'fr-CA'
'https://portagenetwork.ca/fr/outils-et-ressources/assistant-pgd/comment-gerer-vos-donnees/'
else
# Handling "en_CA" locale
# Handling :'en-CA' locale
'https://portagenetwork.ca/tools-and-resources/dmp-assistant/how-to-manage-your-data/'
end
end

def contacts_at_your_instutution_path
if I18n.locale == 'fr_CA'
if I18n.locale == :'fr-CA'
'https://alliancecan.ca/fr/services/gestion-des-donnees-de-recherche/apprentissage-et-ressources/personnes-ressources-dans-les-etablissements'
else
# Handling "en_CA" locale
# Handling :'en-CA' locale
'https://alliancecan.ca/en/services/research-data-management/learning-and-training/institutional-contacts'
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/home/_welcome.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<a href="https://doi.org/10.5281/zenodo.4001018">Primer – Data Management Plan</a>
</li>
<li>
<a href="https://portagenetwork.ca/tools-and-resources/dmp-assistant/how-to-manage-your-data/">How to Manage Your Data</a>
<a href="#{how_to_manage_your_data_path}">How to Manage Your Data</a>
</li>
<li>
Tutorial Videos:
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/_footer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
}, Rails.configuration.branding[:organisation][:url])%></li>
<li></li>
<li><a href="<%= contact_us %>"><%= _('Contact us') %></a></li>
<li><a href="/terms"><%= _('Terms of use') %></a></li>
<li><a href="<%= terms_of_use_path %>"><%= _('Terms of use') %></a></li>
<li><a href="/privacy"><%= _('Privacy statement') %></a></li>
<li><a href="https://github.com/portagenetwork/roadmap"><%= _('GitHub') %></a></li>
</ul>
Expand Down

0 comments on commit 0ec9829

Please sign in to comment.