From 62465342cbda1dfd51dff68fe8e1b4f9d2fcffb4 Mon Sep 17 00:00:00 2001
From: Bat <baptiste@gelez.xyz>
Date: Fri, 30 Mar 2018 22:58:16 +0100
Subject: [PATCH] Page title binding

Fix #1
---
 front/src/components/About.vue                      | 2 +-
 front/src/components/Home.vue                       | 8 +++-----
 front/src/components/PageNotFound.vue               | 2 +-
 front/src/components/auth/Login.vue                 | 2 +-
 front/src/components/auth/Logout.vue                | 2 +-
 front/src/components/auth/Profile.vue               | 2 +-
 front/src/components/auth/Settings.vue              | 2 +-
 front/src/components/auth/Signup.vue                | 2 +-
 front/src/components/favorites/List.vue             | 2 +-
 front/src/components/library/Album.vue              | 4 ++--
 front/src/components/library/Artist.vue             | 4 ++--
 front/src/components/library/Artists.vue            | 2 +-
 front/src/components/library/Home.vue               | 2 +-
 front/src/components/library/Radios.vue             | 2 +-
 front/src/components/library/Track.vue              | 4 ++--
 front/src/components/library/import/BatchDetail.vue | 2 +-
 front/src/components/library/import/BatchList.vue   | 2 +-
 front/src/components/library/import/Main.vue        | 2 +-
 front/src/components/library/radios/Builder.vue     | 2 +-
 front/src/components/requests/RequestsList.vue      | 2 +-
 front/src/main.js                                   | 4 ++++
 front/src/views/instance/Timeline.vue               | 2 +-
 front/src/views/playlists/Detail.vue                | 4 ++--
 front/src/views/playlists/List.vue                  | 2 +-
 24 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/front/src/components/About.vue b/front/src/components/About.vue
index 92bafd7af..09a5ee24c 100644
--- a/front/src/components/About.vue
+++ b/front/src/components/About.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="main pusher">
+  <div class="main pusher" v-title="'About This Instance'">
     <div class="ui vertical center aligned stripe segment">
       <div class="ui text container">
         <h1 class="ui huge header">
diff --git a/front/src/components/Home.vue b/front/src/components/Home.vue
index ad1ad93cb..0e24dcd59 100644
--- a/front/src/components/Home.vue
+++ b/front/src/components/Home.vue
@@ -1,9 +1,9 @@
 <template>
-  <div class="main pusher">
+  <div class="main pusher" v-title="'Welcome'">
     <div class="ui vertical center aligned stripe segment">
       <div class="ui text container">
         <h1 class="ui huge header">
-            Welcome on funkwhale
+            Welcome on Funkwhale
         </h1>
         <p>We think listening music should be simple.</p>
         <router-link class="ui icon button" to="/about">
@@ -143,9 +143,7 @@
 export default {
   name: 'home',
   data () {
-    return {
-      msg: 'Welcome to Your Vue.js App'
-    }
+    return {}
   }
 }
 </script>
diff --git a/front/src/components/PageNotFound.vue b/front/src/components/PageNotFound.vue
index 3b88a6921..25e6f86fd 100644
--- a/front/src/components/PageNotFound.vue
+++ b/front/src/components/PageNotFound.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="main pusher">
+  <div class="main pusher" v-title="'Page Not Found'">
     <div class="ui vertical stripe segment">
       <div class="ui text container">
         <h1 class="ui huge header">
diff --git a/front/src/components/auth/Login.vue b/front/src/components/auth/Login.vue
index 2cf6d5f6d..d232da2a3 100644
--- a/front/src/components/auth/Login.vue
+++ b/front/src/components/auth/Login.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="main pusher">
+  <div class="main pusher" v-title="'Log In'">
     <div class="ui vertical stripe segment">
       <div class="ui small text container">
         <h2>Log in to your Funkwhale account</h2>
