orientation/orientation

View on GitHub
app/views/articles/_form.haml

Summary

Maintainability
Test Coverage
.g
  .g-b.g-b--m--2of3

    %p.label.mbxs= label_text

    .form
      = simple_form_for @article do | f |

        .form-field
          = f.input_field :title, placeholder: 'Enter an Article Title',
            class: 'form-input form-input--clear tfh tsl ts--m--xl'

        .form-field.js-editor

          .form-overlay.js-editor-overlay
            = link_to '#', class: 'form-field-toggle form-field-toggle--open js-editor-open' do
              = render partial: 'shared/icon', locals: { icon: 'arrows-alt', title: 'Open Editor' }

            = link_to '#', class: 'form-field-toggle form-field-toggle--close js-editor-close' do
              = render partial: 'shared/icon', locals: { icon: 'times', title: 'Close Editor' }

            = f.input_field :content, rows: 12, class: 'form-input form-textarea js-editor-textarea'

        .form-field
          = f.label :author do
            %span.form-label.label Author
            - user_id = @article.new_record? ? current_user.id : @article.author_id
            = f.input_field :author_id, collection: User.active.order(:name), include_blank: false, selected: user_id

        .form-field
          = f.label :tag_tokens do
            %span.form-label.label Tags
            = f.input_field :tag_tokens, data: { load: @tags }

        .card.card--b

          .form-field.form-field--inline.mbf
            = f.label :guide, class: 'dib mbxs' do
              = f.input_field :guide, class: 'form-input form-input--checkbox'
              %span.form-label.label Make This a Guide

            %p.mbf.tcs.tsi.tss
              Guides are displayed on the home page. They can group related articles for a subject or team.
              You can use a "Support" guide to neatly arrange support-related
              articles into a coherent guide linking to other articles.

        - if @article.author.blank?
          .form-field
            = f.input :author_id, as: :hidden, input_html: { value: current_user.try(:id) }

        .form-field.mbl
          = f.input :editor_id, as: :hidden, input_html: { value: current_user.try(:id) }

        = f.button :submit, class: 'button button--a button--l'

  .g-b.g-b--m--1of3

    .card.card--b.has-card-section
      = render "markdown_guide"