Skip to content

Commit

Permalink
add started guard clause to new tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-coggin committed Dec 1, 2023
1 parent 5e3c7c7 commit 01f8d17
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ ul>li>ul>li {
display: none;
}

.section-tag {
margin-left: govuk-spacing(1);
}

.white-space-pre-wrap {
white-space: pre-wrap;
}

#available .govuk-tag {
margin-left: govuk-spacing(1);
}
2 changes: 2 additions & 0 deletions app/services/visit_changes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def new_modules?
# @param mod [Training::Module]
# @return [Boolean]
def new_module?(mod)
return false if user.course.started?(mod)

previous_visit && previous_visit.started_at.to_i < mod.first_published_at.to_i
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/learning/_card.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- if current_user.visit_changes.new_module?(mod)
span.govuk-tag.govuk-tag--ey
= t('my_learning.new.card_tag')
= t('my_learning.new_tag.card')

h3.govuk-heading-s
= govuk_link_to mod.card_title, training_module_path(mod.name), no_visited_state: true, class: 'card-link--header'
Expand Down
2 changes: 1 addition & 1 deletion app/views/learning/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
| Available modules
- if current_user.visit_changes.new_modules?
span.govuk-tag.section-tag
= t('my_learning.new.section_tag')
= t('my_learning.new_tag.section')
- if current_user.course.available_modules.any?
.grid-container
- current_user.course.available_modules.each do |mod|
Expand Down
6 changes: 3 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ en:
percentage: "Your progress: %{num}"
viewed: You have read %{num} pages
remaining: Only %{num} pages remaining
new:
card_tag: NEW
section_tag: NEW MODULE AVAILABLE
new_tag:
card: NEW
section: NEW MODULE AVAILABLE

my_learning_log:
title: Learning log
Expand Down

0 comments on commit 01f8d17

Please sign in to comment.