Class: Input::Radio::Cell
- Inherits:
-
Cell
- Object
- Cell
- Input::Radio::Cell
- Defined in:
- app/cells/lato_view/input/radio/cell.rb
Constant Summary collapse
- @@widths =
VIEW_INPUTWIDTH
Instance Attribute Summary collapse
-
#custom_class ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’.
-
#disabled ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’.
-
#label ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’.
-
#name ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’.
-
#options ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’.
-
#placeholder ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’.
-
#required ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’.
-
#value ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’.
-
#width ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’.
Class Method Summary collapse
-
.generate_options_from_activerecords(activerecords, value, name) ⇒ Object
take in input an activerecords list, a value string and a name string, return an array that can be used with select.
Instance Method Summary collapse
-
#initialize(name: 'input', placeholder: '', value: '', label: '', width: 'large', required: false, disabled: false, custom_class: '', options: []) ⇒ Cell
constructor
A new instance of Cell.
- #show ⇒ Object
Constructor Details
#initialize(name: 'input', placeholder: '', value: '', label: '', width: 'large', required: false, disabled: false, custom_class: '', options: []) ⇒ Cell
Returns a new instance of Cell.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/cells/lato_view/input/radio/cell.rb', line 10 def initialize(name: 'input', placeholder: '', value: '', label: '', width: 'large', required: false, disabled: false, custom_class: '', options: []) # save params @name = name @placeholder = placeholder @value = value @label = label @width = width @required = required @disabled = disabled @custom_class = custom_class @options = # check params check_params end |
Instance Attribute Details
#custom_class ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’
7 8 9 |
# File 'app/cells/lato_view/input/radio/cell.rb', line 7 def custom_class @custom_class end |
#disabled ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’
7 8 9 |
# File 'app/cells/lato_view/input/radio/cell.rb', line 7 def disabled @disabled end |
#label ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’
7 8 9 |
# File 'app/cells/lato_view/input/radio/cell.rb', line 7 def label @label end |
#name ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’
7 8 9 |
# File 'app/cells/lato_view/input/radio/cell.rb', line 7 def name @name end |
#options ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’
7 8 9 |
# File 'app/cells/lato_view/input/radio/cell.rb', line 7 def @options end |
#placeholder ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’
7 8 9 |
# File 'app/cells/lato_view/input/radio/cell.rb', line 7 def placeholder @placeholder end |
#required ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’
7 8 9 |
# File 'app/cells/lato_view/input/radio/cell.rb', line 7 def required @required end |
#value ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’
7 8 9 |
# File 'app/cells/lato_view/input/radio/cell.rb', line 7 def value @value end |
#width ⇒ Object
NB: options must be an array of hash ‘name’, value: ‘value’
7 8 9 |
# File 'app/cells/lato_view/input/radio/cell.rb', line 7 def width @width end |
Class Method Details
.generate_options_from_activerecords(activerecords, value, name) ⇒ Object
take in input an activerecords list, a value string and a name string, return an array that can be used with select
54 55 56 57 58 59 60 |
# File 'app/cells/lato_view/input/radio/cell.rb', line 54 def self.(activerecords, value, name) rows = [] activerecords.each do |row| rows.push([row.send(value), row.send(name)]) end rows end |
Instance Method Details
#show ⇒ Object
27 28 29 |
# File 'app/cells/lato_view/input/radio/cell.rb', line 27 def show render "show.html" end |