From 1636b458eee39a2585637317df966ea25dd1f15a Mon Sep 17 00:00:00 2001 From: Ana Date: Tue, 19 Jul 2016 23:49:06 +0200 Subject: [PATCH] Inform that there are no rooms in the schedule Inform that there are no rooms when creating the schedule with a message instead of creating a room with the title "No rooms". The message also include a link to the place where rooms are created. --- app/controllers/admin/schedules_controller.rb | 2 +- app/views/admin/schedules/show.html.haml | 55 +++++++++++-------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/app/controllers/admin/schedules_controller.rb b/app/controllers/admin/schedules_controller.rb index 5ad2e6aa..d3c7cea3 100644 --- a/app/controllers/admin/schedules_controller.rb +++ b/app/controllers/admin/schedules_controller.rb @@ -25,7 +25,7 @@ module Admin @event_schedules = @schedule.event_schedules @unscheduled_events = @program.events.confirmed - @schedule.events @dates = @conference.start_date..@conference.end_date - @rooms = (@venue && @venue.rooms.any?) ? @venue.rooms : [Room.new(name: 'No Rooms!', size: 0)] + @rooms = @conference.venue.rooms if @conference.venue end def destroy diff --git a/app/views/admin/schedules/show.html.haml b/app/views/admin/schedules/show.html.haml index d4233224..9b2d3571 100644 --- a/app/views/admin/schedules/show.html.haml +++ b/app/views/admin/schedules/show.html.haml @@ -7,30 +7,37 @@ %p.text-muted Create the schedules for the conference -.row - .col-md-2 - Selected schedule - = check_box_tag @conference.short_title, @schedule.id, (@schedule.id == @selected_schedule.try(:id)), - method: :patch, url: (admin_conference_program_path(@conference.short_title) + '?[program][selected_schedule_id]='), - class: 'switch-checkbox-schedule', data: { size: 'small', - off_color: 'warning', - on_text: 'Yes', - off_text: 'No' } - .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 } +- if @rooms.present? + .row + .col-md-2 + Selected schedule + = check_box_tag @conference.short_title, @schedule.id, (@schedule.id == @selected_schedule.try(:id)), + method: :patch, url: (admin_conference_program_path(@conference.short_title) + '?[program][selected_schedule_id]='), + class: 'switch-checkbox-schedule', data: { size: 'small', + off_color: 'warning', + on_text: 'Yes', + off_text: 'No' } + .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 + .h3 + No Rooms! + %small + = link_to 'Create rooms', admin_conference_venue_rooms_path + before creating the schedule. :javascript $(document).ready( function() {