- provide(:page_name, 'session_info')
- provide(:description, description_for_music_session(@music_session))

- content_for :social_meta do
  %meta{property: "fb:app_id",       content: Rails.application.config.facebook_app_id}
  %meta{property: "og:title",        content: title_for_music_session(@music_session)}
  %meta{property: "og:url",          content: request.original_url}
  %meta{property: "og:description",  content: description_for_music_session(@music_session)}
  %meta{property: "og:image",        content: facebook_image_for_music_session(@music_session)}
  %meta{property: "og:image:width",  content: facebook_image_size_for_music_session(@music_session)}
  %meta{property: "og:image:height", content: facebook_image_size_for_music_session(@music_session)}
  %meta{property: "og:type",         content: 'website'}
  %meta{property: "twitter:card",    content: 'summary'}
  %meta{property: "twitter:site",    content: '@jamkazam'}
  %meta{property: "twitter:title",   content: title_for_music_session(@music_session)}
  %meta{property: "twitter:description", content: description_for_music_session(@music_session)}

- unless @music_session.nil?
  - provide(:title, @music_session.name)

.sessions-page
  - if @can_view
    .landing-band
      .landing-avatar
        - unless @music_session.creator.photo_url.blank?
          = image_tag "#{@music_session.creator.photo_url}", alt: ""
        - else
          = image_tag "shared/avatar_generic.png", alt: ""
      .creator-name
        = @music_session.creator.name
      %span.f12 Session Creator
      %br/
      %br/
      - if !current_user.nil?
        - if (current_user.id != @music_session.creator.id) || (@open_slots.blank? && !@approved_rsvps.include?(current_user))
          .f12.call-to-action
          %br/
          %a.button-orange{:id => "btn-action"}
    .landing-details
      .left.f20.teal
        %strong SESSION
      %br/
      %br/
      .clearall.left.w20.ib.mb10
        %strong Date/Time:
      .right.w75.ib.mb10.scheduled_start
        = @music_session.pretty_scheduled_start(true)
      .clearall.left.w20.ib.mb10
        %strong Genre:
      .right.w75.ib.mb10.genre
        = @music_session.genre
      .clearall.left.w20.ib.mb10
        %strong Name:
      .right.w75.ib.mb10.name
        = @music_session.name
      .clearall.left.w20.ib.mb10
        %strong Description:
      .right.w75.ib.mb10.description
        = @music_session.description
      - if !current_user.nil?
        .clearall.left.w20.ib.mb10
          %strong Notation Files:
        .right.w75.ib.mb10.notations
          - @music_session.music_notations.each do |n|
            %a.gold{:href => n.file_url, :target => "_blank"}= n.file_name
      .clearall.left.w20.ib.mb10
        %strong Language:
      .right.w75.ib.mb10.language
        = @music_session.language_description
      .clearall.left.w20.ib.mb10
        %strong Access:
      .right.w75.ib.mb10.access
        = @music_session.access_description
      .clearall.left.w20.ib.mb10
        %strong Legal:
      .right.w75.ib.mb10.legal_policy
        = @music_session.legal_policy.capitalize
        agreement (
        %a.gold{:href => "#{root_url}#{@music_session.legal_policy_url}", :target => "_blank"} View full legal details
        )
      .clearall.left.w20.ib.mb10
        %strong Fan Page:
      .right.w75.ib.mb10.fan_page
        = share_token_url(@music_session.share_token.token)

    %br{clear:'all'}/

    - unless current_user.nil?
      .landing-sidebar
        %br/
        %h2 SESSION MUSICIANS
        %br/
        .left.w65.ib
          %strong RSVPs
        .right.w30.ib.f11 Your latency
        - if @approved_rsvps.blank?
          None
        - @approved_rsvps.each_with_index do |rsvp, index|
          .clearall.left.w100.h20.ib.mb10.rsvp-details{'data-user-id' => rsvp.id}
            .avatar-tiny{'hoveraction' => "musician", 'user-id' => rsvp.id}
              - if rsvp.photo_url.nil?
                = image_tag 'shared/avatar_generic.png', :alt => ""
              - else
                %img{:src => "#{rsvp.photo_url}"}
            .left.f11.ml10.rsvp-name
              = rsvp.name
            .left.ml10
              - process_approved_rsvps(rsvp).each do |i|
                %img.instrument-icon{'instrument-id' => i[:id], 'title' => i[:id], height:24, width:24}
            .right.w30.ib.f11.center.latency-tags

        %br{:clear => "all"}/
        %br/
        .left.w65.ib.still-needed
          %strong Still Needed
          - if @music_session.is_unstructured_rsvp
            .clearall.left.w100.h20.ib.mb10
              Open to any instrument
          - elsif @open_slots.blank?
            .clearall.left.w100.h20.ib.mb10
              All slots are taken
          - else
            - @open_slots.each do |slot|
              .clearall.left.w100.h20.ib.mb10
                .ib.h20
                  %img.instrument-icon{'instrument-id' => slot.instrument_id, 'title' => slot.instrument_id, height:24, width:24}
                .f11.ml10.ib.h20
                  = slot.instrument_id.capitalize
                  = "(#{slot.proficiency_desc})"

        %br/
        .w65.ib.invited
          %strong Invited
        %br/
        - if @pending_invitations.blank?
          None
        - @pending_invitations.each_with_index do |invite, index|
          - if index == 0
            .avatar-tiny.needed{'hoveraction' => "musician", 'user-id' => invite.id}
              - unless invite.photo_url.blank?
                = image_tag "#{invite.photo_url}", alt: ""
              - else
                = image_tag "shared/avatar_generic.png", alt: ""
          - else
            .ml10.avatar-tiny.needed
              - unless invite.photo_url.blank?
                = image_tag "#{invite.photo_url}", alt: ""
              - else
                = image_tag "shared/avatar_generic.png", alt: ""

  - else
    .left.f20.teal
      %strong.not-found PRIVATE SESSION
      %br/
      .clearall.left.w20.ib.mb10

  %br{:clear => "all"}/
  %br/
  - content_for :after_black_bar do
    %br/
    - unless current_user.nil?
      = render :partial => "shared/comments", :locals => {:comments => @music_session.session_info_comments, :id => "txtSessionInfoComment", :info_page => true}

  - content_for :extra_js do
    :javascript
      $(function () {
         var ss = new window.JK.ShowSessionInfo(JK.app, "#{@music_session.id}");
         ss.initialize();
      })

%script{:type => 'text/template', :id => 'template-latency-detail'}
  %table.musicians{:cellpadding => 0, :cellspacing => 0}
    %tr.mb15
      %td{:class => "{latency_style} latency"} {latency_text}
