openSUSE/osem

View on GitHub
app/views/admin/events/index.html.haml

Summary

Maintainability
Test Coverage
.row
  .col-md-12
    .page-header
      %h1
        Events
        = "(#{@events.length})" if @events.any?

        .btn-group.pull-right
          %button.btn.btn-primary{ title: 'Mass import of commercials for events',
            data: { toggle: 'modal', target: '#mass-commercials-modal' } }
            Add Commercials

          - if can? :create, Event
            = link_to 'Add Event',
              new_admin_conference_program_event_path(@conference.short_title),
              class: 'button btn btn-default btn-info'

          - if can? :read, Event
            - @export_formats.each do |export_format|
              = render 'export_menu',
                export_format: export_format,
                conference_id: @conference.short_title

      %p.text-muted
        All the submissions of your speakers

.modal#mass-commercials-modal
  .modal-dialog
    .modal-content
      .modal-header
        %h1
          Add commercials to events
      .modal-body
        = form_for('', url: mass_upload_commercials_admin_conference_program_path(@conference.short_title), method: :post) do |f|
          .form-group
            = f.file_field 'file', as: :file
            %span.help-block
              Upload your file with data in the following format:
              %b Event_ID:Commercial_Link
              for instance:
              %pre
                11:https://youtube.com/myvideo
                23:https://vimeo.com/myvideo
          .modal-footer
            = f.submit nil, class: 'btn btn-primary'
.row
  .col-md-4
    = render 'donut_chart', title: 'Events state',
      data: @event_distribution, colors: @event_distribution_colors
  .col-md-4
    = render 'donut_chart', title: 'Confirmed events scheduled',
      combined_data: @scheduled_event_distribution
  .col-md-4
    = render 'donut_chart', title: 'Tracks of confirmed events',
      combined_data: @tracks_distribution_confirmed
.row
  .col-md-12
    .margin-event-table
      %table.datatable
        %thead
          %tr
            %th
              %b ID
            %th
              %b Title
            - if @program.rating_enabled?
              %th
                %b Rating
            %th
              %b Submitter
            %th
              %b Speakers
            - if @program.languages.present?
              %th
                %b Language
            %th
              %b Requires Registration
            %th
              %b Highlight
            %th
              %b Type
            %th
              %b Track
            %th
              %b Difficulty
            %th
              %b State
            %th
              .fa-solid.fa-comment
            %th Add Survey
        %tbody
          - @events.each do |event|
            = render 'datatable_row',
              event: event,
              conference_id: @conference.short_title,
              program: @program,
              rating_enabled: @program.rating_enabled?,
              show_votes: @program.show_voting?,
              max_rating: @program.rating,
              event_types: @event_types,
              tracks: @tracks,
              difficulty_levels: @difficulty_levels,
              email_settings: @conference.email_settings