Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added history_link_tag; localized strings

  • Loading branch information...
commit d7e895ba318ea19ef1a49d9b4bf36da3c89af4b4 1 parent fa6f9c2
@joannou joannou authored
View
4 app/presenters/outline_assessment_presenter.rb
@@ -24,6 +24,10 @@ def start_button_tag
end
end
+ def history_link_tag
+ history.empty? ? '' : content_tag(:a, I18n.t('woople_theme.assessment.history'), class: 'flip-action pull-right')
+ end
+
def each_history_item
history.each do |history_item|
yield normalize(history_item)
View
18 app/views/woople-theme/_outline_assessment.html.erb
@@ -2,23 +2,23 @@
<div class="assessment">
<div class="front">
<div class="assessment-pad">
- <a class="flip-action pull-right">History</a>
+ <%= assessment.history_link_tag %>
<h3><%=t('woople_theme.outline.assessment')%></h3>
<p class="assessment-attributes">
<span class="badge"><%=t('woople_theme.outline.assessment_questions', count: assessment.questions_asked) %></span>
<span class="badge"><%=t('woople_theme.outline.assessment_requirement', percent: assessment.pass_requirement) %></span>
- <span class="badge"><%= assessment.estimated_duration %>:00 minutes</span>
+ <span class="badge"><%= assessment.estimated_duration %><%= t 'woople_theme.assessment.duration' %></span>
</p>
<div class="alert alert-error">
<a class="close" data-dismiss="alert">×</a>
- You failed! Please watch the <strong>Require Relearning</strong> before attempting the assessment again.
+ <%= t 'woople_theme.assessment.fail_html' %>
</div>
<% assessment.render_relearnings do %>
- <h4>Required Relearning</h4>
+ <h4><%= t 'woople_theme.assessment.required_relearning' %></h4>
<%= outline(assessment) do |outline| %>
<%= outline.videos(assessment.relearnings) %>
<% end %>
@@ -32,16 +32,16 @@
<div class="back">
<div class="assessment-pad">
- <a class="flip-action-back pull-right">Assessment</a>
+ <a class="flip-action-back pull-right"><%= t 'woople_theme.assessment.name' %></a>
- <h3>Assessment History</h3>
+ <h3><%= t 'woople_theme.assessment.assessment_history' %></h3>
<div class="assessment-history">
<table class="table">
<thead>
<tr>
- <th style="width:50%">Date</th>
- <th>Score</th>
- <th class="count">Result</th>
+ <th style="width:50%"><%= t 'woople_theme.assessment.date_title' %></th>
+ <th><%= t 'woople_theme.assessment.score_title' %></th>
+ <th class="count"><%= t 'woople_theme.assessment.result_title' %></th>
</tr>
</thead>
<tbody>
View
9 config/locales/en.yml
@@ -22,3 +22,12 @@ en:
dislike: Dislike
assessment:
start: Start Assessment
+ history: History
+ duration: :00 minutes
+ fail_html: You failed! Please watch the <strong>Require Relearning</strong> before attempting the assessment again.
+ required_relearning: Required Relearning
+ name: Assessment
+ assessment_history: Assessment History
+ date_title: Date
+ score_title: Score
+ result_title: Result
View
18 spec/presenters/outline_assessment_presenter_spec.rb
@@ -104,6 +104,24 @@
end
end
+ describe "#history_link_tag" do
+ describe 'when no history items' do
+ subject { OutlineAssessmentPresenter.new(stub(:assessment, history: [])) }
+
+ it 'returns an empty string' do
+ subject.history_link_tag.should be_blank
+ end
+ end
+
+ describe 'when having history items' do
+ subject { OutlineAssessmentPresenter.new(stub(:assessment, history: [stub])) }
+
+ it 'returns a link' do
+ subject.history_link_tag.should_not be_blank
+ end
+ end
+ end
+
describe "#each_history_item" do
before do
first_history_item = stub(passed: false, score: 42, url: 'foo', completed_at: Date.parse('20120307')).as_null_object
Please sign in to comment.
Something went wrong with that request. Please try again.