Skip to content

Commit

Permalink
Fix Jquery interation by returing false in obeserve_toggles function
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Lang committed May 24, 2018
1 parent c3311a2 commit c5ae84c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions app/assets/javascripts/forms.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ var observe_fields_for_links = function(){
};

var observe_toggles = function(){
$('.toggle-target').each(function(){
$('.toggle-target').each(function(){
$(this).click(function(){
var target = $(this).data('target');
console.log($(this));
$(target).toggle();
return false
});
});
};
};
36 changes: 18 additions & 18 deletions app/views/assessments/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@

<div class = "row">
<div class = "col-md-4 sidebar">

<% if @assessment.start_date.blank? %>

<h3>You are about to start a new assessment</h3>
<p>You can click on the start assessment button to start from the beginning or you can click on one of the 'start' buttons to begin the assessment at a particular activity.</p>

<% else %>

<div id = "title-display">
<h3><%= @assessment.title %>
<h3><%= @assessment.title %>
<%= link_to 'Edit', '#', id: "title-toggle", class: "small toggle-target btn orange", data: { target: "#title-form,#title-display" } %></h3>
</div>

Expand All @@ -27,7 +27,7 @@
<%= link_to 'Cancel', '#', class: "toggle-target btn btn-default", data: { target: "#title-form,#title-display" } %>
<% end %>
</div>

<hr/>

<p class = "small">&#x1f4c5; <span class = "italic">Started <%= pretty_date(@assessment.start_date) %></span><br/>
Expand All @@ -36,7 +36,7 @@
<hr/>

<div id = "notes-display">
<h4>Background information <%= link_to 'Edit', '#title-form', class: "small toggle-target btn orange", id: "notes-toggle",
<h4>Background information <%= link_to 'Edit', '#title-form', class: "small toggle-target btn orange", id: "notes-toggle",
data: { target: "#notes-form,#notes-display" } %>
</h4>
<p class = "small italic">
Expand Down Expand Up @@ -65,28 +65,28 @@
<div id="reference-display">
<h4>Reference Documentation</h4>
<p class="small">
The assessment questionnaire has been based on the <a href="http://theodi.org/guides/maturity-model">open data maturity model</a>.
The assessment questionnaire has been based on the <a href="http://theodi.org/guides/maturity-model">open data maturity model</a>.
</p>
<p class="small">Read the reference documentation for further information and suggestions about how to conduct a review.
</p>
</div>

<div class="importantLinks ">
<p><span class="glyphicon glyphicon-download" aria-hidden="true"></span>
<p><span class="glyphicon glyphicon-download" aria-hidden="true"></span>
<%= link_to "Download maturity model assessment grid", "https://drive.google.com/uc?export=download&id=0B4rriq9nxtslOHRQMEhZOFRXSTg", target: "_blank" %>
</p>
<p><span class="glyphicon glyphicon-download" aria-hidden="true"></span>
<p><span class="glyphicon glyphicon-download" aria-hidden="true"></span>
<%= link_to "Download maturity model guide", "https://drive.google.com/uc?export=download&id=0B4rriq9nxtslYmdBckNZYXoyU1U", target: "_blank" %>
</p>
</div>

</div>
<div class = "col-md-8 assessment-overview">

<div class="row">
<div class="col-md-8">
This assessment is <%= progress = @progress.percentage_progress %>% complete
<%= progress_bar(progress) %>
<%= progress_bar(progress) %>
</div>
<div class="col-md-4">
<% if @assessment.status == :complete %>
Expand All @@ -95,24 +95,24 @@
<% if @assessment.can_complete? %>
<%= link_to "See my scores", complete_assessment_path(@assessment), method: :post, data: {confirm: "You will not be able to edit your answers after this point"}, class: "complete btn green" %>
<% else %>
<% if @assessment.assessment_answers.empty? %>
<% if @assessment.assessment_answers.empty? %>
<%= link_to "Start assessment >", continue_assessment_path(@assessment), class: "btn green" %>
<% else %>
<% else %>
<%= link_to "Continue assessment >", continue_assessment_path(@assessment), class: "btn green" %>
<% end %>
<% end %>
<% end %>
<% end %>
</div>
</div>
<% if @assessment.can_complete? %>
<div class="row">
<div class="col-md-12">
<span class="small">You are now ready to complete your assessment. Once you have finished making any final revisions to
<span class="small">You are now ready to complete your assessment. Once you have finished making any final revisions to
your answers mark the assessment as complete to see your scores and review your final report.</span>
</div>
</div>
</div>
<% end %>

<hr/>

<%= render 'overview', assessment: @assessment, progress: @progress %>
Expand All @@ -121,4 +121,4 @@

<% content_for :javascript_footer do %>
observe_toggles();
<% end %>
<% end %>

0 comments on commit c5ae84c

Please sign in to comment.