cleaned up progress bar display logic #47

This commit is contained in:
Mark Moser 2016-08-08 11:56:42 -05:00
parent e6358beec8
commit ac1c618a74
3 changed files with 23 additions and 26 deletions

View File

@ -11,26 +11,28 @@
</head> </head>
<body> <body>
<div class="layout"> <div class="layout">
<header <%= "class=\"no-progressbar\"" unless content_for?(:progress) %>>
<div class="page-title slash-left">
<% if content_for?(:category) %> <% if content_for?(:category) %>
<header <%= raw("class=\"no-progressbar\"") if content_for?(:summary) %>>
<div class="page-title slash-left">
<div>Section: <%= yield(:category) %></div> <div>Section: <%= yield(:category) %></div>
</div>
</header>
<% else %> <% else %>
<header class="no-progressbar">
<div class="page-title slash-left">
<div>Perficient Digital Skills Assessment</div> <div>Perficient Digital Skills Assessment</div>
<% end %>
</div> </div>
</header> </header>
<% end %>
<%= yield %> <%= yield %>
<% if content_for?(:progress) %>
<div class="progress ignore-margin">
<div class="progress-bar" role="progressbar" aria-valuenow="<%= yield :progress %>"
aria-valuemin="0" aria-valuemax="100" style="width: <%= yield :progress %>%">
<span><%= yield :progress %>%</span>
</div>
</div>
<% end %>
</div> </div>
<%= render partial: 'layouts/footer' %> <%= render partial: 'layouts/footer' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>

View File

@ -1,8 +1,8 @@
<% <%
content_for :title, "Skills Assessment" content_for :title, "Skills Assessment"
content_for :category, @question.category content_for :category, @question.category
content_for :summary, true if @status.on_summary
content_for :footer_title, "Skills Assessment" content_for :footer_title, "Skills Assessment"
content_for :progress, @status.progress.to_s
%> %>
<%= form_for(@answer, url: post_answer_path(@answer.id), html:{method: :post, id: 'answer-form', data: {qid: @question.question_id}}) do |form| %> <%= form_for(@answer, url: post_answer_path(@answer.id), html:{method: :post, id: 'answer-form', data: {qid: @question.question_id}}) do |form| %>
@ -37,12 +37,3 @@
<% end %> <% end %>
</main> </main>
<% end %> <% end %>
<% unless @status.on_summary %>
<div class="progress ignore-margin">
<div class="progress-bar" role="progressbar" aria-valuenow="<%= @status.progress %>"
aria-valuemin="0" aria-valuemax="100" style="width: <%= @status.progress %>%">
<span><%= @status.progress %>%</span>
</div>
</div>
<% end %>

View File

@ -1,3 +1,9 @@
<%
content_for :title, "Skills Assessment"
content_for :footer_title, "Skills Assessment"
content_for :progress, @status.progress.to_s
%>
<main class="summary_tpl"> <main class="summary_tpl">
<h2 class="prft-heading">Almost done!</h2> <h2 class="prft-heading">Almost done!</h2>
<p> <p>
@ -42,6 +48,4 @@
<% else %> <% else %>
<div class="error">Sorry, you must answer all questions before you can submit.</div> <div class="error">Sorry, you must answer all questions before you can submit.</div>
<% end %> <% end %>
</main> </main>