- content_for :head do
  %meta{ property: "og:title", content: @event.title }
  %meta{ property: "og:url", content: conference_program_proposal_url(@conference.short_title, @event) }
  %meta{ property: "og:description", content: @event.abstract }
  %meta{ property: "og:site_name", content: ENV.fetch('OSEM_NAME', 'OSEM') }
  - if @speakers_ordered.any?
    %meta{ property: "og:image", content: @speakers_ordered.first.gravatar_url }
    %meta{ property: "og:image:secure_url", content: @speakers_ordered.first.gravatar_url }

.container
  .row
    .col-md-12.page-header
      %h2
        = @event.title
        - if @event.subtitle
          %br
          %small
            = @event.subtitle
        .btn-group.pull-right
          - if can? :update, @event
            = link_to 'Registrations', registrations_conference_program_proposal_path(@conference.short_title, @event), class: 'btn btn-mini btn-success'
          - if can? :edit, @event
            = link_to "Edit", edit_conference_program_proposal_path(@conference.short_title, @event), class: 'btn btn-mini btn-primary'
          - if can? :schedule, @conference
            = link_to "Schedule", conference_schedule_path(@conference.short_title), class: 'btn btn-success'

  .row
    .col-md-3
      %h3
      - if @event.speakers.any?
        Presented by:
        - @speakers_ordered.each do |speaker|
          .speakerinfo
            .row
              .col-md-4
                = image_tag speaker.gravatar_url(:size => 120), class: 'img-responsive img-rounded'
              .col-md-8
                %h4
                  = link_to speaker.name, user_path(speaker.id)
                  %br
                  - if speaker.email_public?
                    = mail_to "#{ speaker.email }" do
                      %i.fa-solid.fa-envelope.fa-2x
                - if speaker.affiliation?
                  .text-muted
                    from
                    = speaker.affiliation
            -if speaker.biography?
              .row.speakerbio
                .col-md-12
                  = markdown(speaker.biography)
    .col-md-9
      .row
        .col-md-12
          .lead
            = canceled_replacement_event_label(@event, @event_schedule)
            = replacement_event_notice(@event_schedule)

          - if @event.commercials.empty?
            %h5.text-warning
              No video of the event yet, sorry!
              - unless @conference.commercials.empty?
                Meanwhile...
            - unless @conference.commercials.empty?
              = render partial: 'shared/media_items', locals: { commercials: @conference.commercials }
          - else
            %p
            = render partial: 'shared/media_items', locals: { commercials: @event.commercials }
      .row
        .col-md-12
          %p
            = markdown(@event.abstract)
        %dl#proposal-info
          .col-md-12
            %dt Date:
            %dd= @event_schedule.start_time.strftime("%Y %B %e - %H:%M") if @event_schedule
          .col-md-12
            %dt Duration:
            %dd= show_time(@event.event_type.length)
          .col-md-12
            %dt Room:
            %dd
              - if @event.room
                = @event.room.name
          .col-md-12
            %dt Conference:
            %dd= link_to @event.program.conference.title, conference_path(@conference)
          .col-md-12
            %dt Language:
            %dd= @event.language if @event.language
          .col-md-12
            %dt Track:
            %dd
              - if @event.track
                %span.label{style: "background-color: #{@event.track.color}; color: #{ contrast_color(@event.track.color) }"}
                  = @event.track.name
          .col-md-12
            %dt Difficulty:
            %dd
              - if @event.difficulty_level
                %span.label{style: "background-color: #{@event.difficulty_level.color}; color: #{ contrast_color(@event.difficulty_level.color) };"}
                  = @event.difficulty_level.title

          - if @event.require_registration
            .col-md-12
              %dt Requires Registration:
              %dd
                = link_to "Yes (#{registered_text(@event)})", new_conference_conference_registration_path(@conference.short_title), class: 'btn btn-xs btn-danger', disabled: !@event.registration_possible?
          - if concurrent_events(@event).present?
            .col-md-12
              %hr
              %h4 Happening at the same time:
              %ol
                - concurrent_events(@event).each do |event|
                  %li
                    = link_to conference_program_proposal_path(@conference.short_title, event.id) do
                      = event.title
                  %dl
                    %dt Start Time:
                    %dd
                      = event.program.selected_event_schedules.find { |es| es.event == event }.start_time.strftime("%Y %B %e %H:%M")
                    %br
                      %dt Room:
                      %dd
                        = event.room.name
      .row
        .col-md-12
          - if @surveys_after_event.any? && @event.ended?
            .page-header
            = render partial: 'surveys/list', locals: { surveys: @surveys_after_event, conference: @conference }
