af83/chouette-core

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

Summary

Maintainability
Test Coverage
= simple_form_for [@workbench, @processing_rule], as: 'processing_rule', html: { class: 'tailwind-form', id: 'processing_rule_form' }, wrapper: :horizontal_form_tailwind  do |f|
  .row
    .col-lg-12 x-data="{ processable_type: '#{@processing_rule.processable_type}', isShowing: true }"
      = f.input :operation_step, input_html: { 'x-on:change': 'isShowing = $event.target.value' }

      .flex.items-center.mb-10
        ul.w-full
          li.flex.justify-end.mb-10
            .flex.items-center.justify-end.mr-8.w-2/6
              = f.radio_button :processable_type, "Control::List", { "x-model" => "processable_type" }
              = f.label :processable_type_controllist, ProcessingRule::Workbench.processable_type.find_value("Control::List").text, class: 'ml-4 mb-0'
            = f.input :control_list_id, as: :select, label: false, wrapper: false, collection: @processing_rule.candidate_control_lists.order(:name), input_html: { "x-bind:disabled" => "processable_type != 'Control::List'" }
          li.flex.justify-end.mb-10 x-show="isShowing != 'after_merge'"
            .flex.items-center.justify-end.mr-8.w-2/6
              = f.radio_button :processable_type, "Macro::List", { "x-model" => "processable_type" }
              = f.label :processable_type_macrolist, ProcessingRule::Workbench.processable_type.find_value("Macro::List").text, class: 'ml-4 mb-0'
            = f.input :macro_list_id, as: :select, label: false, wrapper: false, collection: @processing_rule.candidate_macro_lists.order(:name), input_html: { "x-bind:disabled" => "processable_type != 'Macro::List' || isShowing == 'after_merge'" }

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