Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • geocontrib/geocontrib-frontend
  • ext_matthieu/geocontrib-frontend
  • fnecas/geocontrib-frontend
  • MatthieuE/geocontrib-frontend
4 results
Show changes
Commits on Source (10)
......@@ -132,8 +132,8 @@
</div>
</header>
<main>
<div id="messages" class="ui stackable grid centered container">
<div v-if="messages" class="row">
<div id="content" class="ui stackable grid centered container">
<div v-if="messages && messages.length > 0" class="row">
<div class="fourteen wide column">
<div
v-for="(message, index) in messages"
......
......@@ -50,7 +50,7 @@ export default {
processedOptions: function () {
//* si un objet {name, value}
let options = this.options.map((el) =>
el.constructor == Object ? el.name : el
el.constructor === Object ? el.name : el
);
if (this.search && this.input !== "") {
options = this.searchOptions(options);
......
......@@ -27,21 +27,21 @@
class="ui icon margin-left"
>
<i
v-if="importFile.status == 'processing'"
v-if="importFile.status === 'processing'"
class="orange hourglass half icon"
></i>
<i
v-else-if="importFile.status == 'finished'"
v-else-if="importFile.status === 'finished'"
class="green check circle outline icon"
></i>
<i
v-else-if="importFile.status == 'failed'"
v-else-if="importFile.status === 'failed'"
class="red x icon"
></i>
<i v-else class="red ban icon"></i>
</span>
<span
v-if="importFile.status == 'pending'"
v-if="importFile.status === 'pending'"
data-tooltip="Statut en attente. Clickez pour rafraichir."
>
<i
......
......@@ -265,7 +265,7 @@ export default {
addLayers(baseMap) {
baseMap.layers.forEach((layer) => {
var layerOptions = this.layers.find((l) => l.id == layer.id);
var layerOptions = this.layers.find((l) => l.id === layer.id);
console.log(layerOptions);
layer = Object.assign(layer, layerOptions);
layer.options.basemapId = baseMap.id;
......
......@@ -92,7 +92,7 @@ export default new Vuex.Store({
},
DISPLAY_MESSAGE(state, comment) {
state.messages = [{ comment }, ...state.messages];
document.getElementById("messages").scrollIntoView({ block: "start", inline: "nearest" });
document.getElementById("content").scrollIntoView({ block: "start", inline: "nearest" });
},
CLEAR_MESSAGES(state) {
state.messages = [];
......
......@@ -118,10 +118,12 @@ const feature = {
...extraFormObject
}
}
if (routeName === "editer-signalement") {
axios
.put(`${rootState.configuration.VUE_APP_DJANGO_API_BASE}features/${state.form.feature_id}/`, geojson)
.put(`${rootState.configuration.VUE_APP_DJANGO_API_BASE}features/${state.form.feature_id}/?` +
`feature_type__slug=${rootState.feature_type.current_feature_type_slug}` +
`&project__slug=${rootState.project_slug}`
, geojson)
.then((response) => {
if (response.status === 200 && response.data) {
if (state.attachmentFormset.length > 0 || state.linkedFormset.length > 0) {
......
......@@ -22,7 +22,10 @@
<i class="plus fitted icon"></i>
</router-link>
<router-link
v-if="permissions && permissions.can_update_feature"
v-if="
(permissions && permissions.can_update_feature) ||
isFeatureCreator
"
:to="{
name: 'editer-signalement',
params: {
......@@ -95,34 +98,22 @@
<td>Statut</td>
<td>
<i
v-if="feature.status === 'archived'"
class="grey archive icon"
></i>
<i
v-else-if="feature.status === 'pending'"
class="teal hourglass outline icon"
></i>
<i
v-else-if="feature.status === 'published'"
class="olive check icon"
></i>
<i
v-else-if="feature.status === 'draft'"
class="orange pencil alternate icon"
v-if="feature.status"
:class="getIconLabelStatus(feature.status, 'icon')"
></i>
{{ feature.get_status_display }}
{{ getIconLabelStatus(feature.status, 'label') }}
</td>
</tr>
<tr>
<td>Date de création</td>
<td v-if="feature.created_on">
{{ feature.created_on }}
{{ feature.created_on | formatDate }}
</td>
</tr>
<tr>
<td>Date de dernière modification</td>
<td v-if="feature.updated_on">
{{ feature.updated_on }}
{{ feature.updated_on | formatDate }}
</td>
</tr>
<tr>
......@@ -429,9 +420,42 @@ export default {
console.log("result", result);
return result;
},
isFeatureCreator() {
if (this.feature && this.user) {
return this.feature.creator === this.user.id;
}
return false;
},
},
filters: {
formatDate(value) {
let date = new Date(value);
date = date.toLocaleString().replace(",", "");
return date.substr(0, date.length - 3); //* quick & dirty way to remove seconds from date
},
},
methods: {
getIconLabelStatus(status, type){
if (status === 'archived')
if (type == 'icon')
return "grey archive icon";
else return 'Archivé';
else if (status === 'pending')
if (type == 'icon')
return "teal hourglass outline icon";
else return 'En attente de publication';
else if (status === 'published')
if (type == 'icon')
return "olive check icon";
else return 'Publié';
else if (status === 'draft')
if (type == 'icon')
return "orange pencil alternate icon";
else return 'Brouillon';
},
pushNgo(link) {
this.$router.push({
name: "details-signalement",
......
......@@ -213,25 +213,25 @@
<td class="center">
<div
v-if="feature.properties.status.value == 'archived'"
v-if="feature.properties.status.value === 'archived'"
data-tooltip="Archivé"
>
<i class="grey archive icon"></i>
</div>
<div
v-else-if="feature.properties.status.value == 'pending'"
v-else-if="feature.properties.status.value === 'pending'"
data-tooltip="En attente de publication"
>
<i class="teal hourglass outline icon"></i>
</div>
<div
v-else-if="feature.properties.status.value == 'published'"
v-else-if="feature.properties.status.value === 'published'"
data-tooltip="Publié"
>
<i class="olive check icon"></i>
</div>
<div
v-else-if="feature.properties.status.value == 'draft'"
v-else-if="feature.properties.status.value === 'draft'"
data-tooltip="Brouillon"
>
<i class="orange pencil alternate icon"></i>
......@@ -340,7 +340,7 @@
<div class="ui icon header">
<i class="trash alternate icon"></i>
Êtes-vous sûr de vouloir effacer
<span v-if="checkedFeatures.length == 1"> un signalement ? </span>
<span v-if="checkedFeatures.length === 1"> un signalement ? </span>
<span v-else> ces {{ checkedFeatures.length }} signalements ? </span>
</div>
<div class="actions">
......@@ -492,16 +492,16 @@ export default {
filterdFeatures = filterdFeatures.sort((a, b) => {
let aProp = this.getFeatureDisplayName(a);
let bProp = this.getFeatureDisplayName(b);
if (this.sort.column == "statut") {
if (this.sort.column === "statut") {
aProp = a.properties.status.value;
bProp = b.properties.status.value;
} else if (this.sort.column == "type") {
} else if (this.sort.column === "type") {
aProp = a.properties.feature_type.title;
bProp = b.properties.feature_type.title;
} else if (this.sort.column == "updated_on") {
} else if (this.sort.column === "updated_on") {
aProp = a.properties.updated_on;
bProp = b.properties.updated_on;
} else if (this.sort.column == "display_creator") {
} else if (this.sort.column === "display_creator") {
aProp = a.properties.display_creator;
bProp = b.properties.display_creator;
}
......@@ -563,14 +563,14 @@ export default {
},
isSortedAsc(column) {
return this.sort.column == column && this.sort.ascending;
return this.sort.column === column && this.sort.ascending;
},
isSortedDesc(column) {
return this.sort.column == column && !this.sort.ascending;
return this.sort.column === column && !this.sort.ascending;
},
changeSort(column) {
if (this.sort.column == column) {
if (this.sort.column === column) {
//changer order
this.sort.ascending = !this.sort.ascending;
} else {
......
......@@ -4,17 +4,17 @@
<div class="ui attached secondary segment">
<h1 class="ui center aligned header">
<img
v-if="structure.geom_type == 'point'"
v-if="structure.geom_type === 'point'"
class="ui medium image"
src="@/assets/img/marker.png"
/>
<img
v-if="structure.geom_type == 'linestring'"
v-if="structure.geom_type === 'linestring'"
class="ui medium image"
src="@/assets/img/line.png"
/>
<img
v-if="structure.geom_type == 'polygon'"
v-if="structure.geom_type === 'polygon'"
class="ui medium image"
src="@/assets/img/polygon.png"
/>
......@@ -74,7 +74,7 @@
/>
</div>
<button
:disabled="fileToImport.size == 0"
:disabled="fileToImport.size === 0"
@click="importGeoJson"
class="ui fluid teal icon button"
>
......@@ -118,19 +118,19 @@
:key="feature.feature_id + index"
class="ui small header"
>
<span v-if="feature.status == 'archived'" data-tooltip="Archivé">
<span v-if="feature.status === 'archived'" data-tooltip="Archivé">
<i class="grey archive icon"></i>
</span>
<span
v-else-if="feature.status == 'pending'"
v-else-if="feature.status === 'pending'"
data-tooltip="En attente de publication"
>
<i class="teal hourglass outline icon"></i>
</span>
<span v-else-if="feature.status == 'published'" data-tooltip="Publié">
<span v-else-if="feature.status === 'published'" data-tooltip="Publié">
<i class="olive check icon"></i>
</span>
<span v-else-if="feature.status == 'draft'" data-tooltip="Brouillon">
<span v-else-if="feature.status === 'draft'" data-tooltip="Brouillon">
<i class="orange pencil alternate icon"></i>
</span>
<router-link
......
......@@ -446,9 +446,9 @@ export default {
},
translateLabel(value) {
if (value == "LineString") {
if (value === "LineString") {
return "linestring";
} else if (value == "Polygon" || value == "MultiPolygon") {
} else if (value === "Polygon" || value === "MultiPolygon") {
return "polygon";
}
return "point";
......
......@@ -100,17 +100,17 @@
}"
>
<img
v-if="type.geom_type == 'point'"
v-if="type.geom_type === 'point'"
class="list-image-type"
src="@/assets/img/marker.png"
/>
<img
v-if="type.geom_type == 'linestring'"
v-if="type.geom_type === 'linestring'"
class="list-image-type"
src="@/assets/img/line.png"
/>
<img
v-if="type.geom_type == 'polygon'"
v-if="type.geom_type === 'polygon'"
class="list-image-type"
src="@/assets/img/polygon.png"
/>
......@@ -242,7 +242,7 @@
<br />
<div id="button-import" v-if="fileToImport.size > 0">
<button
:disabled="fileToImport.size == 0"
:disabled="fileToImport.size === 0"
@click="toNewFeatureType"
class="ui fluid teal icon button"
>
......
......@@ -102,7 +102,8 @@ export default {
.dispatch("map/SAVE_BASEMAPS", this.newBasemapIds)
.then((response) => {
const errors = response.filter(
(res) => res.status !== 200 && res.status !== 204
(res) =>
res.status === 200 && res.status === 201 && res.status === 204
);
if (errors.length === 0) {
this.infoMessage.push({
......