Skip to content
Snippets Groups Projects
Commit 998d026d authored by Timothee P's avatar Timothee P :sunflower:
Browse files

Add function on button export features and some improvements

parent 887cd78c
No related branches found
No related tags found
No related merge requests found
...@@ -133,6 +133,9 @@ const feature = { ...@@ -133,6 +133,9 @@ const feature = {
commit("SET_USER", false) commit("SET_USER", false)
}); */ }); */
}, },
EXPORT_FEATURES({state}) {
console.log("Export features", state.features)
}
}, },
} }
......
...@@ -99,7 +99,7 @@ const feature_type = { ...@@ -99,7 +99,7 @@ const feature_type = {
console.log("data", data) console.log("data", data)
axios axios
.post(`${process.env.VUE_APP_DJANGO_API_BASE}feature_type/`, data) .post(`${process.env.VUE_APP_DJANGO_API_BASE}feature-types/`, data)
.then((response) => { .then((response) => {
const routerHistory = this.$router.options.routerHistory const routerHistory = this.$router.options.routerHistory
store.commit("SET_USER", response.data.user); store.commit("SET_USER", response.data.user);
......
...@@ -191,7 +191,11 @@ ...@@ -191,7 +191,11 @@
{{ feature.display_creator }} {{ feature.display_creator }}
</td> </td>
</tr> </tr>
<tr v-if="filteredFeatures.length === 0" class="odd"><td colspan="5" class="dataTables_empty" valign="top">Aucune donnée disponible</td></tr> <tr v-if="filteredFeatures.length === 0" class="odd">
<td colspan="5" class="dataTables_empty" valign="top">
Aucune donnée disponible
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
...@@ -277,7 +281,8 @@ export default { ...@@ -277,7 +281,8 @@ export default {
created() { created() {
if (!this.project) { if (!this.project) {
this.$store.dispatch("GET_PROJECT_MESSAGES", this.$route.params.slug); //this.$store.dispatch("GET_PROJECT_MESSAGES", this.$route.params.slug);
this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug);
} }
}, },
mounted() { mounted() {
......
...@@ -101,12 +101,9 @@ ...@@ -101,12 +101,9 @@
Vous pouvez télécharger l'ensemble des signalements ayant le Vous pouvez télécharger l'ensemble des signalements ayant le
statut publiés pour ce type. statut publiés pour ce type.
</p> </p>
<a <button type="button" class="ui fluid teal icon button" @click="exportFeatures">
class="ui fluid teal icon button"
href="{% url 'api:project-export' slug=project.slug feature_type_slug=feature_type.slug %}"
>
<i class="download icon"></i> Exporter <i class="download icon"></i> Exporter
</a> </button>
// todo gérer export // todo gérer export
</div> </div>
</div> </div>
...@@ -134,11 +131,18 @@ ...@@ -134,11 +131,18 @@
<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> <i class="orange pencil alternate icon"></i>
</span> </span>
<a <router-link
href="{% url 'geocontrib:feature_detail' slug=project.slug feature_type_slug=feature.feature_type.slug feature_id=feature.feature_id %}" :to="{
name: 'details-signalement',
params: {
slug: project.slug,
slug_type_signal: feature.feature_type.slug,
slug_signal: feature.feature_id,
},
}"
> >
{{ feature.title }} {{ feature.title }}
</a> </router-link>
<div class="sub header"> <div class="sub header">
<div> <div>
{{ feature.description.substring(0, 200) }} {{ feature.description.substring(0, 200) }}
...@@ -218,9 +222,6 @@ export default { ...@@ -218,9 +222,6 @@ export default {
}, },
methods: { methods: {
// forceRerender(key) {
// return key += 1;
// },
onFileChange(e) { onFileChange(e) {
var files = e.target.files || e.dataTransfer.files; var files = e.target.files || e.dataTransfer.files;
if (!files.length) return; if (!files.length) return;
...@@ -272,6 +273,13 @@ export default { ...@@ -272,6 +273,13 @@ export default {
console.log(err); console.log(err);
}); });
}, },
exportFeatures() {
console.log("TEST", this.$store)
this.$store.dispatch(
"feature/EXPORT_FEATURES",
this.$route.params.slug_type_signal
);
},
}, },
created() { created() {
......
...@@ -65,5 +65,11 @@ export default { ...@@ -65,5 +65,11 @@ export default {
this.$store.dispatch("map/SAVE_BASEMAPS"); this.$store.dispatch("map/SAVE_BASEMAPS");
}, },
}, },
created() {
if (!this.$store.getters.project) {
this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug);
}
},
}; };
</script> </script>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment