Class: RailsAdminGlobalizeField::Tab
- Inherits:
-
Object
- Object
- RailsAdminGlobalizeField::Tab
- Defined in:
- lib/rails_admin_globalize_field/tab.rb
Instance Attribute Summary collapse
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#translation ⇒ Object
readonly
Returns the value of attribute translation.
Instance Method Summary collapse
- #active! ⇒ Object
- #active? ⇒ Boolean
- #id ⇒ Object
-
#initialize(locale, translation, validate: true) ⇒ Tab
constructor
A new instance of Tab.
- #invalid? ⇒ Boolean
- #label ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(locale, translation, validate: true) ⇒ Tab
Returns a new instance of Tab.
7 8 9 10 11 |
# File 'lib/rails_admin_globalize_field/tab.rb', line 7 def initialize(locale, translation, validate: true) @locale = locale @translation = translation @validate = validate end |
Instance Attribute Details
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
5 6 7 |
# File 'lib/rails_admin_globalize_field/tab.rb', line 5 def locale @locale end |
#translation ⇒ Object (readonly)
Returns the value of attribute translation.
5 6 7 |
# File 'lib/rails_admin_globalize_field/tab.rb', line 5 def translation @translation end |
Instance Method Details
#active! ⇒ Object
21 22 23 |
# File 'lib/rails_admin_globalize_field/tab.rb', line 21 def active! @active = true end |
#active? ⇒ Boolean
25 26 27 |
# File 'lib/rails_admin_globalize_field/tab.rb', line 25 def active? @active end |
#id ⇒ Object
13 14 15 |
# File 'lib/rails_admin_globalize_field/tab.rb', line 13 def id ['pane', translation.model_name.param_key, locale].join('-') end |
#invalid? ⇒ Boolean
33 34 35 |
# File 'lib/rails_admin_globalize_field/tab.rb', line 33 def invalid? !valid? end |
#label ⇒ Object
17 18 19 |
# File 'lib/rails_admin_globalize_field/tab.rb', line 17 def label @locale end |
#valid? ⇒ Boolean
29 30 31 |
# File 'lib/rails_admin_globalize_field/tab.rb', line 29 def valid? !@validate || translation.valid? end |