Skip to content
Snippets Groups Projects
ProjectLastComments.vue 1.83 KiB
Newer Older
Florent Lavelle's avatar
dev
Florent Lavelle committed
<template>
  <div class="orange card">
    <div class="content">
      <div class="center aligned header">
        Derniers commentaires
      </div>
      <div class="center aligned description">
        <div
          :class="{ active: loading }"
          class="ui inverted dimmer"
        >
          <div class="ui text loader">
            Récupération des commentaires en cours...
          </div>
        </div>
        <div class="ui relaxed list">
          <div
            v-for="(item, index) in last_comments"
            :key="'comment ' + index"
            class="item"
          >
            <div class="content">
              <FeatureFetchOffsetRoute
                :feature-id="item.related_feature.feature_id"
                :properties="{
                  title: item.comment,
                  feature_type: { slug: item.related_feature.feature_type_slug }
                }"
              />
Florent Lavelle's avatar
dev
Florent Lavelle committed
              <div class="description">
Florent Lavelle's avatar
Florent Lavelle committed
                <em>[ {{ item.created_on
Florent Lavelle's avatar
dev
Florent Lavelle committed
                }}<span
                  v-if="user && item.display_author"
                >, par {{ item.display_author }}
                </span>
Florent Lavelle's avatar
Florent Lavelle committed
                  ]</em>
Florent Lavelle's avatar
dev
Florent Lavelle committed
              </div>
            </div>
          </div>
Florent Lavelle's avatar
Florent Lavelle committed
          <em
Florent Lavelle's avatar
dev
Florent Lavelle committed
            v-if="!last_comments || last_comments.length === 0"
Florent Lavelle's avatar
Florent Lavelle committed
          >Aucun commentaire pour le moment.</em>
Florent Lavelle's avatar
dev
Florent Lavelle committed
        </div>
      </div>
    </div>
  </div>
</template>

<script>

import { mapState } from 'vuex';
import FeatureFetchOffsetRoute from '@/components/Feature/FeatureFetchOffsetRoute';
Florent Lavelle's avatar
dev
Florent Lavelle committed

export default {
  name: 'ProjectsLastComments',
Florent Lavelle's avatar
dev
Florent Lavelle committed

  props: {
    loading: {
      type: Boolean,
      default: false
    }
  },

  computed: {
    ...mapState([
      'user'
    ]),
Florent Lavelle's avatar
dev
Florent Lavelle committed
      'last_comments',
    ]),
Florent Lavelle's avatar
dev
Florent Lavelle committed
};
</script>