I know that there have been some questions regarding Javascript not working in Heroku due to asset pipeline compilation problems etc ... which is way above my head.
I just wanted to add a simple link (see below) to my simple application built with Middleman which should reload page onclick and in turn trigger shuffle! method:
<a href="javascript:;" onClick="window.location.reload()">Click to refresh</a>
Is that even possible? It works fine locally, but no longer works when I push to Heroku. Any thoughts/help appreciated thanks.
Here is a link to the actual app on Heroku: http://coastguard-quiz.herokuapp.com/
My index.html.erb code is below:
---
title: Coast Guard Quiz
---
<h1>Coast Guard Rank Quiz</h1>
<h3>Guess the enlisted insignia below:</h3>
<%
seaman_recruit = {
img: "<img src = 'images/USCG_SR.png'>",
name: "Seaman Recruit",
en_class: "Seaman",
}
seaman_apprentice = {
img: "<img src = 'images/USCG_SA.png'>",
name: "Seaman Apprentice",
en_class: "Seaman",
}
seaman = {
img: "<img src = 'images/USCG_SM.png'>",
name: "Seaman",
en_class: "Seaman",
abbr: "SN",
title:"Seaman (last name)",
paygrade: "E3"
}
ranks = [seaman_recruit, seaman_apprentice, seaman, pettyofficer3, pettyofficer2, pettyofficer1]
current_rank = ranks.shuffle!.first
img_now = current_rank[:img]
name_now = current_rank[:name]
class_now = current_rank[:en_class]
abbr_now = current_rank[:abbr]
title_now = current_rank[:title]
paygrade_now = current_rank[:paygrade]
%>
<div id="container" class="shadow">
<p><%= img_now %></p>
<div id="hideaway" style="display:none;">
<p class="bld"><%= name_now %></p>
<p><%= class_now %></p>
<p><%= abbr_now %></p>
<p><%= title_now %></p>
<p><%= paygrade_now %></p>
<a href="javascript:;" onClick="document.getElementById('hideaway').style.display='none'; document.getElementById('showme').style.display='block'">Hide Answer</a>
</div>
<div id="showme">
<a class="show" href="javascript:;" onClick="document.getElementById('hideaway').style.display='block'; document.getElementById('showme').style.display='none';">Get answer</a>
</div>
</div>
<a href="javascript:;" onClick="window.location.reload()">Click to refresh</a>
id="container"is responsibility of the controller, not the view.