openSUSE/osem

View on GitHub
app/views/admin/schedules/show.html.haml

Summary

Maintainability
Test Coverage
.unobtrusive-flash-container

.row
  .col-md-12
    .page-header
      %h1 Schedule
      %p.text-muted
        Create the schedules for the conference

- if @rooms.present?
  .row
    .col-md-2
      Selected schedule
      :ruby
        if @schedule.track
          value = @schedule == @schedule.track.selected_schedule
          url = update_selected_schedule_admin_conference_program_track_path(@conference.short_title, @schedule.track) + '?[track][selected_schedule_id]='
        else
          value = @schedule.id == @selected_schedule.try(:id)
          url = admin_conference_program_path(@conference.short_title) + '?[program][selected_schedule_id]='
        end
      = check_box_tag @conference.short_title, @schedule.id, value, url: url,
        class: 'switch-checkbox-schedule'
      .h4
        Unscheduled events
      .unscheduled-events
        - @unscheduled_events.each do |e|
          = render partial: 'event', locals: { event: e, event_schedule_id: nil }
    .col-md-10
      %ul.nav.nav-tabs
        - @dates.each do |date|
          %li{ class: "#{ (@dates.first == date) ? 'active' : '' }"}
            %a{ href: "##{date}" }
              = date
      .tab-content
        - @dates.each do |date|
          .tab-pane{ class: "#{ (@dates.first == date) ? 'active' : '' }", id: "#{date}" }
            = render partial: 'day_tab', locals: { date: date }
- else
  - if @venue.try(:rooms).present?
    .text-right
      - if can? :create, @program.schedules.new
        = link_to 'Add Schedule', admin_conference_schedules_path(@conference.short_title),
        method: :post, class: 'btn btn-primary'
  - elsif @venue
    .h3
      No Rooms!
      %small
        = link_to 'Create rooms', admin_conference_venue_rooms_path
        before creating the schedule.
  - else
    .h3
      No Venue!
      %small
        = link_to 'Create a venue with rooms', new_admin_conference_venue_path
        before creating the schedule.

:javascript
  $(document).ready( function() {
    Schedule.initialize("#{admin_conference_event_schedules_path(@conference)}", "#{@schedule.id}");
  });