Class: Decidim::DecidimAwesome::UtilsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/decidim/decidim_awesome/utils_controller.rb

Overview

Abstract component class for components without any admin controllers (only settings)

Instance Method Summary collapse

Methods inherited from ApplicationController

#permission_class_chain

Instance Method Details

#form_builder_i18nObject



7
8
9
10
11
12
13
14
# File 'app/controllers/decidim/decidim_awesome/utils_controller.rb', line 7

def form_builder_i18n
  lang = I18n.locale
  folder = "app/packs/src/vendor/form_builder_langs/"
  file = Decidim::DecidimAwesome::Engine.root.join(folder, "#{lang}.lang")
  file = Dir[Decidim::DecidimAwesome::Engine.root.join(folder, "#{lang}-*.lang")].first unless File.exist?(file)
  file = Decidim::DecidimAwesome::Engine.root.join(folder, "en-US.lang") unless file && File.exist?(file)
  render plain: File.read(file)
end