Skip to content

Commit

Permalink
Move count to front & only show if > 0
Browse files Browse the repository at this point in the history
  • Loading branch information
niknetniko committed Sep 29, 2020
1 parent 90621ef commit 30d6a08
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion app/controllers/courses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,12 @@ def questions
.order(updated_at: :desc)
.includes(:user, :last_updated_by, submission: [:exercise])
.paginate(page: parse_pagination_param(params[:unanswered_page]), per_page: 10)
@title = I18n.t('courses.questions.questions.page_title', count: @course.unanswered_questions.count)
count = @course.unanswered_questions.count
@title = if count == 0
I18n.t('courses.questions.questions.title')
else
I18n.t('courses.questions.questions.page_title', count: @course.unanswered_questions.count)
end
@dot_icon.push(:questions) if @unanswered.any?
end

Expand Down
2 changes: 1 addition & 1 deletion config/locales/views/courses/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ en:
open: "Unanswered questions"
in_progress: "Questions in progress"
closed: "Answered questions"
page_title: "Questions (%{count})"
page_title: "(%{count}) Questions"
title: "Questions"
auto_refresh: Automatically refresh questions
no_questions:
Expand Down
2 changes: 1 addition & 1 deletion config/locales/views/courses/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ nl:
in_progress: "Vragen in behandeling"
closed: "Beantwoorde vragen"
title: "Vragen"
page_title: "Vragen (%{count})"
page_title: "(%{count}) Vragen"
auto_refresh: Vragen automatisch vernieuwen
no_questions:
answered: "Er zijn momenteel geen beantwoorde vragen."
Expand Down

0 comments on commit 30d6a08

Please sign in to comment.