Skip to content

Commit

Permalink
Merge pull request #248 from sc0v/waiver-update
Browse files Browse the repository at this point in the history
  • Loading branch information
sclark authored Mar 28, 2017
2 parents f5d6be7 + a29388e commit 0cf483f
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 64 deletions.
9 changes: 7 additions & 2 deletions app/controllers/waivers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ def new
else
@user.start_waiver_timer
end


@should_see_video = !@user.is_scc?

end


Expand All @@ -34,7 +36,10 @@ def create
flash[:error] = "You must agree to the terms of the release."
redirect_to action: :new
elsif params[:phone_number] == ""
flash[:error] = "You must provide a mobile phone number"
flash[:error] = "You must provide a mobile phone number."
redirect_to action: :new
elsif params[:signature] != @participant.name
flash[:error] = "You must electronically sign the waiver with your full name as it appears on the waiver."
redirect_to action: :new
else
@participant.phone_number = params[:phone_number]
Expand Down
119 changes: 57 additions & 62 deletions app/views/waivers/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,108 +1,103 @@


<% if !current_user.participant.is_scc? or params[:participant_id]== nil %>
<div class="page-header">
<h1>Midway Safety Video</h1>
</div>

<p>You must watch the video prior to signing the waiver.</p>

<div id="player"></div>
<div id="waiver" style="display: none;">
<% else %>
<div id="waiver">
<% end %>


<h2><%= Time.now.year %> SPRING CARNIVAL MIDWAY RELEASE OF LIABILITY</h2>

<p>

I, <%= @user.name %>, want to participate in Carnegie Mellon University (“CMU”) <%= Time.now.year %> Spring Carnival Midway construction

activities and/or be present on the Midway construction site (collectively, the “Activities.”) I understand

that the Activities may involve climbing, crawling, physical exertion, the use of and/or proximity to hand

and power tools and construction materials and equipment.
</p>
<p>

I understand that there are risks (including, but not limited to, the risk of injury, disability and death)

associated with my participation in the Activities. I voluntarily assume all the risks. In consideration of

the benefits of participation in the Activities, I hereby, on behalf of myself and those acting on my
<h2><%= Time.now.year %> SPRING CARNIVAL MIDWAY RELEASE OF LIABILITY</h2>

behalf, irrevocably and unconditionally release, waive and promise not to sue CMU from/for any and all
<p>
I, <%= @user.name %>, want to participate in Carnegie Mellon University (“CMU”) <%= Time.now.year %> Spring Carnival Midway construction
activities and/or be present on the Midway construction site (collectively, the “Activities.”) I understand
that the Activities may involve climbing, crawling, physical exertion, the use of and/or proximity to hand
and power tools and construction materials and equipment.
</p>

liabilities, losses, injuries, damages, claims, demands, actions and/or causes of action related to my
<p>
I understand that there are risks (including, but not limited to, the risk of injury, disability and death)
associated with my participation in the Activities. I voluntarily assume all the risks. In consideration of
the benefits of participation in the Activities, I hereby, on behalf of myself and those acting on my
behalf, irrevocably and unconditionally release, waive and promise not to sue CMU from/for any and all
liabilities, losses, injuries, damages, claims, demands, actions and/or causes of action related to my
participation in the Activities, including the securing of medical treatment for me.
</p>

participation in the Activities, including the securing of medical treatment for me.
</p>
<p>
<p>
The laws of Pennsylvania shall apply to this Release. If any of its provisions are declared illegal,
unenforceable or ineffective, they shall be deemed severable and all other provisions shall remain valid and binding.
</p>

The laws of Pennsylvania shall apply to this Release. If any of its provisions are declared illegal,
<%= form_tag( participant_waiver_path(@user) ) do %>

unenforceable or ineffective, they shall be deemed severable and all other provisions shall remain valid and binding.
</p>

<%= form_tag( participant_waiver_path(@user) ) do %>
<div>
<%= check_box_tag :agree %> <%= label_tag :agree, "I have read this release and understand it and I voluntarily agree to all its provisions." %>

<%= check_box_tag :agree %>
<%= label_tag :agree, "I have read this release and understand it and I voluntarily agree to all its provisions." %>
</div>

<div>
<%= check_box_tag :adult %>
<%= label_tag :adult, "I am 18 years of age or older" %>
<%= label_tag :adult, "I am 18 years of age or older." %>
</div>

<div>
<h3>Emergency Alert Information</h3>
<p>All Spring Carnival participants must provide their mobile phone number, which will be enrolled in the emergency alert system.</p>
<div><%= label_tag :emergency_phone, "Cell Phone:" %> <%= text_field_tag :phone_number %></div>
<div><%= label_tag :emergency_phone, "Phone Carrier:" %> <%= collection_select(:participant, :phone_carrier_id, PhoneCarrier.all, :id, :name) %></div>
<div>
<%= label_tag :emergency_phone, "Cell Phone:" %>
<%= text_field_tag :phone_number %>
</div>
<div>
<%= label_tag :emergency_phone, "Phone Carrier:" %>
<%= collection_select(:participant, :phone_carrier_id, PhoneCarrier.all, :id, :name) %>
</div>
</div>

<div style="margin-top: 30px;">
<%= submit_tag "Submit", class: "btn btn-primary" %>
<p>By typing your full name below you are digitally signing this document.</p>
<%= label_tag :signature, "Required electronic signature:" %>
<%= text_field_tag :signature %>
</div>

<% end %>
</div>

<div>
<%= submit_tag "Submit", class: "btn btn-primary" %>
</div>

<% end %>

<% if !current_user.participant.is_scc? or params[:participant_id]== nil %>
<script src="https://www.youtube.com/player_api"></script>
<script>

// create youtube player
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: '8ZH95wK55uY',
playerVars: { 'controls': 0, 'rel' : 0, 'autoplay' : 1, 'showinfo' : 0},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: '8ZH95wK55uY',
playerVars: { 'controls': 0, 'rel' : 0, 'autoplay' : 1, 'showinfo' : 0},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}

// autoplay video
// autoplay video if there were no flashed errors
function onPlayerReady(event) {
event.target.playVideo();
<%= (@should_see_video and flash[:error] == nil)? "event.target.playVideo();" : "showWaiver();" %>
}

// when video ends
function onPlayerStateChange(event) {
if(event.data === 0) {
$('#player').slideUp();
$('#waiver').slideDown();
if (event.data === 0) showWaiver();
}

function showWaiver() {
$('#player').slideUp();
$('#waiver').slideDown();
}

</script>
<% end %>

0 comments on commit 0cf483f

Please sign in to comment.