af83/chouette-core

View on GitHub
app/views/sequences/_form.html.slim

Summary

Maintainability
Test Coverage
= simple_form_for([@workbench, @sequence],
    html: { \
      multipart: true, \
      class: 'tailwind-form', \
      id: 'sequence_form'\
    }, \
    wrapper: :horizontal_form_tailwind \
  ) do |f|
  .row
    .col-lg-12 x-data="{ sequence_type: '#{@sequence.sequence_type}'}"
      = f.input :name
      = f.input :description
      = f.input :sequence_type, include_blank: false, input_html: { 'x-on:change': 'sequence_type = $event.target.value' }, disabled: @sequence.persisted?
      .range x-show="sequence_type == 'range_sequence'"
        = f.input :range_start, input_html: { "x-bind:disabled" => "sequence_type != 'range_sequence'" }
        = f.input :range_end, input_html: { "x-bind:disabled" => "sequence_type != 'range_sequence'" }
      = f.input :static_list, as: :editable_select, collection: @sequence.static_list, include_blank: false, selected: @sequence.static_list, wrapper: :horizontal_input_editable_select_tailwind, wrapper_html: { 'x-show': "sequence_type == 'static_list'" }, input_html: { multiple: true }

  = cancel_button
  = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'sequence_form'