|
@@ -6,42 +6,38 @@
|
|
<h1 id="page-title">Settings</h1>
|
|
<h1 id="page-title">Settings</h1>
|
|
<div id="sidebar-with-content">
|
|
<div id="sidebar-with-content">
|
|
<div class="nav-links">
|
|
<div class="nav-links">
|
|
- <router-link
|
|
|
|
- :class="{ active: activeTab === 'profile' }"
|
|
|
|
- to="#profile"
|
|
|
|
|
|
+ <a
|
|
|
|
+ :class="{ active: tab === 'profile' }"
|
|
|
|
+ @click="showTab('profile')"
|
|
>
|
|
>
|
|
Profile
|
|
Profile
|
|
- </router-link>
|
|
|
|
- <router-link
|
|
|
|
- :class="{ active: activeTab === 'account' }"
|
|
|
|
- to="#account"
|
|
|
|
|
|
+ </a>
|
|
|
|
+ <a
|
|
|
|
+ :class="{ active: tab === 'account' }"
|
|
|
|
+ @click="showTab('account')"
|
|
>
|
|
>
|
|
Account
|
|
Account
|
|
- </router-link>
|
|
|
|
- <router-link
|
|
|
|
- :class="{ active: activeTab === 'security' }"
|
|
|
|
- to="#security"
|
|
|
|
|
|
+ </a>
|
|
|
|
+ <a
|
|
|
|
+ :class="{ active: tab === 'security' }"
|
|
|
|
+ @click="showTab('security')"
|
|
>
|
|
>
|
|
Security
|
|
Security
|
|
- </router-link>
|
|
|
|
- <router-link
|
|
|
|
- :class="{ active: activeTab === 'preferences' }"
|
|
|
|
- to="#preferences"
|
|
|
|
|
|
+ </a>
|
|
|
|
+ <a
|
|
|
|
+ :class="{ active: tab === 'preferences' }"
|
|
|
|
+ @click="showTab('preferences')"
|
|
>
|
|
>
|
|
Preferences
|
|
Preferences
|
|
- </router-link>
|
|
|
|
|
|
+ </a>
|
|
</div>
|
|
</div>
|
|
- <profile-settings
|
|
|
|
- v-if="activeTab === 'profile'"
|
|
|
|
- ></profile-settings>
|
|
|
|
- <account-settings
|
|
|
|
- v-if="activeTab === 'account'"
|
|
|
|
- ></account-settings>
|
|
|
|
|
|
+ <profile-settings v-if="tab === 'profile'"></profile-settings>
|
|
|
|
+ <account-settings v-if="tab === 'account'"></account-settings>
|
|
<security-settings
|
|
<security-settings
|
|
- v-if="activeTab === 'security'"
|
|
|
|
|
|
+ v-if="tab === 'security'"
|
|
></security-settings>
|
|
></security-settings>
|
|
<preferences-settings
|
|
<preferences-settings
|
|
- v-if="activeTab === 'preferences'"
|
|
|
|
|
|
+ v-if="tab === 'preferences'"
|
|
></preferences-settings>
|
|
></preferences-settings>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -53,6 +49,8 @@
|
|
import { mapActions } from "vuex";
|
|
import { mapActions } from "vuex";
|
|
import Toast from "toasters";
|
|
import Toast from "toasters";
|
|
|
|
|
|
|
|
+import TabQueryHandler from "../../mixins/TabQueryHandler.vue";
|
|
|
|
+
|
|
import MainHeader from "../../components/layout/MainHeader.vue";
|
|
import MainHeader from "../../components/layout/MainHeader.vue";
|
|
import MainFooter from "../../components/layout/MainFooter.vue";
|
|
import MainFooter from "../../components/layout/MainFooter.vue";
|
|
|
|
|
|
@@ -72,61 +70,65 @@ export default {
|
|
ProfileSettings,
|
|
ProfileSettings,
|
|
PreferencesSettings
|
|
PreferencesSettings
|
|
},
|
|
},
|
|
|
|
+ mixins: [TabQueryHandler],
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- activeTab: ""
|
|
|
|
|
|
+ tab: "profile"
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- if (this.$route.hash === "") {
|
|
|
|
- this.$router.push("#profile");
|
|
|
|
- } else {
|
|
|
|
- this.activeTab = this.$route.hash.replace("#", "");
|
|
|
|
- this.localNightmode = this.nightmode;
|
|
|
|
-
|
|
|
|
- io.getSocket(socket => {
|
|
|
|
- this.socket = socket;
|
|
|
|
-
|
|
|
|
- this.socket.emit("users.findBySession", res => {
|
|
|
|
- if (res.status === "success") {
|
|
|
|
- this.setUser(res.data);
|
|
|
|
- } else {
|
|
|
|
- new Toast({
|
|
|
|
- content: "You're not currently signed in.",
|
|
|
|
- timeout: 3000
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- this.socket.on("event:user.linkPassword", () =>
|
|
|
|
- this.updateOriginalUser({
|
|
|
|
- property: "password",
|
|
|
|
- value: true
|
|
|
|
- })
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- this.socket.on("event:user.unlinkPassword", () =>
|
|
|
|
- this.updateOriginalUser({
|
|
|
|
- property: "password",
|
|
|
|
- value: false
|
|
|
|
- })
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- this.socket.on("event:user.linkGithub", () =>
|
|
|
|
- this.updateOriginalUser({
|
|
|
|
- property: "github",
|
|
|
|
- value: true
|
|
|
|
- })
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- this.socket.on("event:user.unlinkGithub", () =>
|
|
|
|
- this.updateOriginalUser({
|
|
|
|
- property: "github",
|
|
|
|
- value: false
|
|
|
|
- })
|
|
|
|
- );
|
|
|
|
|
|
+ if (
|
|
|
|
+ this.$route.query.tab === "profile" ||
|
|
|
|
+ this.$route.query.tab === "security" ||
|
|
|
|
+ this.$route.query.tab === "account" ||
|
|
|
|
+ this.$route.query.tab === "preferences"
|
|
|
|
+ )
|
|
|
|
+ this.tab = this.$route.query.tab;
|
|
|
|
+
|
|
|
|
+ this.localNightmode = this.nightmode;
|
|
|
|
+
|
|
|
|
+ io.getSocket(socket => {
|
|
|
|
+ this.socket = socket;
|
|
|
|
+
|
|
|
|
+ this.socket.emit("users.findBySession", res => {
|
|
|
|
+ if (res.status === "success") {
|
|
|
|
+ this.setUser(res.data);
|
|
|
|
+ } else {
|
|
|
|
+ new Toast({
|
|
|
|
+ content: "You're not currently signed in.",
|
|
|
|
+ timeout: 3000
|
|
|
|
+ });
|
|
|
|
+ }
|
|
});
|
|
});
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ this.socket.on("event:user.linkPassword", () =>
|
|
|
|
+ this.updateOriginalUser({
|
|
|
|
+ property: "password",
|
|
|
|
+ value: true
|
|
|
|
+ })
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ this.socket.on("event:user.unlinkPassword", () =>
|
|
|
|
+ this.updateOriginalUser({
|
|
|
|
+ property: "password",
|
|
|
|
+ value: false
|
|
|
|
+ })
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ this.socket.on("event:user.linkGithub", () =>
|
|
|
|
+ this.updateOriginalUser({
|
|
|
|
+ property: "github",
|
|
|
|
+ value: true
|
|
|
|
+ })
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ this.socket.on("event:user.unlinkGithub", () =>
|
|
|
|
+ this.updateOriginalUser({
|
|
|
|
+ property: "github",
|
|
|
|
+ value: false
|
|
|
|
+ })
|
|
|
|
+ );
|
|
|
|
+ });
|
|
},
|
|
},
|
|
methods: mapActions("settings", ["updateOriginalUser", "setUser"])
|
|
methods: mapActions("settings", ["updateOriginalUser", "setUser"])
|
|
};
|
|
};
|
|
@@ -135,12 +137,6 @@ export default {
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
@import "../../styles/global.scss";
|
|
@import "../../styles/global.scss";
|
|
|
|
|
|
-.night-mode {
|
|
|
|
- .content {
|
|
|
|
- background-color: $night-mode-bg-secondary !important;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/deep/ .character-counter {
|
|
/deep/ .character-counter {
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
justify-content: flex-end;
|