diff --git a/front/src/components/auth/Logout.vue b/front/src/components/auth/Logout.vue
index fbacca703..980740c94 100644
--- a/front/src/components/auth/Logout.vue
+++ b/front/src/components/auth/Logout.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="main pusher">
+  <div class="main pusher" v-title="'Log Out'">
     <div class="ui vertical stripe segment">
       <div class="ui small text container">
         <h2>Are you sure you want to log out?</h2>
diff --git a/front/src/components/auth/Profile.vue b/front/src/components/auth/Profile.vue
index 54af5a11c..9fafccffa 100644
--- a/front/src/components/auth/Profile.vue
+++ b/front/src/components/auth/Profile.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="main pusher">
+  <div class="main pusher" v-title="username + '\'s Profile'">
     <div v-if="isLoading" class="ui vertical segment">
       <div :class="['ui', 'centered', 'active', 'inline', 'loader']"></div>
     </div>
diff --git a/front/src/components/auth/Settings.vue b/front/src/components/auth/Settings.vue
index 8cd03d755..859c0d04b 100644
--- a/front/src/components/auth/Settings.vue
+++ b/front/src/components/auth/Settings.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="main pusher">
+  <div class="main pusher" v-title="'Account Settings'">
     <div class="ui vertical stripe segment">
       <div class="ui small text container">
         <h2 class="ui header">Account settings</h2>
diff --git a/front/src/components/auth/Signup.vue b/front/src/components/auth/Signup.vue
index 749d2eb02..39ca36663 100644
--- a/front/src/components/auth/Signup.vue
+++ b/front/src/components/auth/Signup.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="main pusher">
+  <div class="main pusher" v-title="'Sign Up'">
     <div class="ui vertical stripe segment">
       <div class="ui small text container">
         <h2>Create a funkwhale account</h2>
diff --git a/front/src/components/favorites/List.vue b/front/src/components/favorites/List.vue
index c65144a93..dbef186b6 100644
--- a/front/src/components/favorites/List.vue
+++ b/front/src/components/favorites/List.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="main pusher">
+  <div class="main pusher" v-title="'Your Favorites'">
     <div class="ui vertical center aligned stripe segment">
       <div :class="['ui', {'active': isLoading}, 'inverted', 'dimmer']">
         <div class="ui text loader">Loading your favorites...</div>
diff --git a/front/src/components/library/Album.vue b/front/src/components/library/Album.vue
index 65768aafe..1e96757c3 100644
--- a/front/src/components/library/Album.vue
+++ b/front/src/components/library/Album.vue
@@ -1,10 +1,10 @@
 <template>
   <div>
-    <div v-if="isLoading" class="ui vertical segment">
+    <div v-if="isLoading" class="ui vertical segment" v-title="'Album'">
       <div :class="['ui', 'centered', 'active', 'inline', 'loader']"></div>
     </div>
     <template v-if="album">
-      <div :class="['ui', 'head', {'with-background': album.cover}, 'vertical', 'center', 'aligned', 'stripe', 'segment']" :style="headerStyle">
+      <div :class="['ui', 'head', {'with-background': album.cover}, 'vertical', 'center', 'aligned', 'stripe', 'segment']" :style="headerStyle" v-title="album.title">
         <div class="segment-content">
           <h2 class="ui center aligned icon header">
             <i class="circular inverted sound yellow icon"></i>
diff --git a/front/src/components/library/Artist.vue b/front/src/components/library/Artist.vue
index 9a546aa0e..07d8cbbc7 100644
--- a/front/src/components/library/Artist.vue
+++ b/front/src/components/library/Artist.vue
@@ -1,10 +1,10 @@
 <template>
   <div>
-    <div v-if="isLoading" class="ui vertical segment">
+    <div v-if="isLoading" class="ui vertical segment" v-title="'Artist'">
       <div :class="['ui', 'centered', 'active', 'inline', 'loader']"></div>
     </div>
     <template v-if="artist">
