smc/grandham

View on GitHub
app/views/admin/authors/_form.html.haml

Summary

Maintainability
Test Coverage
- form_path = @author.new_record? ? language_admin_authors_path : language_admin_author_path
= simple_form_for @author, url: form_path, html: { class: 'form-horizontal' } do |f|
  %fieldset
    %legend= @author.new_record? ? 'Add author' : 'Edit author'

    = f.input :name, as: :string, input_html: { class: 'input-xxlarge' }

    = f.fields_for :profile_pictures do |profile_picture_form|
    .control-group
      = profile_picture_form.label :image, 'Profile Picture', class: 'control-label'
      .controls
        = profile_picture_form.file_field :image

    .form-actions
      = f.submit 'Submit', class: 'btn btn-primary'
      = link_to 'Cancel', language_admin_authors_path(current_language), class: 'btn'