Class: Avo::Fields::CurrencyField

Inherits:
BaseField
  • Object
show all
Defined in:
lib/avo/fields/currency_field.rb

Instance Attribute Summary collapse

Attributes inherited from BaseField

#action, #as_avatar, #as_description, #as_label, #block, #computable, #computed, #computed_value, #default, #format_using, #help, #id, #model, #null_values, #nullable, #panel_name, #readonly, #required, #resource, #sortable, #updatable, #user, #view, #visible

Attributes included from FieldExtensions::VisibleInDifferentViews

#show_on_edit, #show_on_index, #show_on_new, #show_on_show

Instance Method Summary collapse

Methods inherited from BaseField

#component_for_view, #custom?, #database_id, #fill_field, #has_own_panel?, #hydrate, #model_errors, #name, #placeholder, #resolve_attribute, #to_permitted_param, #translation_key, #type, #value, #view_component_name, #visible?

Methods included from FieldExtensions::HasFieldName

#field_name, #get_field_name

Methods included from FieldExtensions::VisibleInDifferentViews

#except_on, #hide_on, #only_on, #show_on

Constructor Details

#initialize(id, **args, &block) ⇒ CurrencyField

Returns a new instance of CurrencyField.



7
8
9
10
11
12
# File 'lib/avo/fields/currency_field.rb', line 7

def initialize(id, **args, &block)
  super(id, **args, &block)

  @currency = args[:currency].present? ? args[:currency].to_s : Avo.configuration.currency
  @locale = args[:locale].present? ? args[:locale].to_s : Avo.configuration.locale
end

Instance Attribute Details

#currencyObject (readonly)

Returns the value of attribute currency.



4
5
6
# File 'lib/avo/fields/currency_field.rb', line 4

def currency
  @currency
end

#localeObject (readonly)

Returns the value of attribute locale.



5
6
7
# File 'lib/avo/fields/currency_field.rb', line 5

def locale
  @locale
end