openSUSE/osem

View on GitHub
app/views/conferences/_conference_details.html.haml

Summary

Maintainability
Test Coverage
.row{ id: "conference-#{conference.id}" }
  .col-md-12
    .well
      .row
        .col-md-4.text-center
          = image_tag(conference.picture_url, class: 'img-responsive') if conference.picture?
        .col-md-6
          %h3
            = conference.title
            %small
              %b
              = date_string(conference.start_date, conference.end_date)
          - if conference.venue
            %p
              %span>= conference.city
              - if conference.city and conference.country_name
                \/
              %span>= conference.country_name
          - unless conference.description.blank?
            %p
              = markdown(conference.description)
        .col-md-2
          .btn-group-vertical
            - if !@conference || @conference != conference
              - if conference.splashpage && conference.splashpage.public
                = link_to "View Conference", conference_path(conference.short_title), class: 'btn btn-default'
            - if conference.program and conference.program.schedule_public
              = link_to "Schedule", conference_schedule_path(conference.short_title), class: 'btn btn-default'
            - unless conference.code_of_conduct.blank?
              = link_to "Code of Conduct",
                [:code_of_conduct, conference.organization],
                class: 'btn btn-default'
            - if conference.registration_open?
              - if conference.user_registered?(current_user)
                = link_to "My Registration", conference_conference_registration_path(conference.short_title), class: 'btn btn-default'
              - else
                = link_to "Register", new_conference_conference_registration_path(conference.short_title), class: "btn btn-default", disabled: cannot?(:new, Registration.new(conference_id: conference.id))
                - if cannot?(:new, Registration.new(conference_id: conference.id)) && conference.registration_limit_exceeded?
                  Sorry, no places left
            - if current_user && current_user.tracks.where(program: conference.program).length > 0
              = link_to 'My Track Requests', conference_program_tracks_path(conference.short_title), class: 'btn btn-default'
            - elsif can? :new, conference.program.tracks.new
              = link_to 'Submit Track Request', new_conference_program_track_path(conference.short_title), class: 'btn btn-default'
            - if !current_user.nil? && current_user.proposal_count(conference) > 0
              = link_to "My Proposals", conference_program_proposals_path(conference.short_title), class: 'btn btn-default'
            - elsif can? :new, conference.program.events.new
              - if conference.program.cfp_open?
                = link_to "Submit Proposal", new_conference_program_proposal_path(conference.short_title), class: 'btn btn-default'
            - if current_user && current_user.booths.where(conference_id: conference.id).count > 0
              = link_to "My #{(t'booth').capitalize } Requests", conference_booths_path(conference.short_title), class: 'btn btn-default'
            - elsif can? :new, conference.booths.new
              = link_to "Request #{(t'booth').capitalize }", new_conference_booth_path(conference.short_title), class: 'btn btn-default'
            - if current_user.nil? || !current_user.subscribed?(conference)
              = link_to 'Subscribe', conference_subscriptions_path(conference.short_title), method: :post, class: 'btn btn-default'
            - else
              = link_to 'Unsubscribe', conference_subscriptions_path(conference.short_title), method: :delete, class: 'btn btn-default'
            - if current_user && current_user.physical_tickets.by_conference(conference).any?
              = link_to 'My Tickets', conference_physical_tickets_path(conference.short_title), class: 'btn btn-default'
            - surveys_after_conference = conference.surveys.after_conference.select(&:active?)
            = link_to 'Surveys', conference_surveys_path(conference.short_title), class: 'btn btn-default' if surveys_after_conference.any? && conference.ended?