rubycentral/cfp-app

View on GitHub
app/views/proposals/_form.html.haml

Summary

Maintainability
Test Coverage
%fieldset.margin-top
  = proposal.title_input(f)

  - opts_session_formats = event.session_formats.publicly_viewable.map {|st| [st.name, st.id]}
  - if !proposal.has_reviewer_activity?
    - if opts_session_formats.length > 1
      = f.association :session_format, collection: opts_session_formats, include_blank: 'None selected', required: true, input_html: {class: 'dropdown'},
        hint: "The format your proposal will follow.", popover_icon: { content: session_format_tooltip }
    - else
      = f.association :session_format, collection: opts_session_formats, include_blank: false, input_html: {readonly: "readonly"},
        hint: "The format your proposal will follow.", popover_icon: { content: "Only One Session Format for #{event.name}" }
  - else
    .form-group
      = f.label :session_format, 'Session format'
      %div #{proposal.session_format_name}

  - if event.multiple_tracks? && !proposal.has_reviewer_activity?
    - opts_tracks = event.tracks.sort_by_name.map {|t| [t.name, t.id]}
    = f.association :track, collection: opts_tracks, include_blank: proposal.no_track_name_for_speakers, input_html: {class: 'dropdown'},
      hint: "Optional: suggest a specific track to be considered for.", popover_icon: { content: track_tooltip }
  - else
    .form-group
      = f.label :track, 'Track'
      %div #{proposal.track_name_for_speakers}


  = proposal.abstract_input(f, abstract_tooltip)

  - if event.public_tags?
    .form-group
      %h3.control-label
        Tags
      = f.select :tags,
        options_for_select(event.proposal_tags, proposal.object.tags),
        {}, {class: 'multiselect proposal-tags', multiple: true }

%fieldset
  %legend.fieldset-legend For Review Committee
  %p
    This content will <strong> only</strong> be visible to the review committee.

  = f.input :details, input_html: { class: 'watched', rows: 5 },
    hint: 'Include any pertinent details such as outlines, outcomes or intended audience.'#, popover_icon: { content: details_tooltip }

  = f.input :pitch, input_html: { class: 'watched', rows: 5 },
    hint: 'Explain why this talk should be considered and what makes you qualified to speak on the topic.'#, popover_icon: { content: pitch_tooltip }

- if event.custom_fields.any?
  - event.custom_fields.each do |custom_field|
    .form-group
      = f.label custom_field
      = text_field_tag "proposal[custom_fields][#{custom_field}]", proposal.custom_fields[custom_field], class: "form-control"

= render partial: 'speakers/fields', locals: { f: f, event: event }

.form-submit.clearfix.text-right
  - if proposal.persisted?
    = link_to "Cancel", event_proposal_path(event_slug: event.slug, uuid: proposal), {class: "btn btn-default btn-lg"}
  - else
    = link_to "Cancel", event_path(event.slug), {class: "btn btn-default btn-lg"}
  %button.btn.btn-primary.btn-lg{type: "submit"} Submit