Skip to content

Commit

Permalink
Merge pull request #7522 from fjordllc/feature/add-portfolio-count-to…
Browse files Browse the repository at this point in the history
…-user

ユーザー個別ページ、一覧ページのカウント数一覧にポートフォリオを追加
  • Loading branch information
komagata authored May 15, 2024
2 parents 13446cc + 4824550 commit 059e89e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/javascript/components/user-activity-counts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
activity-name='回答',
:activity-count='user.answer_count',
:activity-url='`${user.url}/answers`')
user-activity-count(
activity-name='ポートフォリオ',
:activity-count='user.work_count',
:activity-url='`${user.url}/portfolio`')
</template>
<script>
import UserActivityCount from './user-activity-count.vue'
Expand Down
1 change: 1 addition & 0 deletions app/views/api/users/_list_user.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ if user.student_or_trainee?
json.product_count user.products.size
json.question_count user.questions.size
json.answer_count user.answers.size
json.work_count user.works.size
end


Expand Down
22 changes: 17 additions & 5 deletions app/views/users/_activity_counts.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,40 @@ dl.card-counts__items
dt.card-counts__item-label
| 日報
dd.card-counts__item-value
= link_to user.reports.count, user_reports_path(user)
= link_to_if !user.reports.empty?,
user.reports.size, user_reports_path(user)
.card-counts__item
.card-counts__item-inner
dt.card-counts__item-label
| 提出物
dd.card-counts__item-value
= link_to user.products.count, user_products_path(user)
= link_to_if !user.products.empty?,
user.products.size, user_products_path(user)
.card-counts__item
.card-counts__item-inner
dt.card-counts__item-label
| コメント
dd.card-counts__item-value
= link_to user.comments.count, user_comments_path(user)
= link_to_if !user.comments.empty?,
user.comments.size, user_comments_path(user)
.card-counts__item
.card-counts__item-inner
dt.card-counts__item-label
| 質問
dd.card-counts__item-value
= link_to user.questions.count, user_questions_path(user)
= link_to_if !user.questions.empty?,
user.questions.size, user_questions_path(user)
.card-counts__item
.card-counts__item-inner
dt.card-counts__item-label
| 回答
dd.card-counts__item-value
= link_to user.answers.count, user_answers_path(user)
= link_to_if !user.answers.empty?,
user.answers.size, user_answers_path(user)
.card-counts__item
.card-counts__item-inner
dt.card-counts__item-label
| ポートフォリオ
dd.card-counts__item-value
= link_to_if !user.works.empty?,
user.works.size, user_portfolio_path(user)

0 comments on commit 059e89e

Please sign in to comment.