Skip to content

Commit

Permalink
Merge pull request #7305 from fjordllc/feature/replace-num-of-actions…
Browse files Browse the repository at this point in the history
…-on-user-list-page-with-link

ユーザー一覧ページの各アクション数をリンクに変更
  • Loading branch information
komagata authored Feb 15, 2024
2 parents 96088c2 + 9b7bca0 commit b146b7b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 35 deletions.
20 changes: 20 additions & 0 deletions app/javascript/components/user-activity-count.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<template lang="pug">
.card-counts__item
.card-counts__item-inner
dt.card-counts__item-label
| {{ activityName }}
dd.card-counts__item-value(:class='activityCount == 0 ? "is-empty" : ""')
span(v-if='activityCount == 0')
| {{ activityCount }}
a.a-text-link(v-else)(:href='activityUrl')
| {{ activityCount }}
</template>
<script>
export default {
props: {
activityName: { type: Object, required: true },
activityCount: { type: Object, required: true },
activityUrl: { type: Object, required: true }
}
}
</script>
59 changes: 24 additions & 35 deletions app/javascript/components/user-activity-counts.vue
Original file line number Diff line number Diff line change
@@ -1,44 +1,33 @@
<template lang="pug">
.card-counts.is-users.mt-3(v-if='user.student_or_trainee')
dl.card-counts__items
.card-counts__item
.card-counts__item-inner
dt.card-counts__item-label
| 日報
dd.card-counts__item-value(
:class='user.report_count == 0 ? "is-empty" : ""')
| {{ user.report_count }}
.card-counts__item
.card-counts__item-inner
dt.card-counts__item-label
| 提出物
dd.card-counts__item-value(
:class='user.product_count == 0 ? "is-empty" : ""')
| {{ user.product_count }}
.card-counts__item
.card-counts__item-inner
dt.card-counts__item-label
| コメント
dd.card-counts__item-value(
:class='user.comment_count == 0 ? "is-empty" : ""')
| {{ user.comment_count }}
.card-counts__item
.card-counts__item-inner
dt.card-counts__item-label
| 質問
dd.card-counts__item-value(
:class='user.question_count == 0 ? "is-empty" : ""')
| {{ user.question_count }}
.card-counts__item
.card-counts__item-inner
dt.card-counts__item-label
| 回答
dd.card-counts__item-value(
:class='user.answer_count == 0 ? "is-empty" : ""')
| {{ user.answer_count }}
user-activity-count(
activity-name='日報',
:activity-count='user.report_count',
:activity-url='`${user.url}/reports`')
user-activity-count(
activity-name='提出物',
:activity-count='user.product_count',
:activity-url='`${user.url}/products`')
user-activity-count(
activity-name='コメント',
:activity-count='user.comment_count',
:activity-url='`${user.url}/comments`')
user-activity-count(
activity-name='質問',
:activity-count='user.question_count',
:activity-url='`${user.url}/questions`')
user-activity-count(
activity-name='回答',
:activity-count='user.answer_count',
:activity-url='`${user.url}/answers`')
</template>
<script>
import UserActivityCount from './user-activity-count.vue'
export default {
components: {
'user-activity-count': UserActivityCount
},
props: {
user: { type: Object, required: true }
}
Expand Down

0 comments on commit b146b7b

Please sign in to comment.