Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
STG-LV-Havana 2021-05-19 10:17:07 +03:00
commit 9f804c3cb4
10 changed files with 168 additions and 37 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -32,8 +32,29 @@
`/debates/${comment.debate.id}?comment=${comment.id}` `/debates/${comment.debate.id}?comment=${comment.id}`
) )
" "
title="Copier dans le presse papier"
> >
copier dans le presse papier <img class="copy-img" alt="edit" src="assets/img/copy.png" />
</button>
<button
v-if="clipboard && ($root.user.is('ADMIN') || $root.user.is('MODO'))"
title="Exporter vers l'Influent"
@click="shareComment()"
>
<img class="copy-img" alt="edit" src="assets/img/share.png" />
</button>
<button
v-if="$root.user.is('ADMIN') || $root.user.is('MODO')"
title="Supprimer le commentaire"
@click="deleteComment()"
>
<img
class="copy-img"
alt="edit"
src="assets/img/deletecomment.png"
/>
</button> </button>
<!--tooltip v-if="!preview" v-bind:value="$t('helper.report_comment')"> <!--tooltip v-if="!preview" v-bind:value="$t('helper.report_comment')">
@ -141,6 +162,13 @@
</div> </div>
</template> </template>
<style scoped>
.copy-img {
width: 1rem;
height: 1rem;
}
</style>
<script> <script>
module.exports = { module.exports = {
props: [ props: [
@ -234,15 +262,7 @@ module.exports = {
}, },
copyToClipBoard(text) { copyToClipBoard(text) {
const getUrl = window.location; const getUrl = window.location;
let baseUrl = let baseUrl = getUrl.protocol + "//" + getUrl.host;
getUrl.protocol +
"//" +
getUrl.host +
"/" +
getUrl.pathname.split("/")[1];
if (baseUrl.endsWith("/")) {
baseUrl = baseUrl.slice(0, -1);
}
navigator.clipboard.writeText(`${baseUrl}${text}`).then( navigator.clipboard.writeText(`${baseUrl}${text}`).then(
function () { function () {
@ -253,6 +273,38 @@ module.exports = {
} }
); );
}, },
deleteComment() {
try {
swal({
title: "Êtes-vous sûr?",
text: "Le commentaire sera supprimé avec toutes ses informations",
icon: "warning",
buttons: ["Annuler", true],
dangerMode: true,
}).then(async (willDelete) => {
if (willDelete) {
// let _ = await axios.delete(
// `${baseUrl}/ws/themes/delete/${this.$route.query.id}`
// );
swal("Succès!", "Le commentaire a été supprimé", "success").then(
(value) => {
// location.href = baseUrl;
}
);
}
});
} catch (error) {
swal("Erreur!", `${error}`, "error");
console.log(error);
}
},
shareComment() {
try {
alert("share comment functionnality");
} catch (error) {
alert(error);
}
},
}, },
beforeDestroy() { beforeDestroy() {
if (this.hideOnScroll) { if (this.hideOnScroll) {

View file

@ -171,11 +171,11 @@
<script> <script>
const getUrl = window.location; const getUrl = window.location;
let baseUrl = // let baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1];
getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1]; // if (baseUrl.endsWith("/")) {
if (baseUrl.endsWith("/")) { // baseUrl = baseUrl.slice(0, -1);
baseUrl = baseUrl.slice(0, -1); // }
} let baseUrl = getUrl.protocol + "//" + getUrl.host
module.exports = { module.exports = {
data() { data() {
return { return {

View file

@ -131,11 +131,11 @@
<script> <script>
const getUrl = window.location; const getUrl = window.location;
let baseUrl = // let baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1];
getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1]; // if (baseUrl.endsWith("/")) {
if (baseUrl.endsWith("/")) { // baseUrl = baseUrl.slice(0, -1);
baseUrl = baseUrl.slice(0, -1); // }
} let baseUrl = getUrl.protocol + "//" + getUrl.host;
module.exports = { module.exports = {
data() { data() {
return { return {
@ -179,7 +179,9 @@ module.exports = {
this.url = ""; this.url = "";
this.selectedDate = new Date(); this.selectedDate = new Date();
swal("Succès!", "L'agenda a été créé", "success"); swal("Succès!", "L'agenda a été créé", "success").then((value) => {
location.href = baseUrl;
});
} catch (error) { } catch (error) {
swal("Erreur!", `${error}`, "error"); swal("Erreur!", `${error}`, "error");
console.error(error); console.error(error);

View file

@ -83,7 +83,7 @@
<img <img
alt="image" alt="image"
class="category-picture" class="category-picture"
v-bind:src="sondage.choices[0].img" src="assets/img/sondage.png"
/> />
</div> </div>
<div> <div>
@ -104,11 +104,11 @@
<script> <script>
const getUrl = window.location; const getUrl = window.location;
let baseUrl = // let baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1];
getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1]; // if (baseUrl.endsWith("/")) {
if (baseUrl.endsWith("/")) { // baseUrl = baseUrl.slice(0, -1);
baseUrl = baseUrl.slice(0, -1); // }
} let baseUrl = getUrl.protocol + "//" + getUrl.host
module.exports = { module.exports = {
data() { data() {
return { return {

View file

@ -3,6 +3,19 @@
<base-layout id="voting"> <base-layout id="voting">
<template v-slot:title> <template v-slot:title>
<h1>Sondage</h1> <h1>Sondage</h1>
<div v-if="loggedUser.is('ADMIN') || loggedUser.is('SUPERADMIN')">
<button
title="Supprimer le sondage"
class="delete-btn space-top"
@click="
() => {
deleteCurrentSondage();
}
"
>
<img alt="edit" src="assets/img/delete.png" />
</button>
</div>
</template> </template>
<div class="theme-container"> <div class="theme-container">
<br /> <br />
@ -128,6 +141,19 @@
max-height: 15em; max-height: 15em;
} }
.delete-btn {
background-color: #dd2034;
padding: 1rem;
border-radius: 0.5rem;
color: white;
border-color: transparent;
box-shadow: 0.1rem 0.1rem 1rem #dd2034;
margin-bottom: 2rem;
cursor: pointer;
width: 50px;
height: 50px;
}
.btn-vote { .btn-vote {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -212,11 +238,11 @@
</style> </style>
<script> <script>
const getUrl = window.location; const getUrl = window.location;
let baseUrl = // let baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1];
getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1]; // if (baseUrl.endsWith("/")) {
if (baseUrl.endsWith("/")) { // baseUrl = baseUrl.slice(0, -1);
baseUrl = baseUrl.slice(0, -1); // }
} let baseUrl = getUrl.protocol + "//" + getUrl.host;
module.exports = { module.exports = {
data() { data() {
return { return {
@ -224,14 +250,40 @@ module.exports = {
theme: false, theme: false,
choices: [], choices: [],
votes: [], votes: [],
loggedUser: false,
}; };
}, },
created() { created() {
this.fetchTheme(); this.fetchTheme();
this.fetchUser(); this.fetchUser();
this.fetchVotes(); this.fetchVotes();
this.getCurrentUser();
}, },
methods: { methods: {
getCurrentUser: function () {
ArenService.Users.getLoged({
onSuccess: (logedUser) => {
this.loggedUser = logedUser;
console.log(logedUser)
ArenService.NotificationListener.listen({
onMessage: (notif) => {
this.user.notifications.push(notif);
let message = this.$t(
"notification." + notif.content.message,
notif.content.details
);
this.$toast(message);
new BrowserNotification("AREN", {
body: message,
});
},
});
},
onError: (e) => {
this.logout();
},
});
},
fetchUser: async function () { fetchUser: async function () {
const _user = await axios.get(`${baseUrl}/ws/users/me`); const _user = await axios.get(`${baseUrl}/ws/users/me`);
this.user = _user.data; this.user = _user.data;
@ -283,6 +335,31 @@ module.exports = {
return arr.length <= 0; return arr.length <= 0;
}, },
deleteCurrentSondage: function () {
try {
swal({
title: "Êtes-vous sûr?",
text: "Le sondage sera supprimé avec toutes ses informations",
icon: "warning",
buttons: ["Annuler", true],
dangerMode: true,
}).then(async (willDelete) => {
if (willDelete) {
let _ = await axios.delete(
`${baseUrl}/ws/themes/delete/${this.$route.query.id}`
);
swal("Succès!", "Le sondage a été supprimé", "success").then(
(value) => {
location.href = baseUrl;
}
);
}
});
} catch (error) {
swal("Erreur!", `${error}`, "error");
console.log(error);
}
},
}, },
}; };
</script> </script>

View file

@ -313,11 +313,11 @@
<script> <script>
const getUrl = window.location; const getUrl = window.location;
let baseUrl = // let baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1];
getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1]; // if (baseUrl.endsWith("/")) {
if (baseUrl.endsWith("/")) { // baseUrl = baseUrl.slice(0, -1);
baseUrl = baseUrl.slice(0, -1); // }
} let baseUrl = getUrl.protocol + "//" + getUrl.host
Vue.component("modal", { Vue.component("modal", {
template: "#modal-template", template: "#modal-template",
}); });