Sha256: cfaaa6029c5e80a329352ced1cd5eed392b72986c9e88564590af0ea3dce1bc5
Contents?: true
Size: 1.14 KB
Versions: 6
Compression:
Stored size: 1.14 KB
Contents
ActiveAdmin.register Translation do config.batch_actions = false actions :index scope :cms, default: true scope :active_admin scope :all index do column :key -> { ActiveadminSelleoCms::Locale.enabled }.call.each do |locale| column locale.name do |translation| content_tag :div, class: "translation" do text_field_tag "#{locale.code}[#{translation.key}]", translation.send(locale.code), data: { locale: locale.code, key: translation.key, route: admin_translations_path } end end end end filter :key filter :value collection_action :update, method: :put do unless @translation = Translation.where(key: params[:key], locale: params[:locale]).first @translation = Translation.create({key: params[:key], locale: params[:locale]}, as: :admin) end end controller do def collection _collection = get_collection_ivar return _collection if _collection _collection = find_collection.reorder(:key).select("DISTINCT(key)") authorize! ActiveAdmin::Authorization::READ, active_admin_config.resource_class set_collection_ivar _collection end end end
Version data entries
6 entries across 6 versions & 1 rubygems