isprambiente/medplan

View on GitHub
app/views/categories/_form.html.haml

Summary

Maintainability
Test Coverage
= form_with model: @category, data: { turbo_frame: 'yield' } do |f|
  .form-inputs
    .columns
      .column.is-9-desktop.is-8-tablet
        .field
          %label.label.is-required Titolo
          .control.is-expanded= f.text_field :title, class: "input"
          %p.help.is-danger= @category.errors.messages[:title].join(', ')
      .column
        .field
          %label.label.is-required Mesi
          .control.is-expanded= f.number_field :months, class: "input"
          %p.help.is-danger= @category.errors.messages[:months].join(', ')
    .columns
      .column
        .field
          %label.label Protocollo
          .control.is-expanded= f.text_area :protocol, label: 'Protocollo', class: "textarea"
          %p.help.is-danger= @category.errors.messages[:protocol].join(', ')
    .columns
      .column
        = f.select :risk_ids, Risk.all.map{|r| [ r.title, r.id ] }, {}, { multiple: true, data: { controller: 'form', form_target: 'listbox' } }
        %p.help.is-danger= @category.errors.messages[:risk_ids].join(', ')
  .form-actions
    .columns
      .column= f.submit icon: 'save', value: 'Salva', class: 'button is-fullwidth is-link'