Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ユーザー個別ページ、一覧ページのカウント数一覧にポートフォリオを追加 #7522

Merged
merged 3 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)