-      <div :class="['ui', 'head', {'with-background': cover}, 'vertical', 'center', 'aligned', 'stripe', 'segment']" :style="headerStyle">
+      <div :class="['ui', 'head', {'with-background': cover}, 'vertical', 'center', 'aligned', 'stripe', 'segment']" :style="headerStyle" v-title="artist.name">
         <div class="segment-content">
           <h2 class="ui center aligned icon header">
             <i class="circular inverted users violet icon"></i>
diff --git a/front/src/components/library/Artists.vue b/front/src/components/library/Artists.vue
index 52ccbdd74..72ad108f1 100644
--- a/front/src/components/library/Artists.vue
+++ b/front/src/components/library/Artists.vue
@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div v-title="'Artists'">
     <div class="ui vertical stripe segment">
       <h2 class="ui header">Browsing artists</h2>
       <div :class="['ui', {'loading': isLoading}, 'form']">
diff --git a/front/src/components/library/Home.vue b/front/src/components/library/Home.vue
index 40f6808f9..26352d1fd 100644
--- a/front/src/components/library/Home.vue
+++ b/front/src/components/library/Home.vue
@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div v-title="'Home'">
     <div class="ui vertical stripe segment">
       <search :autofocus="true"></search>
     </div>
diff --git a/front/src/components/library/Radios.vue b/front/src/components/library/Radios.vue
index 303ce100e..7ab14ab14 100644
--- a/front/src/components/library/Radios.vue
+++ b/front/src/components/library/Radios.vue
@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div v-title="'Radios'">
     <div class="ui vertical stripe segment">
       <h2 class="ui header">Browsing radios</h2>
       <router-link class="ui green basic button" to="/library/radios/build" exact>Create your own radio</router-link>
diff --git a/front/src/components/library/Track.vue b/front/src/components/library/Track.vue
index 0437ac881..e614635c9 100644
--- a/front/src/components/library/Track.vue
+++ b/front/src/components/library/Track.vue
@@ -1,10 +1,10 @@
 <template>
   <div>
-    <div v-if="isLoadingTrack" class="ui vertical segment">
+    <div v-if="isLoadingTrack" class="ui vertical segment" v-title="'Track'">
       <div :class="['ui', 'centered', 'active', 'inline', 'loader']"></div>
     </div>
     <template v-if="track">
-      <div :class="['ui', 'head', {'with-background': cover}, 'vertical', 'center', 'aligned', 'stripe', 'segment']" :style="headerStyle">
+      <div :class="['ui', 'head', {'with-background': cover}, 'vertical', 'center', 'aligned', 'stripe', 'segment']" :style="headerStyle" v-title="track.title">
         <div class="segment-content">
           <h2 class="ui center aligned icon header">
             <i class="circular inverted music orange icon"></i>
diff --git a/front/src/components/library/import/BatchDetail.vue b/front/src/components/library/import/BatchDetail.vue
index 0864d2464..362a5acd1 100644
--- a/front/src/components/library/import/BatchDetail.vue
+++ b/front/src/components/library/import/BatchDetail.vue
@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div v-title="'Import Batch #' + id">
     <div v-if="isLoading && !batch" class="ui vertical segment">
       <div :class="['ui', 'centered', 'active', 'inline', 'loader']"></div>
     </div>
diff --git a/front/src/components/library/import/BatchList.vue b/front/src/components/library/import/BatchList.vue
index de4fef554..857fef045 100644
--- a/front/src/components/library/import/BatchList.vue
+++ b/front/src/components/library/import/BatchList.vue
@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div v-title="'Import Batches'">
     <div class="ui vertical stripe segment">
       <div v-if="isLoading" :class="['ui', 'centered', 'active', 'inline', 'loader']"></div>
       <button
