Files
grecia/app/components/layout/remote_translations_button_component.rb
Javi Martín 2f0327acf8 Use remote translations objects instead of hashes
This way we can simplify the code dealing with the translatable
association.
2023-02-16 17:52:17 +01:00

19 lines
450 B
Ruby

class Layout::RemoteTranslationsButtonComponent < ApplicationComponent
attr_reader :remote_translations
def initialize(remote_translations)
@remote_translations = remote_translations
end
def render?
remote_translations.present? &&
RemoteTranslations::Microsoft::AvailableLocales.include_locale?(I18n.locale)
end
private
def display_remote_translation_button?
remote_translations.none?(&:enqueued?)
end
end