Newer
Older
<template>
<div>
<h1 class="ui header">
<div class="content">
{{ currentFeature.title || currentFeature.feature_id }}
<div class="ui icon right floated compact buttons">

Timothee P
committed
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
<span
v-if="featuresCount"
id="feature-count"
class="ui button tiny-margin basic"
>
{{ parseInt($route.query.offset) + 1 }} sur {{ featuresCount }}
</span>
<button
v-if="queryparams"
id="previous-feature"
:class="['ui button button-hover-green tiny-margin', { disabled: queryparams.previous < 0 }]"
data-tooltip="Voir le précédent signalement"
data-position="bottom center"
@click="toFeature('previous')"
>
<i
class="angle left fitted icon"
aria-hidden="true"
/>
</button>
<button
v-if="queryparams"
id="next-feature"
:class="[
'ui button button-hover-green tiny-margin',
{ disabled: queryparams.next >= featuresCount }
]"
data-tooltip="Voir le prochain signalement"
data-position="bottom center"
@click="toFeature('next')"
>
<i
class="angle right fitted icon"
aria-hidden="true"
/>
</button>
<button
v-if="fastEditionMode"
id="previous-feature"
:class="['ui button button-hover-orange tiny-margin', { disabled: false }]"
data-tooltip="Enregistrer les modifications"
data-position="bottom center"
@click="toFeature('previous')"
>
<i
class="save fitted icon"
aria-hidden="true"
/>
</button>
<router-link
v-if="permissions && permissions.can_create_feature"

Timothee P
committed
id="add-feature"

Timothee P
committed
slug_type_signal: $route.params.slug_type_signal || featureType.slug,

Timothee P
committed
class="ui button button-hover-green tiny-margin"

Timothee P
committed
data-position="bottom center"

Timothee P
committed
class="plus icon"

Timothee P
committed

Timothee P
committed
v-if="slugSignal &&
((permissions && permissions.can_update_feature) ||

Timothee P
committed
isModerator)

Timothee P
committed
id="edit-feature"

Timothee P
committed
slug_signal: slugSignal,
slug_type_signal: $route.params.slug_type_signal || featureType.slug,

Timothee P
committed
class="ui button button-hover-orange tiny-margin"
data-tooltip="Éditer le signalement"
data-position="bottom center"
<i
class="inverted grey pencil alternate icon"
aria-hidden="true"
/>

Timothee P
committed
<a
v-if="((permissions && permissions.can_update_feature) || isFeatureCreator) && isOnline"
id="currentFeature-delete"

Timothee P
committed
class="ui button button-hover-red tiny-margin"
data-tooltip="Supprimer le signalement"
data-position="bottom right"
@click="$emit('setIsCancelling')"
<i
class="inverted grey trash alternate icon"
aria-hidden="true"
/>
</a>
</div>
<div class="ui hidden divider" />
<div class="sub header prewrap">
{{ currentFeature.description }}
</div>
</div>
</h1>
</div>
</template>
<script>
import { mapState, mapGetters } from 'vuex';
export default {

Timothee P
committed
props: {
featuresCount : {
type: Number,
default: null,
},
slugSignal: {
type: String,
default: '',
},
featureType: {
type: Object,
default: () => {},
},
fastEditionMode: {
type: Boolean,
default: false,
}

Timothee P
committed
},
computed: {
...mapState([
'user',
'USER_LEVEL_PROJECTS',
'isOnline',
]),
...mapState('feature', [
'currentFeature'
]),
...mapGetters([
'permissions',
]),
isFeatureCreator() {
if (this.currentFeature && this.user) {
return this.currentFeature.creator === this.user.id;
}
return false;
},
isModerator() {
return this.USER_LEVEL_PROJECTS && this.USER_LEVEL_PROJECTS[this.$route.params.slug] === 'Modérateur';

Timothee P
committed
queryparams() {
return this.$route.query.offset >= 0 ? {
previous: parseInt(this.$route.query.offset) - 1,
next: parseInt(this.$route.query.offset) + 1
} : null;
},
},
methods: {
toFeature(direction) {
this.$emit('tofeature', {
name: 'details-signalement-filtre',
params: {
slug_type_signal: this.currentFeature.feature_type.slug,
},
query: {
...this.$route.query,
offset: this.queryparams[direction]
}
});
}
}

Timothee P
committed
<style>
#next-feature {
margin-right: .5rem !important;
}
</style>