AndrewMcBurney/petermcburney.com

View on GitHub
app/views/artworks/partials/_form.html.slim

Summary

Maintainability
Test Coverage
- if artwork.errors.any?
  #error_explanation
    h2= pluralize(artwork.errors.count, "error")
       prohibited this artwork from being saved:
    ul
      - artwork.errors.full_messages.each do |message|
        li= message

table
  tbody
    = form_with(model: artwork, local: true) do |form|
      tr
        th= form.label :title
        th= form.label :artwork_type, "Copic"
        th= form.label :artwork_type, "Painting"
        th= form.label :artwork_type, "Sketch"
        th= form.label :size
        th= form.label :price
        th= form.label :media
        th= form.label :image
        th= form.label :featured
        th= form.label :for_sale

      tr
        td= form.text_field :title, id: :artwork_title
        td= form.radio_button :artwork_type, "copic", checked: true
        td= form.radio_button :artwork_type, "painting"
        td= form.radio_button :artwork_type, "sketch"
        td= form.text_field :size, id: :artwork_size
        td= form.text_field :price, id: :artwork_price
        td= form.text_field :media, id: :artwork_id
        td= form.file_field :image
        td= form.check_box :featured, id: :artwork_featured
        td= form.check_box :for_sale, id: :artwork_for_sale

      tr
        td= form.submit