diff --git a/front/src/components/library/import/Main.vue b/front/src/components/library/import/Main.vue
index 66e16b71f..e2b6e4849 100644
--- a/front/src/components/library/import/Main.vue
+++ b/front/src/components/library/import/Main.vue
@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div v-title="'Import Music'">
     <div class="ui vertical stripe segment">
       <div class="ui top three attached ordered steps">
         <a @click="currentStep = 0" :class="['step', {'active': currentStep === 0}, {'completed': currentStep > 0}]">
diff --git a/front/src/components/library/radios/Builder.vue b/front/src/components/library/radios/Builder.vue
index 8d67b61e1..9b8786cc6 100644
--- a/front/src/components/library/radios/Builder.vue
+++ b/front/src/components/library/radios/Builder.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="ui vertical stripe segment">
+  <div class="ui vertical stripe segment" v-title="'Radio Builder'">
     <div>
       <div>
         <h2 class="ui header">Builder</h2>
diff --git a/front/src/components/requests/RequestsList.vue b/front/src/components/requests/RequestsList.vue
index 33ba04f53..5d4db243a 100644
--- a/front/src/components/requests/RequestsList.vue
+++ b/front/src/components/requests/RequestsList.vue
@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div v-title="'Import Requests'">
     <div class="ui vertical stripe segment">
       <h2 class="ui header">Music requests</h2>
       <div :class="['ui', {'loading': isLoading}, 'form']">
diff --git a/front/src/main.js b/front/src/main.js
index f20af42bf..5030e5c9c 100644
--- a/front/src/main.js
+++ b/front/src/main.js
@@ -30,6 +30,10 @@ require('masonry-layout')
 Vue.use(VueMasonryPlugin)
 Vue.use(VueLazyload)
 Vue.config.productionTip = false
+Vue.directive('title', {
+  inserted: (el, binding) => { console.log(binding.value); document.title = binding.value + ' - Funkwhale' },
+  updated: (el, binding) => { document.title = binding.value + ' - Funkwhale' }
+})
 
 axios.defaults.baseURL = config.API_URL
 axios.interceptors.request.use(function (config) {
diff --git a/front/src/views/instance/Timeline.vue b/front/src/views/instance/Timeline.vue
index 8ffcd9758..f4ddedfb7 100644
--- a/front/src/views/instance/Timeline.vue
+++ b/front/src/views/instance/Timeline.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="main pusher">
+  <div class="main pusher" v-title="'Instance Timeline'">
     <div class="ui vertical center aligned stripe segment">
       <div v-if="isLoading" :class="['ui', {'active': isLoading}, 'inverted', 'dimmer']">
         <div class="ui text loader">Loading timeline...</div>
diff --git a/front/src/views/playlists/Detail.vue b/front/src/views/playlists/Detail.vue
index 6c3a988fd..2769317e6 100644
--- a/front/src/views/playlists/Detail.vue
+++ b/front/src/views/playlists/Detail.vue
@@ -1,9 +1,9 @@
 <template>
   <div>
-    <div v-if="isLoading" class="ui vertical segment">
+    <div v-if="isLoading" class="ui vertical segment" v-title="'Playlist'">
       <div :class="['ui', 'centered', 'active', 'inline', 'loader']"></div>
     </div>
-    <div v-if="!isLoading && playlist" class="ui head vertical center aligned stripe segment">
+    <div v-if="!isLoading && playlist" class="ui head vertical center aligned stripe segment" v-title="playlist.name">
       <div class="segment-content">
         <h2 class="ui center aligned icon header">
           <i class="circular inverted list yellow icon"></i>
diff --git a/front/src/views/playlists/List.vue b/front/src/views/playlists/List.vue
index fc5dcbe54..96aa36c47 100644
--- a/front/src/views/playlists/List.vue
+++ b/front/src/views/playlists/List.vue
@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div v-title="'Playlists'">
     <div class="ui vertical stripe segment">
       <h2 class="ui header">Browsing playlists</h2>
       <div :class="['ui', {'loading': isLoading}, 'form']">
-- 
GitLab