class RailsAdminGlobalizeField::Tab

Constants

LABEL_KEY

Attributes

locale[R]
translation[R]

Public Class Methods

new(locale, translation, validate: true) click to toggle source
# File lib/rails_admin_globalize_field/tab.rb, line 9
def initialize(locale, translation, validate: true)
  @locale = locale
  @translation = translation
  @validate = validate
end

Public Instance Methods

active!() click to toggle source
# File lib/rails_admin_globalize_field/tab.rb, line 27
def active!
  @active = true
end
active?() click to toggle source
# File lib/rails_admin_globalize_field/tab.rb, line 31
def active?
  @active
end
id() click to toggle source
# File lib/rails_admin_globalize_field/tab.rb, line 15
def id
  ['pane', translation.model_name.param_key, locale].join('-')
end
invalid?() click to toggle source
# File lib/rails_admin_globalize_field/tab.rb, line 39
def invalid?
  !valid?
end
label() click to toggle source
# File lib/rails_admin_globalize_field/tab.rb, line 19
def label
  if I18n.exists?(LABEL_KEY, locale: locale)
    I18n.t(LABEL_KEY, locale: locale)
  else
    locale
  end
end
valid?() click to toggle source
# File lib/rails_admin_globalize_field/tab.rb, line 35
def valid?
  !@validate || translation.valid?
end