Sets sentence mode via a checkbox. #743.

This commit is contained in:
mateuswetah 2022-11-23 10:46:47 -03:00
parent d5799fb775
commit 46eeefea13
4 changed files with 29 additions and 11 deletions

View File

@ -300,7 +300,6 @@ export default {
},
setSentenceMode(sentenceMode) {
this.$store.dispatch('search/setSentenceMode', sentenceMode);
this.updateURLQueries();
},
setSearchQuery(searchQuery) {
this.$store.dispatch('search/setSearchQuery', searchQuery);

View File

@ -149,9 +149,11 @@ export const setSearchQuery = ( state, searchQuery ) => {
export const setSentenceMode = ( state, sentenceMode ) => {
if (sentenceMode == true)
state.postquery.sentence = sentenceMode;
else
Vue.set(state.postquery, 'sentence', sentenceMode);
else {
Vue.set(state.postquery, 'sentence', sentenceMode); // Needed to trigger getter
delete state.postquery.sentence;
}
};
export const setStatus = ( state, status ) => {

View File

@ -81,12 +81,17 @@
<b-dropdown-item
@click="updateSearch()"
:focusable="false">
<span v-html="$i18n.get('instruction_press_enter_to_search_for')"/>&nbsp;"{{ futureSearchQuery }}".
<span v-html="$i18n.get('instruction_press_enter_to_search_for')"/>&nbsp;
<em>{{ sentenceMode == true ? futureSearchQuery : ('"' + futureSearchQuery + '"') }}.</em>
</b-dropdown-item>
<b-dropdown-item
@click="$eventBusSearch.setSentenceMode(true)"
custom
:focusable="false">
<b-checkbox
:value="sentenceMode"
@input="$eventBusSearch.setSentenceMode($event)">
{{ $i18n.get('label_use_search_separated_words') }}
</b-checkbox>
<small class="is-small help">{{ $i18n.get('info_use_search_separated_words') }}</small>
</b-dropdown-item>
<b-dropdown-item
@ -706,6 +711,9 @@
status() {
return this.getStatus();
},
sentenceMode() {
return this.getSentenceMode();
},
adminViewMode() {
const currentAdminViewMode = this.getAdminViewMode();
return ['table', 'cards', 'records', 'grid', 'masonry', 'list'].indexOf(currentAdminViewMode) >= 0 ? currentAdminViewMode : 'table';
@ -1590,7 +1598,7 @@
/deep/ .dropdown-menu {
z-index: 99999991;
.dropdown-item:last-of-type {
.dropdown-item:last-child {
line-height: 2.25em;
background: var(--tainacan-item-hover-background-color);
}

View File

@ -91,12 +91,17 @@
<b-dropdown-item
@click="updateSearch()"
:focusable="false">
<span v-html="$i18n.get('instruction_press_enter_to_search_for')"/>&nbsp;"{{ futureSearchQuery }}".
<span v-html="$i18n.get('instruction_press_enter_to_search_for')"/>&nbsp;
<em>{{ sentenceMode == true ? futureSearchQuery : ('"' + futureSearchQuery + '"') }}.</em>
</b-dropdown-item>
<b-dropdown-item
@click="$eventBusSearch.setSentenceMode(true)"
custom
:focusable="false">
<b-checkbox
:value="sentenceMode"
@input="$eventBusSearch.setSentenceMode($event)">
{{ $i18n.get('label_use_search_separated_words') }}
</b-checkbox>
<small class="is-small help">{{ $i18n.get('info_use_search_separated_words') }}</small>
</b-dropdown-item>
<b-dropdown-item
@ -730,6 +735,9 @@
searchQuery() {
return this.getSearchQuery();
},
sentenceMode() {
return this.getSentenceMode();
},
viewMode() {
return this.getViewMode();
},
@ -952,6 +960,7 @@
'getOrder',
'getViewMode',
'getTotalItems',
'getSentenceMode',
'getMetaKey',
'getPage',
'getItemsPerPage'
@ -1622,7 +1631,7 @@
/deep/ .dropdown-menu {
z-index: 99999991;
.dropdown-item:last-of-type {
.dropdown-item:last-child {
line-height: 2.25em;
background: var(--tainacan-item-hover-background-color);