.row
  .col-md-12
    .page-header
      %h1
        -if @track.new_record?
          New
        = @track.name
        Track
.row
  .col-md-12
    = semantic_form_for(@track, url: (@track.new_record? ? admin_conference_program_tracks_path(@conference.short_title) : admin_conference_program_track_path(@conference.short_title, @track))) do |f|
      = f.input :name, input_html: { autofocus: true }
      = f.input :short_name, hint: "A short and unique handle for the track, using only letters, numbers, underscores, and dashes. This will be used to identify the track in URLs etc. Example: 'my_awesome_track'", input_html: { required: 'required', pattern: '[a-zA-Z0-9_-]+', title: 'Only letters, numbers, underscores, and dashes.' }
      = f.input :color, input_html: {size: 6, type: 'color'}, required: true
      = f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date, required: @track.self_organized_and_accepted_or_confirmed? }
      = f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', required: @track.self_organized_and_accepted_or_confirmed? }
      - if @conference.venue.try(:rooms).present?
        = f.input :room, as: :select, collection: (@conference.venue.rooms).map {|room| ["#{room.name}", room.id]}, include_blank: true, label: 'Room', input_html: { class: 'select-help-toggle', required: @track.self_organized_and_accepted_or_confirmed? }
      - else
        %b
          Please add a
          = link_to 'venue', admin_conference_venue_path(@conference.short_title)
          with
          = link_to 'rooms', admin_conference_venue_rooms_path(@conference.short_title)
          , if you want to select a room for the track.
      = f.input :description, input_html: {rows: 2, data: { provide: 'markdown' } }, hint: markdown_hint
      = f.input :cfp_active, label: 'Allow event submitters to select this track for their proposal'
      = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
