Merge remote-tracking branch 'jamal/develop' into develop

This commit is contained in:
Luke Barratt 2014-10-11 23:11:06 +01:00
commit cc48f8ab32
2 changed files with 11 additions and 4 deletions

View file

@ -3,7 +3,7 @@
<% if @gatherer and @gatherer.can_destroy? cuser %>
<p>Gather running, <%= Gather::FULL - @gather.gatherers.length %> more needed.</p>
<%= link_to 'Leave Gather', @gatherer, confirm: 'Are you sure?', method: :delete, class: 'button tiny' %>
<%= link_to 'Leave Gather', @gatherer, confirm: 'Are you sure?', method: :delete, class: 'button tiny leave-gather' %>
<% elsif (g = Gatherer.new(gather: @gather, user: cuser)).can_create?(cuser) %>
<%= form_for g do |f| %>

View file

@ -1,7 +1,7 @@
<div id="jplayer"></div>
<script type="text/javascript">
var played = false;
var leaving = true;
var leave_confirm = true;
<% if @gatherer and @gatherer.can_destroy? cuser %>
var gatherer_id = <%= @gatherer.id %>;
<% else %>
@ -59,17 +59,24 @@
});
$(window).bind('beforeunload', function(e) {
if (gatherer_id > 0) {
if (gatherer_id > 0 && leave_confirm) {
return "You will be removed from the Gather if you leave this page.";
}
});
$(window).bind('unload', function() {
if (gatherer_id > 0) {
if (gatherer_id > 0 && leave_confirm) {
updateGathererStatus('leaving');
}
});
var disable_leave_confirm = function() {
leave_confirm = false;
}
$('.leave-gather').click(disable_leave_confirm);
$('#gather-area a').click(disable_leave_confirm);
var afk = false;
var afk_timeout;
var afk_time = 1000 * 60 * 15; // 15 minutes