ensl.org/app/helpers/gathers_helper.rb
jamal aa0d0673b6 Change Gather style to volunteer captains
This will change the gather format to allow for players to volunteer to be captain / commander. The gather will not change from the running state until 2 commanders have volunteered. Once commanders have volunteered the gather will switch to the picking state. The voting state is no longer used.

Also, added a new sound alert that will be played when the gather is full but doesn't have 2 captains. This alert will loop every 10 seconds unless you're the commander. And changed the music to play once the gather switches to the picking state and only if the player doesn't have the gather page on focus.
2014-10-11 15:50:06 -04:00

25 lines
820 B
Ruby

module GathersHelper
def render_gather
if @gather.status == Gather::STATE_RUNNING
if @gather.is_full? and !@gather.is_ready? and @gather.captain1 != @gatherer and @gather.captain2 != @gatherer
headers['Gather'] = 'full'
else
headers['Gather'] = 'running'
end
render partial: 'running', layout: false
elsif @gather.status == Gather::STATE_VOTING
if @gatherer and @gather.gatherer_votes.first(conditions: { user_id: cuser.id })
headers['Gather'] = 'voted'
else
headers['Gather'] = 'voting'
end
render partial: 'voting', layout: false
elsif @gather.status == Gather::STATE_PICKING or @gather.status == Gather::STATE_FINISHED
headers['Gather'] = 'picking'
render partial: 'picking', layout: false
end
end
end