thelounge/client/components/Windows/Changelog.vue

88 lines
2 KiB
Vue
Raw Normal View History

2019-02-18 10:18:32 +01:00
<template>
2019-08-03 21:03:45 +02:00
<div id="changelog" class="window" aria-label="Changelog">
2019-02-18 10:18:32 +01:00
<div class="header">
<SidebarToggle />
2019-02-18 10:18:32 +01:00
</div>
<div class="container">
2019-10-17 18:56:44 +02:00
<router-link id="back-to-help" to="help">« Help</router-link>
2019-02-18 10:18:32 +01:00
2019-08-05 17:37:59 +02:00
<template
v-if="
$store.state.versionData &&
$store.state.versionData.current &&
$store.state.versionData.current.version
"
>
<h1 class="title">
Release notes for {{ $store.state.versionData.current.version }}
</h1>
2019-02-18 10:18:32 +01:00
2019-08-05 17:37:59 +02:00
<template v-if="$store.state.versionData.current.changelog">
2019-02-20 16:09:44 +01:00
<h3>Introduction</h3>
2019-08-05 17:37:59 +02:00
<div
2019-08-07 14:12:36 +02:00
ref="changelog"
2019-08-05 17:37:59 +02:00
class="changelog-text"
v-html="$store.state.versionData.current.changelog"
></div>
2019-02-20 16:09:44 +01:00
</template>
<template v-else>
<p>Unable to retrieve releases from GitHub.</p>
<p>
<a
2019-08-03 21:03:45 +02:00
:href="
2019-08-05 17:37:59 +02:00
`https://github.com/thelounge/thelounge/releases/tag/v${$root.serverConfiguration.version}`
2019-08-03 21:03:45 +02:00
"
2019-02-20 16:09:44 +01:00
target="_blank"
2019-03-01 15:18:16 +01:00
rel="noopener"
2019-08-03 21:03:45 +02:00
>View release notes for this version on GitHub</a
>
2019-02-20 16:09:44 +01:00
</p>
</template>
</template>
<p v-else>Loading changelog</p>
2019-02-18 10:18:32 +01:00
</div>
</div>
</template>
<script>
2019-08-07 13:58:35 +02:00
import socket from "../../js/socket";
import SidebarToggle from "../SidebarToggle.vue";
2019-02-18 10:18:32 +01:00
export default {
name: "Changelog",
components: {
SidebarToggle,
},
2019-08-05 17:37:59 +02:00
mounted() {
if (!this.$store.state.versionData) {
socket.emit("changelog");
}
2019-08-07 14:12:36 +02:00
this.patchChangelog();
},
updated() {
this.patchChangelog();
},
methods: {
patchChangelog() {
2019-10-17 18:56:44 +02:00
if (!this.$refs.changelog) {
return;
}
2019-08-07 14:12:36 +02:00
const links = this.$refs.changelog.querySelectorAll("a");
for (const link of links) {
// Make sure all links will open a new tab instead of exiting the application
link.setAttribute("target", "_blank");
2019-10-20 16:35:42 +02:00
link.setAttribute("rel", "noopener");
2019-08-07 14:12:36 +02:00
if (link.querySelector("img")) {
// Add required metadata to image links, to support built-in image viewer
link.classList.add("toggle-thumbnail");
}
}
},
2019-08-05 17:37:59 +02:00
},
2019-02-18 10:18:32 +01:00
};
</script>