From 499b525a0e0055fb0b00a92d6736abf2cf133167 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 10 Dec 2023 21:53:12 +0100 Subject: [PATCH] Add empty hints for user pages --- app/views/user/questions.html.haml | 3 +++ app/views/user/show.html.haml | 3 +++ app/views/user/show_follow.html.haml | 3 +++ config/locales/views.en.yml | 5 +++++ 4 files changed, 14 insertions(+) diff --git a/app/views/user/questions.html.haml b/app/views/user/questions.html.haml index aa410ffd..9b94eb34 100644 --- a/app/views/user/questions.html.haml +++ b/app/views/user/questions.html.haml @@ -1,4 +1,7 @@ #questions + - if @questions.empty? + = render "shared/empty", icon: "fa-regular fa-comment", translation_key: ".user.questions" + - @questions.each do |q| = render 'shared/question', q: q, type: nil diff --git a/app/views/user/show.html.haml b/app/views/user/show.html.haml index 98f36de8..40beee3d 100644 --- a/app/views/user/show.html.haml +++ b/app/views/user/show.html.haml @@ -7,6 +7,9 @@ = render "answerbox", a: #answers + - if @answers.empty? + = render "shared/empty", icon: "fa-regular fa-comments", translation_key: ".user.answers" + - @answers.each do |a| = render "answerbox", a: diff --git a/app/views/user/show_follow.html.haml b/app/views/user/show_follow.html.haml index ca284ab8..1497f1bb 100644 --- a/app/views/user/show_follow.html.haml +++ b/app/views/user/show_follow.html.haml @@ -1,3 +1,6 @@ +- if @users.empty? + = render "shared/empty", icon: "fa-regular fa-user", translation_key: ".user.#{type}" + .row.row-cols-1.row-cols-sm-2.row-cols-md-3#users - @users.each do |user| .col.pb-3 diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index deddd4fb..dcf921ff 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -573,6 +573,11 @@ en: show: "Show full question" hide: "Hide full question" empty: + user: + answers: "This user hasn't answered any questions yet." + questions: "This user hasn't asked any questions yet." + follower: "This user has no followers." + friend: "This user is not following anyone." formatting: body_html: |

%{app_name} uses Markdown for formatting