mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
116 lines
4.4 KiB
Text
116 lines
4.4 KiB
Text
<div id="schedule-content">
|
|
<h2> Schedule for <%= @conference.title %></h2>
|
|
<ul class="nav nav-tabs">
|
|
<% @dates.each do |date| %>
|
|
<li <%= "class=active" if @dates.first == date %>>
|
|
<%= link_to date, "#" + "#{date}", "data-toggle" => "tab" %>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
|
|
<div class="tab-content">
|
|
<% @dates.each do |date| %>
|
|
<div class="tab-pane <%= 'active' if @dates.first == date %>" id ="<%= date %>" >
|
|
<table class="table table-bordered" id="schedule" width="100%">
|
|
<tr>
|
|
<th>Time</th>
|
|
<% @rooms.each do |room| %>
|
|
<th><%= room.name %></th>
|
|
<% end %>
|
|
</tr>
|
|
|
|
<% span = {} %>
|
|
<% @rooms.each do |room| %>
|
|
<% span[room.id] = 1 %>
|
|
<% end %>
|
|
|
|
<% conf_start = DateTime.parse("#{date} 09:00") %>
|
|
<% conf_end = DateTime.parse("#{date} 19:00") %>
|
|
|
|
<% while conf_start < conf_end %>
|
|
|
|
<tr>
|
|
<td style="width:5%">
|
|
<%= conf_start.strftime("%H:%M") %>
|
|
</td>
|
|
|
|
<% @rooms.each do |room| %>
|
|
<% event = @events.find_all{|event|event.start_time and event.start_time.strftime("%Y-%m-%d %H:%M").eql? conf_start.strftime("%Y-%m-%d %H:%M") and event.room_id == room.id } %>
|
|
<% if !event.empty? %>
|
|
<!-- There is an event, calculate the span and show it -->
|
|
<% span[room.id] = event[0].event_type.length / 15 %>
|
|
<td style="width: <%= 95 / @rooms.length %>%; cursor:pointer"
|
|
rowspan ="<%= span[room.id] %>"
|
|
class="event" role="button"
|
|
data-href="<%= url_for(conference_proposal_path(@conference.short_title, event[0].id)) %>">
|
|
<h5>
|
|
<%- speaker = event[0].speakers.first || event[0].submitter %>
|
|
<%= image_tag speaker.gravatar_url, :class => "img-circle pull-right", :alt => speaker.public_name, :title => speaker.public_name, :style => "padding:8px;" %>
|
|
<i class="icon-comment"></i>
|
|
<%= event[0].title %><br>
|
|
<% unless event[0].subtitle.empty? %>
|
|
<span class="text-error"><%= event[0].subtitle %></span><br>
|
|
<% end %>
|
|
<i class="icon-user"></i>
|
|
<%= speaker.public_name %>
|
|
<% if event[0].track%>
|
|
<br><i class="icon-road"></i>
|
|
<span class="label" style="background-color:<%= event[0].track.color if event[0].track %>"><%= event[0].track.name %></span>
|
|
<% end -%>
|
|
</h5>
|
|
</td>
|
|
<% span[room.id] = span[room.id] + 1 %>
|
|
<% elsif span[room.id] > 1 %>
|
|
<!-- span is <%= span[room.id] %> and bigger than 1, substract 1 from span -->
|
|
<% span[room.id] = ( span[room.id] - 1 ) if span[room.id] > 1 %>
|
|
<% end %>
|
|
<% if span[room.id] == 1 %>
|
|
<!-- span equals 1 show an empty td -->
|
|
<td style="width: <%= 95 / @rooms.length %>%">
|
|
</td>
|
|
<% end %>
|
|
<%end %>
|
|
</tr>
|
|
<% conf_start += 15.minutes %>
|
|
<%end %>
|
|
</table>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<%= javascript_tag do %>
|
|
jQuery( function($) {
|
|
$('tbody tr td[data-href]').addClass('clickable').mouseup(function(e) {
|
|
if(e.which===1)
|
|
{
|
|
window.location = $(this).attr('data-href');
|
|
}
|
|
else if(e.which===2)
|
|
{
|
|
window.open($(this).attr('data-href'), '_blank');
|
|
}
|
|
});
|
|
});
|
|
|
|
$(function() {
|
|
// add a hash to the URL when the user clicks on a tab
|
|
$('a[data-toggle="tab"]').on('click', function(e) {
|
|
history.pushState(null, null, $(this).attr('href'));
|
|
});
|
|
// navigate to a tab when the history changes
|
|
window.addEventListener("popstate", function(e) {
|
|
var activeTab = $('[href=' + location.hash + ']');
|
|
if (activeTab.length) {
|
|
activeTab.tab('show');
|
|
} else {
|
|
$('.nav-tabs a:first').tab('show');
|
|
}
|
|
});
|
|
});
|
|
|
|
$(function() {
|
|
var hash = window.location.hash;
|
|
hash && $('ul.nav a[href="' + hash + '"]').tab('show');
|
|
});
|
|
|
|
<% end %>
|