ujh/fountainpencompanion

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

Summary

Maintainability
Test Coverage
div id="ink-search-hint"

= simple_form_for ink do |f|
  - if archive?
    = hidden_field_tag :archive, 'true'

  div style="max-width: 450px"
    = f.input :brand_name, required: true, hint: "e.g. Pilot, Parker, Waterman", autofocus: params[:redo].present?
    = f.input :line_name, hint: "e.g. Iroshizuku, Edelstein"
    = f.input :ink_name, required: true
  div style="max-width: 190px"
    = f.input :kind, as: :select, collection: CollectedInk::KINDS, label: 'Type'
  div class="pt-2"
    = f.input :swabbed
    = f.input :used, hint: "Also gets set when you create a Currently inked entry"
  div style="max-width: 450px"
    = f.input :maker, as: :string, hint: "e.g. Sailor or Diamine (the big two when it comes to making inks for other brands)"
  = f.input :color, as: :hidden
  div class="color-picker mb-3" data-input="collected_ink_color"
  div style="max-width: 850px"
    = f.input :comment, hint: "Will be visible to everyone if the ink is public. Use the private comment field below for private data."
    = f.input :private_comment, hint: "Will only be visible to you even if you've made the ink itself public."

  div style="max-width: 450px"
    = f.input :tags_as_string, label: "Tags", hint: "A comma separated list of tags to classify your inks"
    = f.input :private, hint: "Check this box if do not want to share this ink on your public profile."

    - if ink.new_record?
      fieldset class="mb-3 boolean optional"
        div class="form-check"
          = check_box_tag 'redo', 'yes', params[:redo].present?, class: "form-check-input"
          label for='redo' class="form-check-label" Add another ink

  div class="pt-2 mb-5"
    = f.submit 'Save', class: "btn btn-success"
    = link_to 'Cancel', collected_inks_path, class: "btn btn-secondary"