mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 05:50:22 +00:00
Fix network editing in vue and use absolute urls in router links.
This commit is contained in:
parent
2049a16d64
commit
8fa42c5c48
6 changed files with 37 additions and 8 deletions
|
@ -4,7 +4,7 @@
|
|||
<SidebarToggle />
|
||||
</div>
|
||||
<div class="container">
|
||||
<router-link id="back-to-help" to="help">« Help</router-link>
|
||||
<router-link id="back-to-help" to="/help">« Help</router-link>
|
||||
|
||||
<template
|
||||
v-if="
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<small class="pull-right">
|
||||
v{{ $root.serverConfiguration.version }} (<router-link
|
||||
id="view-changelog"
|
||||
to="changelog"
|
||||
to="/changelog"
|
||||
>release notes</router-link
|
||||
>)
|
||||
</small>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<NetworkForm
|
||||
v-if="$store.state.currentNetworkConfig"
|
||||
v-if="networkData"
|
||||
:handle-submit="handleSubmit"
|
||||
:defaults="$store.state.currentNetworkConfig"
|
||||
:defaults="networkData"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</template>
|
||||
|
@ -21,9 +21,21 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
disabled: false,
|
||||
networkData: null,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
"$route.params.uuid"() {
|
||||
this.setNetworkData();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.setNetworkData();
|
||||
},
|
||||
methods: {
|
||||
setNetworkData() {
|
||||
this.networkData = this.$root.findNetwork(this.$route.params.uuid);
|
||||
},
|
||||
handleSubmit(data) {
|
||||
this.disabled = true;
|
||||
socket.emit("network:edit", data);
|
||||
|
@ -32,7 +44,6 @@ export default {
|
|||
// TODO: move networks to vuex and update state when the network info comes in
|
||||
const network = this.$root.networks.find((n) => n.uuid === data.uuid);
|
||||
network.name = network.channels[0].name = data.name;
|
||||
|
||||
sidebar.find(`.network[data-uuid="${data.uuid}"] .chan.lobby .name`).click();
|
||||
},
|
||||
},
|
||||
|
|
|
@ -290,8 +290,8 @@ function addFocusItem() {
|
|||
}
|
||||
|
||||
function addEditNetworkItem() {
|
||||
function edit(itemData) {
|
||||
socket.emit("network:get", itemData);
|
||||
function edit(networkUuid) {
|
||||
vueApp.$router.push("/edit-network/" + networkUuid);
|
||||
}
|
||||
|
||||
addContextMenuItem({
|
||||
|
|
|
@ -9,6 +9,7 @@ const Connect = require("../components/Windows/Connect.vue").default;
|
|||
const Settings = require("../components/Windows/Settings.vue").default;
|
||||
const Help = require("../components/Windows/Help.vue").default;
|
||||
const Changelog = require("../components/Windows/Changelog.vue").default;
|
||||
const NetworkEdit = require("../components/Windows/NetworkEdit.vue").default;
|
||||
const RoutedChat = require("../components/RoutedChat.vue").default;
|
||||
|
||||
const router = new VueRouter({
|
||||
|
@ -53,6 +54,14 @@ const router = new VueRouter({
|
|||
windowName: "Changelog",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/edit-network/:uuid",
|
||||
component: NetworkEdit,
|
||||
meta: {
|
||||
isChat: false,
|
||||
windowName: "NetworkEdit",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/chan-*",
|
||||
component: RoutedChat,
|
||||
|
|
|
@ -102,12 +102,21 @@ const vueApp = new Vue({
|
|||
|
||||
return null;
|
||||
},
|
||||
findNetwork(uuid) {
|
||||
for (const network of this.networks) {
|
||||
if (network.uuid === uuid) {
|
||||
return network;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
switchToChannel(channel) {
|
||||
if (this.activeChannel && this.activeChannel.channel.id === channel.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.$router.push("chan-" + channel.id);
|
||||
this.$router.push("/chan-" + channel.id);
|
||||
},
|
||||
switchOutOfChannel(channel) {
|
||||
// When switching out of a channel, mark everything as read
|
||||
|
|
Loading…
Reference in a new issue