Skip to content
Snippets Groups Projects
ProjectLastComments.vue 1.62 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">
              <div>
                <router-link
                  :to="getRouteUrl(item.related_feature.feature_url)"
                >
                  "{{ item.comment }}"
                </router-link>
              </div>
              <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';

export default {
Florent Lavelle's avatar
Florent Lavelle committed

Florent Lavelle's avatar
dev
Florent Lavelle committed
  name: 'ProjectsLastComments',

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

  computed: {
    ...mapState([
      'user'
    ]),
    ...mapState([
      'last_comments',
    ]),
  }

};
</script>