osem-fcy/app/views/conference/_all_events.html.erb
Ana 70f30fcb1f Dropdown with date tags in all events
Dropdown with date tags in all events of the schedule
2016-07-25 11:33:28 +02:00

74 lines
2.6 KiB
Text

<h1 class="text-center">Program for <%= @conference.title %></h1>
<div class="dropdown program-dropdown">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Dates
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<% @dates.each do |date| %>
<!-- we check if there is any event that day to indicate it appropiately -->
<li class='li-dropdown-program'>
<%= link_to date, "#program-" + "#{date}", class: "program-selector#{ ' no-events-day' unless @conference.program.any_event_for_this_date?(date) }" %>
</li>
<% end %>
<% if @unscheduled_events.any? %>
<li class='li-dropdown-program'>
<%= link_to('Unscheduled', "#program-unscheduled", class: 'program-selector') %>
</li>
<% end %>
</ul>
</div>
<div class="row">
<!-- scheduled events -->
<% date = nil %>
<% time = nil %>
<% @scheduled_events.each do |event| %>
<% unless event.start_time.strftime('%Y-%m-%d').eql?(date) %>
<div class='col-xs-12 col-md-12 all-events-title'>
<span class='date-title' id='program-<%= event.start_time.strftime('%Y-%m-%d') %>'>
<%= date = event.start_time.strftime('%Y-%m-%d') %>
</span>
<a title="Go up" class="pull-right" href="#program">
<i class="fa fa-angle-double-up fa-lg" aria-hidden="true"></i>
</a>
</div>
<% end %>
<% unless event.start_time.strftime('%H:%M').eql?(time) %>
<div class='col-xs-12 col-md-1 start-time'>
<%= time = event.start_time.strftime('%H:%M') %>
</div>
<div class='col-xs-12 col-md-11 new-time-event'>
<%= render partial: 'event', locals: {event: event} %>
</div>
<% else %>
<div class='col-xs-12 col-md-11 col-md-offset-1'>
<%= render partial: 'event', locals: {event: event} %>
</div>
<% end %>
<% end %>
<!-- confirmed events that are not scheduled -->
<% if @unscheduled_events.any? %>
<div class='col-xs-12 col-md-12 all-events-title'>
<span class='date-title' id='program-unscheduled'>
Unscheduled events
</span>
<a title="Go up" class="pull-right" href="#program">
<i class="fa fa-angle-double-up fa-lg" aria-hidden="true"></i>
</a>
</div>
<% end %>
<% @unscheduled_events.each do |event| %>
<div class='col-xs-12 col-md-12 unscheduled-event'>
<%= render partial: 'event', locals: {event: event} %>
</div>
<% end %>
</div>
<%= javascript_tag do %>
$('.program-selector').on('click', function(e) {
$('.li-dropdown-program').removeClass('active');
});
<% end %>