Browse Source

fix(use of modals): open/close should be implicit

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan 5 years ago
parent
commit
35a54f0a46

+ 3 - 3
frontend/components/Admin/News.vue

@@ -307,7 +307,7 @@ export default {
 		},
 		editNews: function(news) {
 			this.editing = news;
-			this.toggleModal({ sector: "admin", modal: "editNews" });
+			this.openModal({ sector: "admin", modal: "editNews" });
 		},
 		updateNews: function(close) {
 			let _this = this;
@@ -319,7 +319,7 @@ export default {
 					Toast.methods.addToast(res.message, 4000);
 					if (res.status === "success") {
 						if (close)
-							_this.toggleModal({
+							_this.closeModal({
 								sector: "admin",
 								modal: "editNews"
 							});
@@ -344,7 +344,7 @@ export default {
 		init: function() {
 			this.socket.emit("apis.joinAdminRoom", "news", () => {});
 		},
-		...mapActions("modals", ["toggleModal"])
+		...mapActions("modals", ["openModal", "closeModal"])
 	}
 };
 </script>

+ 2 - 2
frontend/components/Admin/Punishments.vue

@@ -139,7 +139,7 @@ export default {
 	methods: {
 		view: function(punishment) {
 			this.viewPunishment(punishment);
-			this.toggleModal({ sector: "admin", modal: "viewPunishment" });
+			this.openModal({ sector: "admin", modal: "viewPunishment" });
 		},
 		banIP: function() {
 			let _this = this;
@@ -160,7 +160,7 @@ export default {
 			});
 			//_this.socket.emit('apis.joinAdminRoom', 'punishments', () => {});
 		},
-		...mapActions("modals", ["toggleModal"]),
+		...mapActions("modals", ["openModal"]),
 		...mapActions("admin/punishments", ["viewPunishment"])
 	},
 	mounted: function() {

+ 2 - 2
frontend/components/Admin/QueueSongs.vue

@@ -150,7 +150,7 @@ export default {
 			for (let n in song) newSong[n] = song[n];
 
 			this.editSong({ index, song: newSong, type: "queueSongs" });
-			this.toggleModal({ sector: "admin", modal: "editSong" });
+			this.openModal({ sector: "admin", modal: "editSong" });
 		},
 		add: function(song) {
 			this.socket.emit("songs.add", song, res => {
@@ -176,7 +176,7 @@ export default {
 			_this.socket.emit("apis.joinAdminRoom", "queue", () => {});
 		},
 		...mapActions("admin/songs", ["stopVideo", "editSong"]),
-		...mapActions("modals", ["toggleModal"])
+		...mapActions("modals", ["openModal"])
 	},
 	mounted: function() {
 		let _this = this;

+ 2 - 2
frontend/components/Admin/Stations.vue

@@ -260,7 +260,7 @@ export default {
 				genres: station.genres,
 				blacklistedGenres: station.blacklistedGenres
 			});
-			this.toggleModal({
+			this.openModal({
 				sector: "station",
 				modal: "editStation"
 			});
@@ -303,7 +303,7 @@ export default {
 			});
 			_this.socket.emit("apis.joinAdminRoom", "stations", () => {});
 		},
-		...mapActions("modals", ["toggleModal"]),
+		...mapActions("modals", ["openModal"]),
 		...mapActions("admin/stations", ["editStation"])
 	},
 	mounted: function() {

+ 2 - 2
frontend/components/Admin/Users.vue

@@ -83,7 +83,7 @@ export default {
 	methods: {
 		edit: function(user) {
 			this.editUser(user);
-			this.toggleModal({ sector: "admin", modal: "editUser" });
+			this.openModal({ sector: "admin", modal: "editUser" });
 		},
 		init: function() {
 			let _this = this;
@@ -96,7 +96,7 @@ export default {
 			});
 		},
 		...mapActions("admin/users", ["editUser"]),
-		...mapActions("modals", ["toggleModal"])
+		...mapActions("modals", ["openModal"])
 	},
 	mounted: function() {
 		let _this = this;

+ 3 - 3
frontend/components/MainHeader.vue

@@ -52,7 +52,7 @@
 					class="nav-item"
 					href="#"
 					@click="
-						toggleModal({
+						openModal({
 							sector: 'header',
 							modal: 'login'
 						})
@@ -63,7 +63,7 @@
 					class="nav-item"
 					href="#"
 					@click="
-						toggleModal({
+						openModal({
 							sector: 'header',
 							modal: 'register'
 						})
@@ -97,7 +97,7 @@ export default {
 		modals: state => state.modals.header
 	}),
 	methods: {
-		...mapActions("modals", ["toggleModal"])
+		...mapActions("modals", ["openModal"])
 	}
 };
 </script>

+ 2 - 2
frontend/components/Modals/EditSong.vue

@@ -273,7 +273,7 @@
 				<button
 					class="button is-danger"
 					v-on:click="
-						toggleModal({ sector: 'admin', modal: 'editSong' })
+						closeModal({ sector: 'admin', modal: 'editSong' })
 					"
 				>
 					<span>&nbsp;Close</span>
@@ -581,7 +581,7 @@ export default {
 			"getCurrentTime",
 			"editSong"
 		]),
-		...mapActions("modals", ["toggleModal", "closeCurrentModal"])
+		...mapActions("modals", ["closeModal", "closeCurrentModal"])
 	},
 	mounted: function() {
 		let _this = this;

+ 1 - 1
frontend/components/Modals/IssuesModal.vue

@@ -89,7 +89,7 @@ export default {
 		}
 	},
 	methods: {
-		...mapActions("modals", ["toggleModal", "closeModal"])
+		...mapActions("modals", ["closeModal"])
 	},
 	components: { Modal }
 };

+ 2 - 2
frontend/components/Modals/Login.vue

@@ -85,13 +85,13 @@ export default {
 				.catch(err => Toast.methods.addToast(err.message, 5000));
 		},
 		resetPassword: function() {
-			this.toggleModal({ sector: "header", modal: "login" });
+			this.closeModal({ sector: "header", modal: "login" });
 			this.$router.go("/reset_password");
 		},
 		githubRedirect: function() {
 			localStorage.setItem("github_redirect", this.$route.path);
 		},
-		...mapActions("modals", ["toggleModal", "closeCurrentModal"]),
+		...mapActions("modals", ["closeModal", "closeCurrentModal"]),
 		...mapActions("user/auth", ["login"])
 	}
 };

+ 3 - 3
frontend/components/Modals/Playlists/Create.vue

@@ -64,19 +64,19 @@ export default {
 				Toast.methods.addToast(res.message, 3000);
 
 				if (res.status === "success") {
-					this.toggleModal({
+					this.closeModal({
 						sector: "station",
 						modal: "createPlaylist"
 					});
 					this.editPlaylist(res.data._id);
-					this.toggleModal({
+					this.openModal({
 						sector: "station",
 						modal: "editPlaylist"
 					});
 				}
 			});
 		},
-		...mapActions("modals", ["toggleModal"]),
+		...mapActions("modals", ["closeModal", "openModal"]),
 		...mapActions("user/playlists", ["editPlaylist"])
 	}
 };

+ 1 - 1
frontend/components/Modals/Register.vue

@@ -125,7 +125,7 @@ export default {
 		githubRedirect: function() {
 			localStorage.setItem("github_redirect", this.$route.path);
 		},
-		...mapActions("modals", ["toggleModal", "closeCurrentModal"]),
+		...mapActions("modals", ["closeCurrentModal"]),
 		...mapActions("user/auth", ["register"])
 	}
 };

+ 3 - 3
frontend/components/Sidebars/Playlist.vue

@@ -37,7 +37,7 @@
 				class="button create-playlist"
 				href="#"
 				@click="
-					toggleModal({ sector: 'station', modal: 'createPlaylist' })
+					openModal({ sector: 'station', modal: 'createPlaylist' })
 				"
 				>Create Playlist</a
 			>
@@ -60,7 +60,7 @@ export default {
 	methods: {
 		edit: function(id) {
 			this.editPlaylist(id);
-			this.toggleModal({ sector: "station", modal: "editPlaylist" });
+			this.openModal({ sector: "station", modal: "editPlaylist" });
 		},
 		selectPlaylist: function(id) {
 			this.socket.emit(
@@ -84,7 +84,7 @@ export default {
 				return false;
 			return true;
 		},
-		...mapActions("modals", ["toggleModal"]),
+		...mapActions("modals", ["openModal"]),
 		...mapActions("user/playlists", ["editPlaylist"])
 	},
 	mounted: function() {

+ 2 - 2
frontend/components/Sidebars/SongsList.vue

@@ -93,7 +93,7 @@
 					"
 					class="button add-to-queue"
 					@click="
-						toggleModal({
+						openModal({
 							sector: 'station',
 							modal: 'addSongToQueue'
 						})
@@ -169,7 +169,7 @@ export default {
 				}
 			);
 		},
-		...mapActions("modals", ["toggleModal"])
+		...mapActions("modals", ["openModal"])
 	},
 	mounted: function() {
 		/*let _this = this;

+ 5 - 7
frontend/components/Station/CommunityHeader.vue

@@ -53,16 +53,14 @@
 					<a
 						class="nav-item"
 						href="#"
-						@click="
-							toggleModal({ sector: 'header', modal: 'login' })
-						"
+						@click="openModal({ sector: 'header', modal: 'login' })"
 						>Login</a
 					>
 					<a
 						class="nav-item"
 						href="#"
 						@click="
-							toggleModal({ sector: 'header', modal: 'register' })
+							openModal({ sector: 'header', modal: 'register' })
 						"
 						>Register</a
 					>
@@ -142,7 +140,7 @@
 						class="sidebar-item"
 						href="#"
 						@click="
-							toggleModal({
+							openModal({
 								sector: 'station',
 								modal: 'addSongToPlaylist'
 							})
@@ -234,12 +232,12 @@ export default {
 				privacy: this.$parent.station.privacy,
 				displayName: this.$parent.station.displayName
 			});
-			this.toggleModal({
+			this.openModal({
 				sector: "station",
 				modal: "editStation"
 			});
 		},
-		...mapActions("modals", ["toggleModal"]),
+		...mapActions("modals", ["openModal"]),
 		...mapActions("station", ["editStation"])
 	}
 };

+ 7 - 9
frontend/components/Station/OfficialHeader.vue

@@ -47,16 +47,14 @@
 					<a
 						class="nav-item"
 						href="#"
-						@click="
-							toggleModal({ sector: 'header', modal: 'login' })
-						"
+						@click="openModal({ sector: 'header', modal: 'login' })"
 						>Login</a
 					>
 					<a
 						class="nav-item"
 						href="#"
 						@click="
-							toggleModal({ sector: 'header', modal: 'register' })
+							openModal({ sector: 'header', modal: 'register' })
 						"
 						>Register</a
 					>
@@ -121,7 +119,7 @@
 						class="sidebar-item"
 						href="#"
 						@click="
-							toggleModal({
+							openModal({
 								sector: 'station',
 								modal: 'addSongToQueue'
 							})
@@ -159,7 +157,7 @@
 						class="sidebar-item"
 						href="#"
 						@click="
-							toggleModal({
+							openModal({
 								sector: 'station',
 								modal: 'report'
 							})
@@ -175,7 +173,7 @@
 						class="sidebar-item"
 						href="#"
 						@click="
-							toggleModal({
+							openModal({
 								sector: 'station',
 								modal: 'addSongToPlaylist'
 							})
@@ -254,12 +252,12 @@ export default {
 				privacy: this.$parent.station.privacy,
 				displayName: this.$parent.station.displayName
 			});
-			this.toggleModal({
+			this.openModal({
 				sector: "station",
 				modal: "editStation"
 			});
 		},
-		...mapActions("modals", ["toggleModal"]),
+		...mapActions("modals", ["openModal"]),
 		...mapActions("station", ["editStation"])
 	}
 };

+ 3 - 3
frontend/components/Station/Station.vue

@@ -38,7 +38,7 @@
 						href="#"
 						class="no-song"
 						@click="
-							toggleModal({
+							openModal({
 								sector: 'station',
 								modal: 'addSongToQueue'
 							})
@@ -176,7 +176,7 @@
 						class="button add-to-queue"
 						href="#"
 						@click="
-							toggleModal({
+							openModal({
 								sector: 'station',
 								modal: 'addSongToQueue'
 							})
@@ -1023,7 +1023,7 @@ export default {
 				}
 			});
 		},
-		...mapActions("modals", ["toggleModal"]),
+		...mapActions("modals", ["openModal"]),
 		...mapActions("station", ["joinStation"])
 	},
 	mounted: function() {

+ 2 - 2
frontend/components/pages/Home.vue

@@ -64,7 +64,7 @@
 							v-if="$parent.loggedIn"
 							href="#"
 							@click="
-								toggleModal({
+								openModal({
 									sector: 'home',
 									modal: 'createCommunityStation'
 								})
@@ -284,7 +284,7 @@ export default {
 				station.privacy === "public"
 			);
 		},
-		...mapActions("modals", ["toggleModal"])
+		...mapActions("modals", ["openModal"])
 	},
 	components: {
 		MainHeader,