Skip to content

Repository files navigation

VoogFooter

Footer layout from internet.ee (Voog CMS), with lazy Rails.cache and YAML fallback in host apps.

Modules

File Role
configuration.rb Site URL, API key, enabled flag, cache, locales
fetcher.rb HTTP: Voog languages API + footer HTML per locale
structure_parser.rb HTML → { highlight, columns, extras }; keys from each locale’s URL paths
store.rb Cache key voog_footer; always loads all configured or API locales together

Usage

structures = VoogFooter.structure
# => { "en" => { "highlight" => ..., "columns" => ..., "extras" => ... }, "et" => ... }

structure = structures[I18n.locale.to_s]

VoogFooter.snapshot(refresh: true)

Column link entries include url, text, and key. Each locale gets its own keys from that locale’s URLs (path tail, mailto/tel, or social icon). Duplicate keys within one parse get a numeric suffix (faq_2). Map app footer slots to Voog keys in the host app (e.g. faq vs kkk for ET).

VoogFooter.structure["en"]["columns"].flat_map { |c| c["links"] }.map { |l| l["key"] }
VoogFooter.structure["et"]["columns"].flat_map { |c| c["links"] }.map { |l| l["key"] }

Locales

VoogFooter.structure always returns a hash for every language code in scope:

  • config.locales when set (e.g. %w[en et]) — recommended for sites where only some locales have published pages.
  • Fetcher#remote_languages when config.locales is unset — all codes from the Voog languages API (requires api_key).
VoogFooter.language_codes # same set the store uses

Configuration

voog_site_url: "https://www.internet.ee"
voog_api_key: ""
voog_site_fetching_enabled: "false"
voog_footer_cache_ttl: "3600"
VoogFooter.configure do |config|
  config.enabled = true
  config.cache_store = Rails.cache
  config.locales = %w[en et]
end

Cache

VoogFooter::Store.new.clear_cache!       # all locales
VoogFooter::Store.new.clear_cache!("en")  # drop one locale from blob

Development

bundle exec rspec
docker build -t voog_footer-gem .
docker run --rm voog_footer-gem

License

MIT

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages