Newer
Older
Sébastien DA ROCHA
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<template>
<div class="fourteen wide column">
<img
class="ui centered small image"
src="@/assets/img/logo-neogeo-circle.png"
/>
<!-- :src="LOGO_PATH" -->
<h2 class="ui center aligned icon header">
<div class="content">
{{ APPLICATION_NAME }}
<div class="sub header">{{ APPLICATION_ABSTRACT }}</div>
</div>
</h2>
<h4 id="les_projets" class="ui horizontal divider header">PROJETS</h4>
<!-- //todo : v-if can_create_project -->
<router-link
v-if="user"
:to="{ name: 'project_create', params: { action: 'create' } }"
class="ui green basic button"
>
<i class="plus icon"></i> Créer un nouveau projet
</router-link>
<!-- //todo : v-if can_create_project -->
<router-link
v-if="user"
:to="{
name: 'project_type_list',
}"
class="ui blue basic button right floated"
>
<i class="copy icon"></i> Accéder à la liste des modèles de projets
</router-link>
<div v-if="projects" class="ui divided items">
<div v-for="project in projects" class="item" :key="project.slug">
<div class="ui tiny image">
<!-- // ? récupérer l'image sur serveur front (et non back) ? -->
<img
:src="
!project.thumbnail
? require('@/assets/img/default.png')
: DJANGO_BASE_URL + project.thumbnail + refreshId()
"
/>
</div>
<div class="middle aligned content">
<router-link
:to="{
name: 'project_detail',
params: { slug: project.slug },
}"
class="header"
>{{ project.title }}</router-link
>
<div class="description">
<p>{{ project.description }}</p>
</div>
<div class="meta">
<span class="right floated">
<strong v-if="project.moderation">Projet modéré</strong>
<strong v-else>Projet non modéré</strong>
</span>
<span
>Niveau d'autorisation requis :
{{ project.access_level_pub_feature }}</span
><br />
<span>
Mon niveau d'autorisation :
<span v-if="USER_LEVEL_PROJECTS && project">{{
USER_LEVEL_PROJECTS[project.slug]
}}</span>
<span v-if="user && user.is_administrator">{{
"+ Gestionnaire métier"
}}</span>
</span>
</div>
<div class="meta">
<span class="right floated">
<i class="calendar icon"></i> {{ project.created_on }}
</span>
<span data-tooltip="Membres">
{{ project.nb_contributors }} <i class="user icon"></i>
</span>
<span data-tooltip="Signalements">
{{ project.nb_published_features }} <i
class="map marker icon"
></i>
</span>
<span data-tooltip="Commentaires">
{{ project.nb_published_features_comments }} <i
class="comment icon"
></i>
</span>
</div>
</div>
</div>
<span v-if="!projects || projects.length === 0"
>Vous n'avez accès à aucun projet.</span
>
<div class="item"></div>
</div>
</div>
</template>
<script>
import { mapState } from "vuex";
export default {
name: "Index",
computed: {
...mapState(["projects", "user", "USER_LEVEL_PROJECTS"]),
//LOGO_PATH: () => require(configuration.VUE_APP_LOGO_PATH),
APPLICATION_NAME: function () {
return this.$store.state.configuration.VUE_APP_APPLICATION_NAME;
},
APPLICATION_ABSTRACT:function () {
return this.$store.state.configuration.VUE_APP_APPLICATION_ABSTRACT;
},
DJANGO_BASE_URL:function () {
return this.$store.state.configuration.VUE_APP_DJANGO_BASE;
},
},
methods: {
refreshId() {
//* change path of thumbnail to update image
return "?ver=" + Math.random();
},
},
created() {
if (this.$store.getters.project) {
this.$store.commit("SET_PROJECT_SLUG", null);
}
},
};
</script>