|
36 | 36 | Bibliothèque |
37 | 37 | </nuxt-link> |
38 | 38 |
|
39 | | - <nuxt-link class="cta-link cta-link-with-arrow" tag="li" to="/tutoriel/introduction"> |
| 39 | + <nuxt-link class="cta-link cta-link-with-arrow" tag="li" :class="isTutorialLink" to="/tutoriel/introduction"> |
40 | 40 | <div class="logo-link-wrapper"> |
41 | 41 | <Icon type="info" theme="theme--white"/> |
42 | 42 | </div> |
|
47 | 47 | <template v-if="isAuthenticated && (role === 'admin' || role === 'super_admin')"> |
48 | 48 | <span>Administration</span> |
49 | 49 | <ul> |
50 | | - <nuxt-link class="cta-link cta-link-with-arrow" tag="li" to="/administration/exercices"> |
| 50 | + <nuxt-link class="cta-link cta-link-with-arrow" tag="li" :class="isAdministrationExerciseLink" to="/administration/exercices"> |
51 | 51 | <div class="logo-link-wrapper"> |
52 | 52 | <Icon type="document" theme="theme--white"/> |
53 | 53 | </div> |
54 | 54 | Exercices |
55 | 55 | </nuxt-link> |
56 | | - <nuxt-link class="cta-link cta-link-with-arrow" tag="li" to="/administration/categories"> |
| 56 | + <nuxt-link class="cta-link cta-link-with-arrow" tag="li" :class="isAdministrationCategoryLink" to="/administration/categories"> |
57 | 57 | <div class="logo-link-wrapper"> |
58 | 58 | <Icon type="bookmark" theme="theme--white"/> |
59 | 59 | </div> |
60 | 60 | Catégories |
61 | 61 | </nuxt-link> |
62 | | - <nuxt-link class="cta-link cta-link-with-arrow" tag="li" to="/administration/tags"> |
| 62 | + <nuxt-link class="cta-link cta-link-with-arrow" tag="li" :class="isAdministrationTagLink" to="/administration/tags"> |
63 | 63 | <div class="logo-link-wrapper"> |
64 | 64 | <Icon type="tags" theme="theme--white"/> |
65 | 65 | </div> |
|
77 | 77 | <template v-if="isAuthenticated"> |
78 | 78 | <span>Gestion</span> |
79 | 79 | <ul> |
80 | | - <nuxt-link class="cta-link cta-link-with-arrow" tag="li" to="/gestion/mes-exercices"> |
| 80 | + <nuxt-link class="cta-link cta-link-with-arrow" :class="isGestionLink" tag="li" to="/gestion/mes-exercices"> |
81 | 81 | <div class="logo-link-wrapper"> |
82 | 82 | <Icon type="document" theme="theme--white"/> |
83 | 83 | </div> |
84 | 84 | Mes exercices |
85 | 85 | </nuxt-link> |
86 | | - <nuxt-link class="cta-link cta-link-with-arrow" tag="li" to="/gestion/mes-favoris"> |
| 86 | + <nuxt-link class="cta-link cta-link-with-arrow" :class="isFavoriteLink" tag="li" to="/gestion/mes-favoris"> |
87 | 87 | <div class="logo-link-wrapper"> |
88 | 88 | <Icon type="star" theme="theme--white"/> |
89 | 89 | </div> |
|
142 | 142 | } |
143 | 143 |
|
144 | 144 | get role(): UserRole { |
| 145 | + console.log(this.$route.path); |
| 146 | +
|
145 | 147 | return this.$auth.user.role |
146 | 148 | } |
147 | 149 |
|
| 150 | + get isAdministrationExerciseLink() { |
| 151 | + const regex = new RegExp(/^(\/administration\/exercices)/gm); |
| 152 | + if(this.$route.path.match(regex)) return 'nuxt-link-exact-active'; |
| 153 | + return ''; |
| 154 | + } |
| 155 | +
|
| 156 | + get isAdministrationTagLink() { |
| 157 | + const regex = new RegExp(/^(\/administration\/tags)/gm); |
| 158 | + if(this.$route.path.match(regex)) return 'nuxt-link-exact-active'; |
| 159 | + return ''; |
| 160 | + } |
| 161 | +
|
| 162 | + get isAdministrationCategoryLink() { |
| 163 | + const regex = new RegExp(/^(\/administration\/categories)/gm); |
| 164 | + if(this.$route.path.match(regex)) return 'nuxt-link-exact-active'; |
| 165 | + return ''; |
| 166 | + } |
| 167 | +
|
| 168 | + get isGestionLink() { |
| 169 | + const regex = new RegExp(/^(\/gestion\/mes-exercices)/gm); |
| 170 | + if(this.$route.path.match(regex)) return 'nuxt-link-exact-active'; |
| 171 | + return ''; |
| 172 | + } |
| 173 | +
|
| 174 | + get isFavoriteLink() { |
| 175 | + const regex = new RegExp(/^(\/gestion\/mes-favoris)/gm); |
| 176 | + if(this.$route.path.match(regex)) return 'nuxt-link-exact-active'; |
| 177 | + return ''; |
| 178 | + } |
| 179 | +
|
| 180 | + get isTutorialLink() { |
| 181 | + const regex = new RegExp(/^(\/tutoriel)/gm); |
| 182 | + if(this.$route.path.match(regex)) return 'nuxt-link-exact-active'; |
| 183 | + return ''; |
| 184 | + } |
| 185 | +
|
| 186 | + get routeLol() { |
| 187 | + console.log(this.$route); |
| 188 | +
|
| 189 | + return this.$route; |
| 190 | + } |
| 191 | +
|
148 | 192 | async logout() { |
149 | 193 | this.$accessor.favorites.RESET(); |
150 | 194 | this.$accessor.historical.RESET(); |
|
0 commit comments