Newer
Older
<template>
<div>
<h1 class="ui header">
<div class="content">

Timothee P
committed
v-if="fastEditionMode && form && canEditFeature"
class="form ui half-block"
>
<input
id="feature_detail_title_input"
:value="form.title"
type="text"
required
maxlength="128"
name="title"
>
</span>
<span v-else>
{{ currentFeature.title || currentFeature.feature_id }}
</span>

Timothee P
committed
<router-link
v-if="displayToListButton"
id="feature-detail-to-features-list"
:to="{
name: 'liste-signalements',
params: { slug: $route.params.slug },
}"
custom
>
<div class="ui button tiny-margin teal">
<i class="ui icon arrow right" />
Retour à la liste des signalements
</div>
</router-link>

Timothee P
committed
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
<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>

Timothee P
committed
v-if="fastEditionMode && canEditFeature"
:class="['ui button button-hover-orange tiny-margin', { disabled: false }]"
data-tooltip="Enregistrer les modifications"
data-position="bottom center"
@click="$store.dispatch('feature/SEND_FEATURE', $route.name)"
>
<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 && canEditFeature"

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

Timothee P
committed
class="ui button button-hover-red tiny-margin"
data-tooltip="Supprimer le signalement"
data-position="bottom right"
@click="$emit('setIsDeleting')"
<i
class="inverted grey trash alternate icon"
aria-hidden="true"
/>
</a>
</div>
<div class="ui hidden divider" />
<div class="sub header prewrap">

Timothee P
committed
v-if="fastEditionMode && canEditFeature && form"
class="form ui half-block"
>
<textarea
:value="form.description.value"
name="description"
rows="5"
@blur="updateDescription"
/>
</span>
<span v-else>
{{ currentFeature.description }}
</span>
</div>
</div>
</h1>
</div>
</template>
<script>
import { mapState, mapGetters } from 'vuex';

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
displayToListButton: {
type: Boolean,
default: false,
},

Timothee P
committed
isFeatureCreator: {
type: Boolean,
default: false,
},
canEditFeature: {
type: Boolean,
default: false,
},
canDeleteFeature: {
type: Boolean,
default: false,
},

Timothee P
committed
},
computed: {
...mapState([
'user',
'isOnline',
]),
...mapState('feature', [

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]
}
});
this.$store.commit('feature/UPDATE_FORM_FIELD', { name: 'title', value: e.target.value });
},
updateDescription(e) {
this.$store.commit('feature/UPDATE_FORM_FIELD', { name: 'description', value: e.target.value });

Timothee P
committed
}
}

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

Timothee P
committed
#feature-detail-to-features-list {
line-height: 0;
margin-right: 5px;
}
.half-block {
display: inline-block;
width: 50%;
}
#feature_detail_title_input {
font-weight: bold;
font-size: 2em;
padding: .25em;
}