appirits/comable

View on GitHub
frontend/app/views/comable/orders/payment.slim

Summary

Maintainability
Test Coverage
#comable-order
  .comable-payment
    h1
      = @order.class.human_state_name(:payment)

    = form_for @order, as: :order, url: update_order_path, method: :put do |f|
      - payment = @order.payment || @order.build_payment
      = f.fields_for :payment, payment do |ff|
        ul
          - Comable::PaymentMethod.all.each.with_index do |payment_method, index|
            li
              - checked_flag = payment.payment_method ? (payment.payment_method == payment_method) : index.zero?
              = ff.radio_button :payment_method_id, payment_method.id, checked: checked_flag
              = ff.label :payment_method_id, payment_method.name, value: payment_method.id
      = f.submit Comable.t('next_step')