Handle talks on the scheduler table as links

Previously the link functionality (open in window or tab) of those talks was
done via javascript. Because of that they couldn't be selected via right click
to be opened in a tab, copied or bookmarked.

By embedding the talk items into a link element and adding some css to hide
the link effects, like hover and underline, we get the desired behaviour
without changing it's appearance.
This commit is contained in:
Björn Geuken 2015-05-15 17:52:51 +02:00
parent 93135a6085
commit 02e6f78153
2 changed files with 33 additions and 47 deletions

View file

@ -59,3 +59,9 @@ background-image: -webkit-gradient(
.schedule-subtitle {
color: rgb(185, 74, 72);
}
a.unstyled-link {
text-decoration: none;
color: #333333;
outline: 0;
}

View file

@ -1,52 +1,32 @@
<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)) %>">
<%- if speaker = event[0].speakers.first %>
<%= image_tag speaker.gravatar_url, :class => "img-circle pull-right",
:alt => speaker.name,
:title => speaker.name,
:style => "padding:8px;" %>
<%- end %>
<h5>
<span class="fa fa-comment"></span>
<%= event[0].title %>
<% unless event[0].subtitle.blank? %>
<span class="schedule-subtitle">
<%= event[0].subtitle %>
<span>
<% end %>
</h5>
<span class="schedule-speaker">
<span class="fa fa-user"></span>
<%= "#{speaker.name}" %>
</span>
<% if event[0].track%>
<span class="schedule-track">
<span class="fa fa-road"></span>
<span class="label" style="background-color:<%= event[0].track.color if event[0].track %>"><%= event[0].track.name %></span>
class="event" role="button">
<a class="unstyled-link" href="<%= url_for(conference_proposal_path(@conference.short_title, event[0].id)) %>" >
<%- if speaker = event[0].speakers.first %>
<%= image_tag speaker.gravatar_url, :class => "img-circle pull-right",
:alt => speaker.name,
:title => speaker.name,
:style => "padding:8px;" %>
<%- end %>
<h5>
<span class="fa fa-comment"></span>
<%= event[0].title %>
<% unless event[0].subtitle.blank? %>
<span class="schedule-subtitle">
<%= event[0].subtitle %>
<span>
<% end %>
</h5>
<span class="schedule-speaker">
<span class="fa fa-user"></span>
<%= "#{speaker.name}" %>
</span>
<% end -%>
<% if event[0].track%>
<span class="schedule-track">
<span class="fa fa-road"></span>
<span class="label" style="background-color:<%= event[0].track.color if event[0].track %>"><%= event[0].track.name %></span>
</span>
<% end -%>
</a>
</td>
<%= javascript_tag do %>
jQuery( function($) {
$('tbody tr td[data-href]').addClass('clickable').mouseup(function(e) {
var url = $(this).attr('data-href');
if (e.which === 1 && e.ctrlKey){
var win = window.open(url, '_blank');
win.focus();
}
else if(e.which === 1)
{
window.location = url;
}
else if(e.which === 2)
{
var win = window.open(url, '_blank');
win.focus();
}
});
});
<% end %>