From e46b9b13896fe8280a29a2c9aeb084da0c19f67b Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Fri, 29 Jul 2022 20:09:33 +0200 Subject: [PATCH] Use subdirectory for Discover tabs --- app/views/discover/_tab_asked.haml | 3 --- app/views/discover/_tab_most.haml | 3 --- app/views/discover/_tab_new.haml | 3 --- app/views/discover/index.haml | 12 ++++++------ .../{_tab_answers.haml => tab/_answers.haml} | 0 app/views/discover/tab/_asked.haml | 3 +++ .../{_tab_discussed.haml => tab/_discussed.haml} | 0 app/views/discover/tab/_most.haml | 3 +++ app/views/discover/tab/_new.haml | 3 +++ .../{_tab_questions.haml => tab/_questions.haml} | 0 10 files changed, 15 insertions(+), 15 deletions(-) delete mode 100644 app/views/discover/_tab_asked.haml delete mode 100644 app/views/discover/_tab_most.haml delete mode 100644 app/views/discover/_tab_new.haml rename app/views/discover/{_tab_answers.haml => tab/_answers.haml} (100%) create mode 100644 app/views/discover/tab/_asked.haml rename app/views/discover/{_tab_discussed.haml => tab/_discussed.haml} (100%) create mode 100644 app/views/discover/tab/_most.haml create mode 100644 app/views/discover/tab/_new.haml rename app/views/discover/{_tab_questions.haml => tab/_questions.haml} (100%) diff --git a/app/views/discover/_tab_asked.haml b/app/views/discover/_tab_asked.haml deleted file mode 100644 index 0927fd85..00000000 --- a/app/views/discover/_tab_asked.haml +++ /dev/null @@ -1,3 +0,0 @@ -.tab-pane.fade{ role: :tabpanel, id: 'asked' } - - asked.each do |user| - = render 'discover/userbox', u: user.user, type: 'asked', q: user.question_count diff --git a/app/views/discover/_tab_most.haml b/app/views/discover/_tab_most.haml deleted file mode 100644 index 31d4a356..00000000 --- a/app/views/discover/_tab_most.haml +++ /dev/null @@ -1,3 +0,0 @@ -.tab-pane.fade{ role: :tabpanel, id: 'answered' } - - answered.each do |user| - = render 'discover/userbox', u: user.user, type: 'most', a: user.answer_count diff --git a/app/views/discover/_tab_new.haml b/app/views/discover/_tab_new.haml deleted file mode 100644 index 99ceb4e2..00000000 --- a/app/views/discover/_tab_new.haml +++ /dev/null @@ -1,3 +0,0 @@ -.tab-pane.active.fade.show{ role: :tabpanel, id: 'new' } - - new.each do |user| - = render 'discover/userbox', u: user, type: 'new' diff --git a/app/views/discover/index.haml b/app/views/discover/index.haml index 2d995070..2353a0d5 100644 --- a/app/views/discover/index.haml +++ b/app/views/discover/index.haml @@ -18,9 +18,9 @@ %li.nav-item{ role: 'presentation' } %a.nav-link{ href: '#comments', role: :tab, aria: { controls: 'comments' }, data: { toggle: :tab } }= t(".content.tab.comments") .tab-content.mt-3 - = render 'discover/tab_answers', answers: @popular_answers - = render 'discover/tab_questions', questions: @popular_questions - = render 'discover/tab_discussed', comments: @most_discussed + = render 'discover/tab/answers', answers: @popular_answers + = render 'discover/tab/questions', questions: @popular_questions + = render 'discover/tab/discussed', comments: @most_discussed .col-md-5.col-sm-6 %h2= t(".people.heading") %p= t(".people.description") @@ -33,7 +33,7 @@ %li.nav-item{ role: 'presentation' } %a.nav-link{ href: '#answered', role: :tab, aria: { controls: 'answered' }, data: { toggle: :tab } }= t(".people.tab.answers") .tab-content.mt-3 - = render 'discover/tab_new', new: @new_users - = render 'discover/tab_asked', asked: @users_with_most_questions - = render 'discover/tab_most', answered: @users_with_most_answers + = render 'discover/tab/new', new: @new_users + = render 'discover/tab/asked', asked: @users_with_most_questions + = render 'discover/tab/most', answered: @users_with_most_answers = render 'shared/links' diff --git a/app/views/discover/_tab_answers.haml b/app/views/discover/tab/_answers.haml similarity index 100% rename from app/views/discover/_tab_answers.haml rename to app/views/discover/tab/_answers.haml diff --git a/app/views/discover/tab/_asked.haml b/app/views/discover/tab/_asked.haml new file mode 100644 index 00000000..c17a7dd2 --- /dev/null +++ b/app/views/discover/tab/_asked.haml @@ -0,0 +1,3 @@ +.tab-pane.fade{ role: :tabpanel, id: 'asked' } + - asked.each do |user| + = render 'discover/userbox', u: user.user, type: 'asked', value: user.question_count diff --git a/app/views/discover/_tab_discussed.haml b/app/views/discover/tab/_discussed.haml similarity index 100% rename from app/views/discover/_tab_discussed.haml rename to app/views/discover/tab/_discussed.haml diff --git a/app/views/discover/tab/_most.haml b/app/views/discover/tab/_most.haml new file mode 100644 index 00000000..f65ad3be --- /dev/null +++ b/app/views/discover/tab/_most.haml @@ -0,0 +1,3 @@ +.tab-pane.fade{ role: :tabpanel, id: 'answered' } + - answered.each do |user| + = render 'discover/userbox', u: user.user, type: 'most', value: user.answer_count diff --git a/app/views/discover/tab/_new.haml b/app/views/discover/tab/_new.haml new file mode 100644 index 00000000..01bf51be --- /dev/null +++ b/app/views/discover/tab/_new.haml @@ -0,0 +1,3 @@ +.tab-pane.active.fade.show{ role: :tabpanel, id: 'new' } + - new.each do |user| + = render 'discover/userbox', u: user, type: 'new', value: time_ago_in_words(user.created_at) diff --git a/app/views/discover/_tab_questions.haml b/app/views/discover/tab/_questions.haml similarity index 100% rename from app/views/discover/_tab_questions.haml rename to app/views/discover/tab/_questions.haml