Sha256: 1e25ca009333751274df0d1678a27ef8117aa9cd89be21065cb295d3eddeeb1d

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

- unless defined? required
  - required = false
- if !(defined? id) || id.blank? 
  - id = "#{name}_#{rand(1000)}"
- unless defined? placeholder
  - placeholder = "Selecciona..."
- unless defined? selected_elements
  - selected_elements = []

-if required
  .form-group.has-success
    label.fg-label #{placeholder}
    select.chosen id="#{id}" name="#{name}[]" data-placeholder=("#{placeholder}") chosen="" multiple="" style=("display: none;") required=""
      -for element in elements
        -if selected_elements.include?(element[:value].to_s)
          option value="#{element[:value]}" selected="" #{element[:text]} 
        -else
          option value="#{element[:value]}" #{element[:text]} 
-else
  .form-group
    label.fg-label #{placeholder}
    select.chosen id="#{id}" name="#{name}[]" data-placeholder=("#{placeholder}") chosen="" multiple="" style=("display: none;")
      -for element in elements
        -if selected_elements.include?(element[:value].to_s)
          option value="#{element[:value]}" selected="" #{element[:text]} 
        -else
          option value="#{element[:value]}" #{element[:text]} 

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sinatra-hexacta-0.0.2 lib/sinatra/views/inputs/multiple_select.slim
sinatra-hexacta-0.0.1 lib/sinatra/views/inputs/multiple_select.slim