Class: OptionsForSelectTag
- Inherits:
-
LiquidumTag
- Object
- LiquidumTag
- OptionsForSelectTag
- Defined in:
- lib/scribo/liquid/tags/options_for_select.rb
Overview
Add a text-field, either specifying everything manually or using a model object on the form
Basic usage:
{%assign airports = "Eindhoven, Schiphol" | split: ', '%}
{%options_for_select airports%}
Advanced usage:
{%assign airports = "Eindhoven, Schiphol" | split: ', '%}
{%options_for_select airports selected:"Schiphol" disabled:"Eindhoven"%}
Advanced usage:
{%options_for_select airports name value selected:"Schiphol" disabled:"Eindhoven"%}
This last usage requires a model on the form
Instance Method Summary collapse
Instance Method Details
#render(context) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/scribo/liquid/tags/options_for_select.rb', line 19 def render(context) super = argv1.map(&:to_liquid) if sargs.present? = .map do |option| result = sargs.map { |a| option[a.to_s] } result = result.first if result.length == 1 result end end context.registers['controller'].helpers.(, attr_args).to_s end |