Implement changelog in Vue.

This commit is contained in:
Richard Lewis 2019-08-05 18:37:59 +03:00 committed by Pavel Djundik
parent 055ba5caff
commit ef500f12a1
3 changed files with 25 additions and 10 deletions

View File

@ -4,21 +4,32 @@
<SidebarToggle /> <SidebarToggle />
</div> </div>
<div class="container"> <div class="container">
<a id="back-to-help" href="#" data-target="Help">« Help</a> <a id="back-to-help" href="#" data-target="#help" data-component="Help">« Help</a>
<template v-if="version"> <template
<h1 class="title">Release notes for {{ version }}</h1> 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>
<template v-if="changelog"> <template v-if="$store.state.versionData.current.changelog">
<h3>Introduction</h3> <h3>Introduction</h3>
<div class="changelog-text">{{ changelog }}</div> <div
class="changelog-text"
v-html="$store.state.versionData.current.changelog"
></div>
</template> </template>
<template v-else> <template v-else>
<p>Unable to retrieve releases from GitHub.</p> <p>Unable to retrieve releases from GitHub.</p>
<p> <p>
<a <a
:href=" :href="
`https://github.com/thelounge/thelounge/releases/tag/v${version}` `https://github.com/thelounge/thelounge/releases/tag/v${$root.serverConfiguration.version}`
" "
target="_blank" target="_blank"
rel="noopener" rel="noopener"
@ -40,6 +51,10 @@ export default {
components: { components: {
SidebarToggle, SidebarToggle,
}, },
mounted() {}, mounted() {
if (!this.$store.state.versionData) {
socket.emit("changelog");
}
},
}; };
</script> </script>

View File

@ -11,7 +11,8 @@
v{{ $root.serverConfiguration.version }} (<a v{{ $root.serverConfiguration.version }} (<a
id="view-changelog" id="view-changelog"
href="#" href="#"
data-target="Changelog" data-target="#changelog"
data-component="Changelog"
>release notes</a >release notes</a
>) >)
</small> </small>

View File

@ -171,8 +171,7 @@ window.vueMounted = () => {
}; };
sidebar.on("click", ".chan, button", openWindow); sidebar.on("click", ".chan, button", openWindow);
$("#help").on("click", "#view-changelog, #back-to-help", openWindow); $("#windows").on("click", "#view-changelog, #back-to-help", openWindow);
$("#changelog").on("click", "#back-to-help", openWindow);
$(document).on("visibilitychange focus click", () => { $(document).on("visibilitychange focus click", () => {
utils.synchronizeNotifiedState(); utils.synchronizeNotifiedState();