Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
francescolf committed Oct 28, 2023
2 parents 88c7dd7 + 2417468 commit 95aae9e
Show file tree
Hide file tree
Showing 31 changed files with 624 additions and 427 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
src/assets/*
src/assets/*
public/js/*
4 changes: 3 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"trailingComma": "none"
}
3 changes: 1 addition & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down Expand Up @@ -42,7 +42,6 @@
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
<script src="/js/jquery.min.js"></script>
<script src="/js/darkmode.min.js"></script>
<script src="/js/bootstrap.bundle.min.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion public/404.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
6 changes: 3 additions & 3 deletions public/js/bootstrap.bundle.min.js

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions public/js/darkmode.min.js

This file was deleted.

14 changes: 7 additions & 7 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ const { loggedIn } = storeToRefs(store);
<header>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap-nightshade.min.css"
/>
</header>

<nav
id="navbar"
class="navbar navbar-expand-md navbar-dark bg-dark sticky-top"
>
<RouterLink to="/" class="navbar-title">
<a class="navbar-brand ms-3">PoliFemo Dashboard</a>
<img
class="mb-1 ms-2 small-logo"
src="https://polinetwork.org/img/polinetwork.png"
/>
<a class="navbar-brand ms-2">PoliFemo Dashboard</a>
</RouterLink>
<button
class="navbar-toggler"
Expand Down Expand Up @@ -155,8 +155,8 @@ export default {
hasPermission: function (permission) {
const store = usePolifemoStore();
return store.perms.includes(permission);
},
},
}
}
};
</script>

Expand Down
12 changes: 0 additions & 12 deletions src/assets/styles/bootstrap-nightshade.min.css

This file was deleted.

6 changes: 6 additions & 0 deletions src/assets/styles/bootstrap.min.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/assets/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,13 @@
.dotted-underline {
border-bottom: 2px dotted;
display: inline;
}

.small-logo {
height: 40px;
}

.tooltip-inner {
max-width: 250px!important;
width: 250px!important;;
}
54 changes: 37 additions & 17 deletions src/components/ArticleListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,36 @@ import {
faCalendar,
faLocationDot,
faTrashCan,
faEye,
faEye
} from "@fortawesome/free-solid-svg-icons";
import { library } from "@fortawesome/fontawesome-svg-core";
import axios from "axios";
import { API_BASE_URL } from "@/plugins/AuthUtils";
defineProps({
id: {
type: Number,
required: true,
required: true
},
targettime: {
type: String,
required: false,
required: false
},
location: {
type: Boolean,
required: false,
required: false
},
content: {
type: Object,
required: true,
required: true
},
buttons: {
type: String,
required: true
},
formoccurrence: {
type: Number,
required: true
}
});
library.add(faCalendar, faLocationDot, faTrashCan, faEye);
Expand All @@ -40,8 +48,8 @@ library.add(faCalendar, faLocationDot, faTrashCan, faEye);
<i class="fas fa-location-dot" v-if="location"></i>
{{ content.it.title || content.en.title }}
</h5>
<div class="col text-truncate" v-if="content.it.subtitle || content.en.subtitle">
{{ content.it.subtitle || content.en.subtitle }}
<div class="col text-truncate" v-if="content.it.subtitle">
{{ content.it.subtitle }}
</div>
<div class="col text-truncate" v-else>Nessun sottotitolo</div>
</div>
Expand All @@ -51,6 +59,7 @@ library.add(faCalendar, faLocationDot, faTrashCan, faEye);
type="button"
id="btn-preview"
v-on:click="preview"
v-if="displayedButtons.includes('preview')"
class="btn no-border btn-info rounded-start h-100 btn-list-item-action"
>
<i class="fas fa-eye"></i>
Expand All @@ -59,38 +68,40 @@ library.add(faCalendar, faLocationDot, faTrashCan, faEye);
type="button"
v-on:click="remove"
id="btn-delete"
v-if="displayedButtons.includes('delete')"
class="btn no-border btn-danger rounded-end h-100 btn-list-item-action"
>
<i class="fas fa-trash-can"></i>
</button>
</div>
</div>
</div>
<div :id="'preview-box-' + id" class="mt-2 border rounded d-none"></div>
<div :id="'preview-box-' + id + '-' + formoccurrence" class="mt-2 border rounded d-none"></div>
</div>
</template>

<script>
import Cherry from 'cherry-markdown/dist/cherry-markdown.core';
import Cherry from "cherry-markdown/dist/cherry-markdown.core";
export default {
data() {
return {
cherryEditor: null,
previewBox: null
previewBox: null,
displayedButtons: this.buttons.split(",") || []
};
},
mounted() {
this.previewBox = this.$el.querySelector("#preview-box-" + this.id);
this.previewBox = this.$el.querySelector("#preview-box-" + this.id + "-" + this.formoccurrence);
},
methods: {
preview() {
if (this.cherryEditor && $(this.previewbox).hasClass("d-none")) {
$(previewbox).removeClass("d-none");
if (this.cherryEditor && $(this.previewBox).hasClass("d-none")) {
$(this.previewBox).removeClass("d-none");
} else if (this.cherryEditor && !$(this.previewBox).hasClass("d-none")) {
$(this.previewBox).addClass("d-none");
} else {
this.cherryEditor = new Cherry({
id: "preview-box-" + this.id, // Need this trick to avoid a bug always creating the editor in the first element of the list
id: "preview-box-" + this.id + "-" + this.formoccurrence, // Need this trick to avoid a bug always creating the editor in the first element of the list
value: this.content.it.content || this.content.en.content,
locale: "en_US",
editor: {
Expand All @@ -114,8 +125,8 @@ export default {
headers: {
"Content-Type": "application/json",
Authorization:
"Bearer " + localStorage.getItem("polifemo_access_token"),
},
"Bearer " + localStorage.getItem("polifemo_access_token")
}
})
.then(() => {
this.emitter.emit("article-deleted", this.id);
Expand All @@ -136,8 +147,17 @@ export default {
btn.classList.add("pending");
btn.classList.remove("btn-list-item-action");
btn.innerHTML = "Sicuro?";
setTimeout(() => {
this.stopPendingDeletion();
}, 5000);
}
},
},
stopPendingDeletion() {
var btn = this.$el.querySelector("#btn-delete");
btn.classList.remove("pending");
btn.classList.add("btn-list-item-action");
btn.innerHTML = '<i class="fas fa-trash-can"></i>';
}
}
};
</script>
Loading

0 comments on commit 95aae9e

Please sign in to comment.