added default base page

This commit is contained in:
Bachir Soussi Chiadmi 2021-01-19 16:30:14 +01:00
parent a0d1099eae
commit f4174fac16
10 changed files with 102 additions and 68 deletions

View File

@ -2,8 +2,8 @@ timeout: 3600
max_timeout: 172800 max_timeout: 172800
padding: 360 padding: 360
role_logout: true role_logout: true
redirect_url: / redirect_url: /node/1
no_dialog: false no_dialog: true
message: 'Your session is about to expire. Do you want to reset it?' message: 'Your session is about to expire. Do you want to reset it?'
inactivity_message: '' inactivity_message: ''
enforce_admin: false enforce_admin: false

View File

@ -1,6 +1,6 @@
genpass_length: 12 genpass_length: 12
genpass_algorithm: user genpass_algorithm: user
genpass_mode: 2 genpass_mode: 1
genpass_display: 3 genpass_display: 3
_core: _core:
default_config_hash: HNSTwPQM5lvXFeH4cVlcB2gZFJ5S--Nbmfj7651HK24 default_config_hash: HNSTwPQM5lvXFeH4cVlcB2gZFJ5S--Nbmfj7651HK24

View File

@ -8,8 +8,8 @@ dependencies:
- taxonomy - taxonomy
- search_api - search_api
config: config:
- field.storage.node.field_famille
- field.storage.node.body - field.storage.node.body
- field.storage.node.field_famille
- field.storage.node.field_tags - field.storage.node.field_tags
- field.storage.taxonomy_term.field_synonyms - field.storage.taxonomy_term.field_synonyms
- field.storage.node.field_thesaurus - field.storage.node.field_thesaurus
@ -194,11 +194,29 @@ datasource_settings:
- fr - fr
processor_settings: processor_settings:
add_url: { } add_url: { }
entity_status: { } aggregated_field: { }
rendered_item: { }
content_access: content_access:
weights: weights:
preprocess_query: -50 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: html_filter:
all_fields: true all_fields: true
fields: fields:
@ -224,28 +242,10 @@ processor_settings:
preprocess_index: -15 preprocess_index: -15
preprocess_query: -49 preprocess_query: -49
language_with_fallback: { } language_with_fallback: { }
aggregated_field: { } rendered_item: { }
solr_date_range: solr_date_range:
weights: weights:
preprocess_index: 0 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: tracker_settings:
default: default:
indexing_order: fifo indexing_order: fifo

View File

@ -10,6 +10,7 @@ permissions:
- 'access materio search' - 'access materio search'
- 'add flag lists' - 'add flag lists'
- 'create member profile' - 'create member profile'
- 'create workflow workflow_transition'
- 'edit own flag lists' - 'edit own flag lists'
- 'flag dossier other items' - 'flag dossier other items'
- 'unflag dossier other items' - 'unflag dossier other items'

View File

@ -1,4 +1,8 @@
workflow_edited: workflow_edited:
adherent:
grant_view: true
grant_update: 0
grant_delete: 0
admin: admin:
grant_view: true grant_view: true
grant_update: true grant_update: true
@ -15,15 +19,11 @@ workflow_edited:
grant_view: 0 grant_view: 0
grant_update: 0 grant_update: 0
grant_delete: 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: workflow_hidden:
adherent:
grant_view: 0
grant_update: 0
grant_delete: 0
admin: admin:
grant_view: true grant_view: true
grant_update: true grant_update: true
@ -40,21 +40,17 @@ workflow_hidden:
grant_view: 0 grant_view: 0
grant_update: 0 grant_update: 0
grant_delete: 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: workflow_visible:
adherent:
grant_view: true
grant_update: 0
grant_delete: 0
admin: admin:
grant_view: 0 grant_view: true
grant_update: true grant_update: true
grant_delete: 0 grant_delete: 0
root: root:
grant_view: 0 grant_view: true
grant_update: true grant_update: true
grant_delete: true grant_delete: true
workflow_author: workflow_author:
@ -65,15 +61,11 @@ workflow_visible:
grant_view: true grant_view: true
grant_update: 0 grant_update: 0
grant_delete: 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: workflow_imported:
adherent:
grant_view: true
grant_update: 0
grant_delete: 0
admin: admin:
grant_view: true grant_view: true
grant_update: true grant_update: true
@ -90,14 +82,6 @@ workflow_imported:
grant_view: 0 grant_view: 0
grant_update: 0 grant_update: 0
grant_delete: 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: migration_new:
anonymous: anonymous:
grant_view: true grant_view: true

View File

@ -17,6 +17,8 @@ use Drupal\search_api\Entity\Index;
*/ */
class Base extends ControllerBase { class Base extends ControllerBase {
private $limit = 15; private $limit = 15;
private $offset = 0; 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 * get params from request
*/ */
@ -79,8 +99,6 @@ class Base extends ControllerBase {
$this->parseRequest($request); $this->parseRequest($request);
$resp = [ $resp = [
'keys' => $this->keys,
'term' => $this->term,
'range' => array( 'range' => array(
'offset' => $this->offset, 'offset' => $this->offset,
'limit' => $this->limit 'limit' => $this->limit
@ -90,6 +108,8 @@ class Base extends ControllerBase {
if ($this->keys) { if ($this->keys) {
$this->sapiQuery(); $this->sapiQuery();
$resp['keys'] = $this->keys;
$resp['term'] = $this->term;
$resp['count'] = $this->results->getResultCount(); $resp['count'] = $this->results->getResultCount();
$resp['infos'] = t('The search found @count result(s) with keywords @keys.', array( $resp['infos'] = t('The search found @count result(s) with keywords @keys.', array(
"@count" => $resp['count'], "@count" => $resp['count'],
@ -117,6 +137,22 @@ class Base extends ControllerBase {
// $resp['items'] = $items; // $resp['items'] = $items;
$resp['uuids'] = $uuids; $resp['uuids'] = $uuids;
$resp['nids'] = $nids; $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); return new JsonResponse($resp);
@ -163,7 +199,7 @@ class Base extends ControllerBase {
$resp['items'] = $this->items; $resp['items'] = $this->items;
}else{ }else{
$resp['#markup'] = "no keys to search for"; $resp['#markup'] = t("no keys to search for");
} }
return $resp; return $resp;

File diff suppressed because one or more lines are too long

View File

@ -140,8 +140,11 @@ import 'theme/assets/styles/main.scss'
if (to.path == '/') { if (to.path == '/') {
classes.push('path-home') classes.push('path-home')
} else { } else {
const path_parts = to.path.replace(/^\//, '').split('/') const path_parts = to.path
// TODO: remove language relative prefix from path classes (fr, en, etc) .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++) { for (var i = 0; i < path_parts.length; i++) {
if (i == 0) { if (i == 0) {
var c = 'path-' + path_parts[i] var c = 'path-' + path_parts[i]

View File

@ -70,6 +70,12 @@ export default {
this.$store.commit('Search/setTerm', params.get('term')) this.$store.commit('Search/setTerm', params.get('term'))
this.pagetitle = params.get('keys') this.pagetitle = params.get('keys')
this.newSearch() 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) { beforeRouteUpdate (to, from, next) {

View File

@ -86,7 +86,11 @@ export default {
commit('resetCount') commit('resetCount')
commit('resetNoresults') commit('resetNoresults')
commit('resetOffset') 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') dispatch('getResults')
}, },
nextPage ({ dispatch, commit, state }, $infiniteLoadingstate) { nextPage ({ dispatch, commit, state }, $infiniteLoadingstate) {