Advanced search shortcut

This commit is contained in:
weryques 2018-07-11 16:05:33 -03:00
parent 1ed43bedc3
commit 0ba2d0eb15
4 changed files with 102 additions and 59 deletions

View File

@ -15,7 +15,9 @@
grouped>
<!-- Metadata (Search criteria) -->
<b-field class="column">
<b-field
:class="{'is-3': isHeader}"
class="column">
<b-select
:placeholder="$i18n.get('instruction_select_a_metadatum')"
:disabled="advancedSearchQuery.taxquery[searchCriterion] ||
@ -34,7 +36,8 @@
<!-- Inputs -->
<b-field
class="column is-two-thirds">
:class="{'is-two-thirds': !isHeader}"
class="column">
<b-input
v-if="advancedSearchQuery.metaquery[searchCriterion] &&
advancedSearchQuery.metaquery[searchCriterion].ptype != 'date'"
@ -71,6 +74,7 @@
<!-- Comparators -->
<b-field
:class="{'is-3': isHeader}"
class="column">
<b-select
v-if="advancedSearchQuery.taxquery[searchCriterion] ||
@ -188,6 +192,7 @@
props: {
metadata: Array,
isRepositoryLevel: false,
isHeader: false,
advancedSearchResults: false,
openFormAdvancedSearch: false,
isDoSearch: false,
@ -407,6 +412,19 @@
this.addToAdvancedSearchQuery(value, type, searchCriterion);
}, 900),
searchAdvanced(){
if(this.isHeader){
if(this.$route.path == '/items') {
this.$root.$emit('openAdvancedSearch', true);
}
if(this.$route.path != '/items') {
this.$router.push({
path: '/items',
});
}
}
if(Object.keys(this.advancedSearchQuery.taxquery).length > 0 &&
Object.keys(this.advancedSearchQuery.metaquery).length > 0){
this.advancedSearchQuery.relation = 'AND';

View File

@ -21,38 +21,41 @@
<input
autocomplete="on"
:placeholder="$i18n.get('instruction_search_in_repository')"
class="input is-small"
class="input is-small search-header"
type="search"
:value="searchQuery"
@input="futureSearchQuery = $event.target.value"
@keyup.enter="updateSearch()">
<span class="icon is-right">
<i
@click="updateSearch()"
class="mdi mdi-magnify"/>
</span>
<!--<b-dropdown-->
<!--position="is-bottom-left">-->
<!--<b-icon-->
<!--class="is-right"-->
<!--slot="trigger"-->
<!--size="is-small"-->
<!--icon="menu-down"/>-->
<!--<b-dropdown-item>-->
<!--<p class="is-left">{{ $i18n.get('advanced_search') }}</p>-->
<!--<b-icon-->
<!--icon="menu-up"-->
<!--class="is-right" />-->
<!--</b-dropdown-item>-->
<!--<b-dropdown-item-->
<!--:custom="true">-->
<!--<advanced-search />-->
<!--</b-dropdown-item>-->
<!--</b-dropdown>-->
<!--<span class="icon is-right">-->
<!--<i-->
<!--@click="updateSearch()"-->
<!--class="mdi mdi-magnify"/>-->
<!--</span>-->
<b-dropdown
class="advanced-search-header-dropdown"
position="is-bottom-left">
<b-icon
class="is-right"
slot="trigger"
size="is-small"
icon="menu-down"/>
<b-dropdown-item>
<p class="is-left">{{ $i18n.get('advanced_search') }}</p>
<b-icon
icon="menu-up"
class="is-right" />
</b-dropdown-item>
<b-dropdown-item
:custom="true">
<advanced-search
:metadata="metadata"
:is-header="true"/>
</b-dropdown-item>
</b-dropdown>
</div>
<a
:style="{color: 'white'}"
@click="toItemsPage">{{ $i18n.get('advanced_search') }}</a>
<!--<a-->
<!--:style="{color: 'white'}"-->
<!--@click="toItemsPage">{{ $i18n.get('advanced_search') }}</a>-->
</div>
<a
:style="{color: 'white'}"
@ -67,6 +70,7 @@
<script>
import AdvancedSearch from '../advanced-search/advanced-search.vue';
import { mapActions } from 'vuex';
export default {
name: 'TainacanHeader',
@ -76,26 +80,30 @@
wordpressAdmin: window.location.origin + window.location.pathname.replace('admin.php', ''),
searchQuery: '',
futureSearchQuery: '',
metadata: Array,
}
},
components: {
AdvancedSearch,
},
methods: {
toItemsPage() {
if(this.$route.path == '/items') {
this.$root.$emit('openAdvancedSearch', true);
}
if(this.$route.path != '/items') {
this.$router.push({
path: '/items',
query: {
advancedSearch: true
}
});
}
},
...mapActions('metadata', [
'fetchMetadata'
]),
// toItemsPage() {
// if(this.$route.path == '/items') {
// this.$root.$emit('openAdvancedSearch', true);
// }
//
// if(this.$route.path != '/items') {
// this.$router.push({
// path: '/items',
// query: {
// advancedSearch: true
// }
// });
// }
// },
updateSearch() {
if (this.$route.path != '/items') {
this.$router.push({
@ -108,7 +116,18 @@
},
props: {
isMenuCompressed: false
}
},
created(){
this.fetchMetadata({
collectionId: false,
isRepositoryLevel: true,
isContextEdit: false,
includeDisabled: false,
})
.then((metadata) => {
this.metadata = metadata;
});
},
}
</script>
@ -159,8 +178,8 @@
align-items: center;
margin-right: 36px;
.control:not(.tnc-advanced-search-container) {
input {
.control {
.search-header {
border-width: 0 !important;
height: 27px;
font-size: 11px;
@ -169,7 +188,7 @@
-webkit-transition: width linear 0.15s;
width: 160px;
}
input:focus, input:active {
.search-header:focus, .search-header:active {
width: 220px !important;
}
.icon {
@ -182,13 +201,19 @@
}
}
/*.dropdown-content {*/
/*width: 800px !important;*/
/*}*/
.dropdown-content {
width: 800px !important;
}
/*.dropdown-item:hover {*/
/*background-color: white;*/
/*}*/
.dropdown-item:hover {
background-color: white;
}
.dropdown-item {
span.icon:not(.is-right) {
position: -webkit-sticky !important;
}
}
a {
margin: 0px 12px;

View File

@ -56,7 +56,7 @@ a:hover {
&.disabled {
pointer-events: none;
cursor: default;
color: $tainacan-input-background;
color: $tainacan-input-background !important;
.icon {
color: $tainacan-input-background !important;

View File

@ -81,7 +81,7 @@ const production = false;
if (production === true) {
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
console.log({'production': production});
console.log(`production: ${production}`);
module.exports.mode = 'production';
@ -109,7 +109,7 @@ if (production === true) {
}
}
} else {
console.log({'production': production});
console.log(`production: ${production}`);
module.exports.devtool = '';