Sha256: b029514730f6a2efa56b4d1e7723896ffbae41265b4f704cba14da3853f92cd5

Contents?: true

Size: 752 Bytes

Versions: 19

Compression:

Stored size: 752 Bytes

Contents

# frozen_string_literal: true

module PagesCore
  module Admin
    module LocalizedFormBuilder
      include PagesCore::Admin::LocalesHelper

      def text_area(method, options = {})
        super(method, localized_form_field_options(method).merge(options))
      end

      def text_field(method, options = {})
        super(method, localized_form_field_options(method).merge(options))
      end

      private

      def localized_form_field_options(method)
        unless object.is_a?(LocalizableModel::InstanceMethods) &&
               object.class.localized_attributes.include?(method.to_sym)
          return {}
        end

        { dir: rtl_locale?(object.locale) ? "rtl" : "ltr",
          lang: object.locale }
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
pages_core-3.15.5 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.15.4 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.15.3 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.15.2 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.15.1 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.14.0 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.13.0 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.12.7 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.12.6 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.12.5 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.12.4 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.12.3 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.12.2 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.12.1 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.12.0 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.11.3 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.11.2 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.11.1 app/helpers/pages_core/admin/localized_form_builder.rb
pages_core-3.11.0 app/helpers/pages_core/admin/localized_form_builder.rb