Skip to content
Snippets Groups Projects
Commit 80492056 authored by pabois's avatar pabois
Browse files

bloc i18n

parent 9ff23c28
No related branches found
No related tags found
No related merge requests found
...@@ -154,7 +154,7 @@ class Communication::Website::Page < ApplicationRecord ...@@ -154,7 +154,7 @@ class Communication::Website::Page < ApplicationRecord
duplicate = self.dup duplicate = self.dup
# Inherits from original_id or set it to itself # Inherits from original_id or set it to itself
duplicate.assign_attributes( duplicate.assign_attributes(
original_id: self.original_id || self.id, original_id: original_object.id,
github_path: nil, github_path: nil,
published: false, published: false,
**new_attributes **new_attributes
...@@ -174,6 +174,14 @@ class Communication::Website::Page < ApplicationRecord ...@@ -174,6 +174,14 @@ class Communication::Website::Page < ApplicationRecord
duplicate duplicate
end end
def original_object
@original_object ||= (self.original || self)
end
def original_with_translations
original_object.translations + [original_object]
end
protected protected
def check_accessibility def check_accessibility
......
...@@ -12,7 +12,13 @@ ...@@ -12,7 +12,13 @@
<% about.website.languages.each do |language| %> <% about.website.languages.each do |language| %>
<% next if language.id == about.language_id %> <% next if language.id == about.language_id %>
<li> <li>
<%= link_to t("languages.#{language.iso_code}"), [:translate, :admin, about.becomes(about.class.base_class), iso_code: language.iso_code] %> <% if about.original_with_translations.detect { |translation| translation.language_id == language.id }.present? %>
<i class="fas fa-edit float-end"></i>
<% else %>
<i class="fas fa-add float-end"></i>
<% end %>
<%= link_to t(language.iso_code, scope: :languages), [:translate, :admin, about.becomes(about.class.base_class), iso_code: language.iso_code] %>
</li> </li>
<% end %> <% end %>
</ol> </ol>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment