added default base page
This commit is contained in:
parent
a0d1099eae
commit
f4174fac16
|
@ -2,8 +2,8 @@ timeout: 3600
|
|||
max_timeout: 172800
|
||||
padding: 360
|
||||
role_logout: true
|
||||
redirect_url: /
|
||||
no_dialog: false
|
||||
redirect_url: /node/1
|
||||
no_dialog: true
|
||||
message: 'Your session is about to expire. Do you want to reset it?'
|
||||
inactivity_message: ''
|
||||
enforce_admin: false
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
genpass_length: 12
|
||||
genpass_algorithm: user
|
||||
genpass_mode: 2
|
||||
genpass_mode: 1
|
||||
genpass_display: 3
|
||||
_core:
|
||||
default_config_hash: HNSTwPQM5lvXFeH4cVlcB2gZFJ5S--Nbmfj7651HK24
|
||||
|
|
|
@ -8,8 +8,8 @@ dependencies:
|
|||
- taxonomy
|
||||
- search_api
|
||||
config:
|
||||
- field.storage.node.field_famille
|
||||
- field.storage.node.body
|
||||
- field.storage.node.field_famille
|
||||
- field.storage.node.field_tags
|
||||
- field.storage.taxonomy_term.field_synonyms
|
||||
- field.storage.node.field_thesaurus
|
||||
|
@ -194,11 +194,29 @@ datasource_settings:
|
|||
- fr
|
||||
processor_settings:
|
||||
add_url: { }
|
||||
entity_status: { }
|
||||
rendered_item: { }
|
||||
aggregated_field: { }
|
||||
content_access:
|
||||
weights:
|
||||
preprocess_query: -50
|
||||
double_quote_workaround:
|
||||
all_fields: true
|
||||
fields:
|
||||
- field_famille
|
||||
- processed
|
||||
- tag_name
|
||||
- tag_synonyms
|
||||
- tag_tid
|
||||
- thesaurus_name
|
||||
- thesaurus_synonyms
|
||||
- thesaurus_tid
|
||||
- title
|
||||
- uuid
|
||||
replacement: '|9999999998|'
|
||||
weights:
|
||||
postprocess_query: 0
|
||||
preprocess_index: -15
|
||||
preprocess_query: -48
|
||||
entity_status: { }
|
||||
html_filter:
|
||||
all_fields: true
|
||||
fields:
|
||||
|
@ -224,28 +242,10 @@ processor_settings:
|
|||
preprocess_index: -15
|
||||
preprocess_query: -49
|
||||
language_with_fallback: { }
|
||||
aggregated_field: { }
|
||||
rendered_item: { }
|
||||
solr_date_range:
|
||||
weights:
|
||||
preprocess_index: 0
|
||||
double_quote_workaround:
|
||||
all_fields: true
|
||||
fields:
|
||||
- field_famille
|
||||
- processed
|
||||
- tag_name
|
||||
- tag_synonyms
|
||||
- tag_tid
|
||||
- thesaurus_name
|
||||
- thesaurus_synonyms
|
||||
- thesaurus_tid
|
||||
- title
|
||||
- uuid
|
||||
replacement: '|9999999998|'
|
||||
weights:
|
||||
postprocess_query: 0
|
||||
preprocess_index: -15
|
||||
preprocess_query: -48
|
||||
tracker_settings:
|
||||
default:
|
||||
indexing_order: fifo
|
||||
|
|
|
@ -10,6 +10,7 @@ permissions:
|
|||
- 'access materio search'
|
||||
- 'add flag lists'
|
||||
- 'create member profile'
|
||||
- 'create workflow workflow_transition'
|
||||
- 'edit own flag lists'
|
||||
- 'flag dossier other items'
|
||||
- 'unflag dossier other items'
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
workflow_edited:
|
||||
adherent:
|
||||
grant_view: true
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
admin:
|
||||
grant_view: true
|
||||
grant_update: true
|
||||
|
@ -15,15 +19,11 @@ workflow_edited:
|
|||
grant_view: 0
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
authenticated:
|
||||
grant_view: 0
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
user:
|
||||
grant_view: 0
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
workflow_hidden:
|
||||
adherent:
|
||||
grant_view: 0
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
admin:
|
||||
grant_view: true
|
||||
grant_update: true
|
||||
|
@ -40,21 +40,17 @@ workflow_hidden:
|
|||
grant_view: 0
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
authenticated:
|
||||
grant_view: 0
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
user:
|
||||
grant_view: 0
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
workflow_visible:
|
||||
adherent:
|
||||
grant_view: true
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
admin:
|
||||
grant_view: 0
|
||||
grant_view: true
|
||||
grant_update: true
|
||||
grant_delete: 0
|
||||
root:
|
||||
grant_view: 0
|
||||
grant_view: true
|
||||
grant_update: true
|
||||
grant_delete: true
|
||||
workflow_author:
|
||||
|
@ -65,15 +61,11 @@ workflow_visible:
|
|||
grant_view: true
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
authenticated:
|
||||
grant_view: true
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
user:
|
||||
grant_view: 0
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
workflow_imported:
|
||||
adherent:
|
||||
grant_view: true
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
admin:
|
||||
grant_view: true
|
||||
grant_update: true
|
||||
|
@ -90,14 +82,6 @@ workflow_imported:
|
|||
grant_view: 0
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
authenticated:
|
||||
grant_view: 0
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
user:
|
||||
grant_view: 0
|
||||
grant_update: 0
|
||||
grant_delete: 0
|
||||
migration_new:
|
||||
anonymous:
|
||||
grant_view: true
|
||||
|
|
|
@ -17,6 +17,8 @@ use Drupal\search_api\Entity\Index;
|
|||
*/
|
||||
class Base extends ControllerBase {
|
||||
|
||||
|
||||
|
||||
private $limit = 15;
|
||||
private $offset = 0;
|
||||
|
||||
|
@ -56,6 +58,24 @@ class Base extends ControllerBase {
|
|||
|
||||
}
|
||||
|
||||
private function defaultQuery(){
|
||||
$entity_storage = \Drupal::entityTypeManager()->getStorage('node');
|
||||
$this->query = $entity_storage->getQuery()
|
||||
->condition('type', 'materiau')
|
||||
// ->condition('status', '1')
|
||||
->range($this->offset, $this->limit)
|
||||
->accessCheck(TRUE)
|
||||
->sort('changed', 'DESC');
|
||||
// ->condition('field_example', 'test_value')
|
||||
$this->results = $this->query->execute();
|
||||
|
||||
$this->count_query = $entity_storage->getQuery()
|
||||
->condition('type', 'materiau')
|
||||
->accessCheck(TRUE)
|
||||
// ->condition('status', '1')
|
||||
->count();
|
||||
$this->count = $this->count_query->execute();
|
||||
}
|
||||
/**
|
||||
* get params from request
|
||||
*/
|
||||
|
@ -79,8 +99,6 @@ class Base extends ControllerBase {
|
|||
$this->parseRequest($request);
|
||||
|
||||
$resp = [
|
||||
'keys' => $this->keys,
|
||||
'term' => $this->term,
|
||||
'range' => array(
|
||||
'offset' => $this->offset,
|
||||
'limit' => $this->limit
|
||||
|
@ -90,6 +108,8 @@ class Base extends ControllerBase {
|
|||
if ($this->keys) {
|
||||
$this->sapiQuery();
|
||||
|
||||
$resp['keys'] = $this->keys;
|
||||
$resp['term'] = $this->term;
|
||||
$resp['count'] = $this->results->getResultCount();
|
||||
$resp['infos'] = t('The search found @count result(s) with keywords @keys.', array(
|
||||
"@count" => $resp['count'],
|
||||
|
@ -117,6 +137,22 @@ class Base extends ControllerBase {
|
|||
// $resp['items'] = $items;
|
||||
$resp['uuids'] = $uuids;
|
||||
$resp['nids'] = $nids;
|
||||
} else {
|
||||
// no keys or terms to search for
|
||||
// display the default base page
|
||||
$this->defaultQuery();
|
||||
// $uuids = [];
|
||||
$nids = [];
|
||||
foreach ($this->results as $result) {
|
||||
// $uuids[] = $result->getField('uuid')->getValues()[0];
|
||||
$nids[] = $result;
|
||||
}
|
||||
// $resp['uuids'] = $uuids;
|
||||
$resp['nids'] = $nids;
|
||||
$resp['count'] = $this->count;
|
||||
$resp['infos'] = t('Please use the search form to search from our @count materials.', array(
|
||||
"@count" => $resp['count']
|
||||
));
|
||||
}
|
||||
|
||||
return new JsonResponse($resp);
|
||||
|
@ -163,7 +199,7 @@ class Base extends ControllerBase {
|
|||
|
||||
$resp['items'] = $this->items;
|
||||
}else{
|
||||
$resp['#markup'] = "no keys to search for";
|
||||
$resp['#markup'] = t("no keys to search for");
|
||||
}
|
||||
|
||||
return $resp;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -140,8 +140,11 @@ import 'theme/assets/styles/main.scss'
|
|||
if (to.path == '/') {
|
||||
classes.push('path-home')
|
||||
} else {
|
||||
const path_parts = to.path.replace(/^\//, '').split('/')
|
||||
// TODO: remove language relative prefix from path classes (fr, en, etc)
|
||||
const path_parts = to.path
|
||||
.replace(/^\//, '')
|
||||
// remove language relative prefix from path classes (fr, en, etc)
|
||||
.replace(/^\D{2,3}\//, '')
|
||||
.split('/')
|
||||
for (var i = 0; i < path_parts.length; i++) {
|
||||
if (i == 0) {
|
||||
var c = 'path-' + path_parts[i]
|
||||
|
|
|
@ -70,6 +70,12 @@ export default {
|
|||
this.$store.commit('Search/setTerm', params.get('term'))
|
||||
this.pagetitle = params.get('keys')
|
||||
this.newSearch()
|
||||
}else{
|
||||
// load default base page
|
||||
this.$store.commit('Search/setKeys', '')
|
||||
this.$store.commit('Search/setTerm', '')
|
||||
this.pagetitle = 'Base'
|
||||
this.newSearch()
|
||||
}
|
||||
},
|
||||
beforeRouteUpdate (to, from, next) {
|
||||
|
|
|
@ -86,7 +86,11 @@ export default {
|
|||
commit('resetCount')
|
||||
commit('resetNoresults')
|
||||
commit('resetOffset')
|
||||
this.commit('Common/setPagetitle', state.keys)
|
||||
if(state.keys || state.term){
|
||||
this.commit('Common/setPagetitle', state.keys)
|
||||
}else{
|
||||
this.commit('Common/setPagetitle', 'Base')
|
||||
}
|
||||
dispatch('getResults')
|
||||
},
|
||||
nextPage ({ dispatch, commit, state }, $infiniteLoadingstate) {
|
||||
|
|
Loading…
Reference in New Issue