Sha256: 4bef7901157800446d75f41cc81274960822fb8b2b14fac943d52cccdbe25b56

Contents?: true

Size: 1.23 KB

Versions: 11

Compression:

Stored size: 1.23 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 selected_elements.nil?
  - selected_elements = []
- selected_elements = selected_elements.collect { |element| element.to_s }

-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

11 entries across 11 versions & 1 rubygems

Version Path
sinatra-hexacta-0.3.8 lib/sinatra/views/inputs/multiple_select.slim
sinatra-hexacta-0.3.7 lib/sinatra/views/inputs/multiple_select.slim
sinatra-hexacta-0.3.6 lib/sinatra/views/inputs/multiple_select.slim
sinatra-hexacta-0.3.5 lib/sinatra/views/inputs/multiple_select.slim
sinatra-hexacta-0.3.4 lib/sinatra/views/inputs/multiple_select.slim
sinatra-hexacta-0.3.3 lib/sinatra/views/inputs/multiple_select.slim
sinatra-hexacta-0.3.2 lib/sinatra/views/inputs/multiple_select.slim
sinatra-hexacta-0.3.1 lib/sinatra/views/inputs/multiple_select.slim
sinatra-hexacta-0.3.0 lib/sinatra/views/inputs/multiple_select.slim
sinatra-hexacta-0.1.1 lib/sinatra/views/inputs/multiple_select.slim
sinatra-hexacta-0.1.0 lib/sinatra/views/inputs/multiple_select.slim