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}`
)
"
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>
<!--tooltip v-if="!preview" v-bind:value="$t('helper.report_comment')">
@ -141,6 +162,13 @@
</div>
</template>
<style scoped>
.copy-img {
width: 1rem;
height: 1rem;
}
</style>
<script>
module.exports = {
props: [
@ -234,15 +262,7 @@ module.exports = {
},
copyToClipBoard(text) {
const getUrl = window.location;
let baseUrl =
getUrl.protocol +
"//" +
getUrl.host +
"/" +
getUrl.pathname.split("/")[1];
if (baseUrl.endsWith("/")) {
baseUrl = baseUrl.slice(0, -1);
}
let baseUrl = getUrl.protocol + "//" + getUrl.host;
navigator.clipboard.writeText(`${baseUrl}${text}`).then(
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() {
if (this.hideOnScroll) {

View File

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

View File

@ -131,11 +131,11 @@
<script>
const getUrl = window.location;
let baseUrl =
getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1];
if (baseUrl.endsWith("/")) {
baseUrl = baseUrl.slice(0, -1);
}
// let baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1];
// if (baseUrl.endsWith("/")) {
// baseUrl = baseUrl.slice(0, -1);
// }
let baseUrl = getUrl.protocol + "//" + getUrl.host;
module.exports = {
data() {
return {
@ -179,7 +179,9 @@ module.exports = {
this.url = "";
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) {
swal("Erreur!", `${error}`, "error");
console.error(error);

View File

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

View File

@ -3,6 +3,19 @@
<base-layout id="voting">
<template v-slot:title>
<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>
<div class="theme-container">
<br />
@ -128,6 +141,19 @@
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 {
display: flex;
justify-content: center;
@ -212,11 +238,11 @@
</style>
<script>
const getUrl = window.location;
let baseUrl =
getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1];
if (baseUrl.endsWith("/")) {
baseUrl = baseUrl.slice(0, -1);
}
// let baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1];
// if (baseUrl.endsWith("/")) {
// baseUrl = baseUrl.slice(0, -1);
// }
let baseUrl = getUrl.protocol + "//" + getUrl.host;
module.exports = {
data() {
return {
@ -224,14 +250,40 @@ module.exports = {
theme: false,
choices: [],
votes: [],
loggedUser: false,
};
},
created() {
this.fetchTheme();
this.fetchUser();
this.fetchVotes();
this.getCurrentUser();
},
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 () {
const _user = await axios.get(`${baseUrl}/ws/users/me`);
this.user = _user.data;
@ -283,6 +335,31 @@ module.exports = {
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>

View File

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