Sha256: 07bac07a57be08ac1f06a316591a6d0b19a2081a22bc32d7b126e1d3af5d8391
Contents?: true
Size: 626 Bytes
Versions: 2
Compression:
Stored size: 626 Bytes
Contents
module Spina module Pages class TranslationsComponent < ApplicationComponent def initialize(page, label: nil) @page = page @label = label end def render? spina_locales.many? end def missing_locales spina_locales - existing_locales end def existing_locales @existing_locales ||= @page.translations.pluck(:locale).map(&:to_sym).sort_by do |locale| spina_locales.index(locale) end end private def spina_locales Spina.locales.map(&:to_sym) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spina-2.12.0 | app/components/spina/pages/translations_component.rb |
spina-2.11.0 | app/components/spina/pages/translations_component.rb |