Add search functionality for vocabulary in VocabController and VocabService
- Implemented a new searchVocabs method in VocabService to allow users to search for vocabulary based on learning and mother tongue terms. - Updated VocabController to include the searchVocabs method wrapped with user authentication. - Added a new route in vocabRouter for searching vocabulary by language ID. - Enhanced VocabChapterView and VocabLanguageView components to include a button for opening the search dialog. - Added translations for search-related terms in both German and English locales, improving user accessibility.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
<div class="row">
|
||||
<button @click="goSubscribe">{{ $t('socialnetwork.vocab.subscribeByCode') }}</button>
|
||||
<button @click="openSearch">{{ $t('socialnetwork.vocab.search.open') }}</button>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
@@ -48,13 +49,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<VocabSearchDialog ref="searchDialog" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiClient from '@/utils/axios.js';
|
||||
import VocabSearchDialog from '@/dialogues/socialnetwork/VocabSearchDialog.vue';
|
||||
|
||||
export default {
|
||||
name: 'VocabLanguageView',
|
||||
components: { VocabSearchDialog },
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
@@ -69,6 +74,12 @@ export default {
|
||||
goSubscribe() {
|
||||
this.$router.push('/socialnetwork/vocab/subscribe');
|
||||
},
|
||||
openSearch() {
|
||||
this.$refs.searchDialog?.open?.({
|
||||
languageId: this.$route.params.languageId,
|
||||
languageName: this.language?.name || '',
|
||||
});
|
||||
},
|
||||
openChapter(chapterId) {
|
||||
this.$router.push(`/socialnetwork/vocab/${this.$route.params.languageId}/chapters/${chapterId}`);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user