url direct access #2936
This commit is contained in:
parent
33bd7696e1
commit
5b2fa651a0
|
@ -30,6 +30,7 @@
|
|||
"drupal/leaflet": "^10.2",
|
||||
"drupal/leaflet_more_maps": "^2.2",
|
||||
"drupal/leaflet_more_markers": "^1.1",
|
||||
"drupal/link_attributes": "^2.1",
|
||||
"drupal/linked_field": "^1.5",
|
||||
"drupal/metatag": "^2.0",
|
||||
"drupal/page_manager": "^4.0@RC",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "5c98347c8de7dd8e83612944f9454bca",
|
||||
"content-hash": "879780d144369cb20a0e07902d9d4d86",
|
||||
"packages": [
|
||||
{
|
||||
"name": "asm89/stack-cors",
|
||||
|
@ -5813,26 +5813,30 @@
|
|||
},
|
||||
{
|
||||
"name": "drupal/link_attributes",
|
||||
"version": "1.14.0",
|
||||
"version": "2.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://git.drupalcode.org/project/link_attributes.git",
|
||||
"reference": "8.x-1.14"
|
||||
"reference": "2.1.1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://ftp.drupal.org/files/projects/link_attributes-8.x-1.14.zip",
|
||||
"reference": "8.x-1.14",
|
||||
"shasum": "fa4f27ecaed7e6b3c58c0adc679918a9beb7ded5"
|
||||
"url": "https://ftp.drupal.org/files/projects/link_attributes-2.1.1.zip",
|
||||
"reference": "2.1.1",
|
||||
"shasum": "fc71571fc41adeda6b39ccefd3c8e21955c0d96f"
|
||||
},
|
||||
"require": {
|
||||
"drupal/core": "^9 || ^10"
|
||||
"drupal/core": "^9 || ^10 || ^11",
|
||||
"php": ">=8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"drupal/linkit": "~6 || ~7"
|
||||
},
|
||||
"type": "drupal-module",
|
||||
"extra": {
|
||||
"drupal": {
|
||||
"version": "8.x-1.14",
|
||||
"datestamp": "1687393687",
|
||||
"version": "2.1.1",
|
||||
"datestamp": "1721366572",
|
||||
"security-coverage": {
|
||||
"status": "covered",
|
||||
"message": "Covered by Drupal's security advisory policy"
|
||||
|
|
|
@ -38,6 +38,7 @@ module:
|
|||
datetime: 0
|
||||
datetime_range: 0
|
||||
dblog: 0
|
||||
decoupled: 0
|
||||
devel: 0
|
||||
devel_generate: 0
|
||||
dynamic_page_cache: 0
|
||||
|
@ -77,6 +78,7 @@ module:
|
|||
leaflet_views: 0
|
||||
link: 0
|
||||
link_attributes: 0
|
||||
link_attributes_menu_link_content: 0
|
||||
linkit: 0
|
||||
locale: 0
|
||||
maillog: 0
|
||||
|
|
|
@ -6,8 +6,9 @@ dependencies:
|
|||
- menu_ui
|
||||
third_party_settings:
|
||||
menu_ui:
|
||||
available_menus: { }
|
||||
parent: ''
|
||||
available_menus:
|
||||
- main
|
||||
parent: 'main:'
|
||||
_core:
|
||||
default_config_hash: ktmRJ5fYRUxN-3fIuUy0g4TUrGmmNjWLKm8J_-n7og4
|
||||
name: Static
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
uuid: bf55165a-b157-423e-9dc5-f76c61e6c396
|
||||
langcode: fr
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- node
|
||||
id: etape
|
||||
label: etape
|
||||
type: 'canonical_entities:node'
|
||||
pattern: '/etapes/[node:title]'
|
||||
selection_criteria:
|
||||
ebf4ccb0-3389-4327-8c96-4e6a78042e9f:
|
||||
id: 'entity_bundle:node'
|
||||
negate: false
|
||||
uuid: ebf4ccb0-3389-4327-8c96-4e6a78042e9f
|
||||
context_mapping:
|
||||
node: node
|
||||
bundles:
|
||||
etape: etape
|
||||
selection_logic: and
|
||||
weight: -5
|
||||
relationships: { }
|
|
@ -0,0 +1,22 @@
|
|||
uuid: cab3d3a4-1abc-4065-8278-dc650fb5c77b
|
||||
langcode: fr
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- node
|
||||
id: static
|
||||
label: static
|
||||
type: 'canonical_entities:node'
|
||||
pattern: '/[node:title]'
|
||||
selection_criteria:
|
||||
39d7bfd7-77dc-4287-84b3-89ee7cd08221:
|
||||
id: 'entity_bundle:node'
|
||||
negate: false
|
||||
uuid: 39d7bfd7-77dc-4287-84b3-89ee7cd08221
|
||||
context_mapping:
|
||||
node: node
|
||||
bundles:
|
||||
static: static
|
||||
selection_logic: and
|
||||
weight: -5
|
||||
relationships: { }
|
|
@ -0,0 +1,15 @@
|
|||
output_values:
|
||||
- key
|
||||
- title
|
||||
- description
|
||||
- uri
|
||||
- alias
|
||||
- external
|
||||
- absolute
|
||||
- relative
|
||||
- existing
|
||||
- weight
|
||||
- expanded
|
||||
- enabled
|
||||
- uuid
|
||||
- options
|
|
@ -12,6 +12,7 @@ dependencies:
|
|||
module:
|
||||
- color_pickr
|
||||
- date_range_formatter
|
||||
- file
|
||||
- geofield
|
||||
- image
|
||||
- leaflet_views
|
||||
|
@ -348,7 +349,7 @@ display:
|
|||
entity_field: nid
|
||||
plugin_id: field
|
||||
label: ''
|
||||
exclude: false
|
||||
exclude: true
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
|
@ -389,10 +390,8 @@ display:
|
|||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: number_integer
|
||||
settings:
|
||||
thousand_separator: ''
|
||||
prefix_suffix: true
|
||||
type: number_unformatted
|
||||
settings: { }
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
|
@ -403,6 +402,121 @@ display:
|
|||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
field_couleur:
|
||||
id: field_couleur
|
||||
table: node__field_couleur
|
||||
field: field_couleur
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
plugin_id: field
|
||||
label: ''
|
||||
exclude: true
|
||||
alter:
|
||||
alter_text: true
|
||||
text: '{{ field_couleur__color_pickr }}'
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: false
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: color_pickr
|
||||
type: color_pickr_default
|
||||
settings: { }
|
||||
group_column: color_pickr
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
delta_offset: 0
|
||||
delta_reversed: false
|
||||
delta_first_last: false
|
||||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
view_node:
|
||||
id: view_node
|
||||
table: node
|
||||
field: view_node
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
entity_type: node
|
||||
plugin_id: entity_link
|
||||
label: ''
|
||||
exclude: true
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: false
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
text: voir
|
||||
output_url_as_text: true
|
||||
absolute: false
|
||||
title:
|
||||
id: title
|
||||
table: node_field_data
|
||||
|
@ -416,10 +530,10 @@ display:
|
|||
label: ''
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: true
|
||||
path: ''
|
||||
alter_text: true
|
||||
text: '<a href="{{ view_node }}" class="etape-link" data-couleur="{{ field_couleur }}" data-nid="{{ nid }}">{{ title }}</a'
|
||||
make_link: false
|
||||
path: '{{ view_node }}'
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
|
@ -455,9 +569,9 @@ display:
|
|||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: string
|
||||
type: file_link
|
||||
settings:
|
||||
link_to_entity: true
|
||||
link_to_entity: 0
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
|
@ -586,68 +700,6 @@ display:
|
|||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
field_couleur:
|
||||
id: field_couleur
|
||||
table: node__field_couleur
|
||||
field: field_couleur
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
plugin_id: field
|
||||
label: ''
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: false
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: color_pickr
|
||||
type: color_pickr_default
|
||||
settings: { }
|
||||
group_column: color_pickr
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
delta_offset: 0
|
||||
delta_reversed: false
|
||||
delta_first_last: false
|
||||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
style:
|
||||
type: html_list
|
||||
options:
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
name: 'decoupled'
|
||||
type: module
|
||||
description: 'helpers for progressive decoupling'
|
||||
core_version_requirement: ^8.8 || ^9.2 || ^10.2
|
||||
package: 'Caravane'
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains decoupled.module.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
// use Drupal\pathauto\PathautoPatternInterface;
|
||||
// use Drupal\pathauto\PathautoPatternManagerInterface;
|
||||
use Drupal\pathauto\Entity\PathautoPattern;
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
*/
|
||||
function decoupled_help($route_name, RouteMatchInterface $route_match) {
|
||||
switch ($route_name) {
|
||||
// Main module help for the materio_decoupled module.
|
||||
case 'help.page.materio_decoupled':
|
||||
$output = '';
|
||||
$output .= '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . t('helpers for progressive decoupling') . '</p>';
|
||||
return $output;
|
||||
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_page_attachments().
|
||||
* @param array $attachments
|
||||
*/
|
||||
function decoupled_page_attachments(array &$attachments) {
|
||||
$redirect = false;
|
||||
$current_path = \Drupal::service('path.current')->getPath();
|
||||
$route_name = \Drupal::routeMatch()->getRouteName();
|
||||
// $route_parameters = \Drupal::routeMatch()->getParameters()->all();
|
||||
// ksm($route_parameters);
|
||||
$current_language = \Drupal::languageManager()->getCurrentLanguage()->getId();
|
||||
$is_front = \Drupal::service('path.matcher')->isFrontPage();
|
||||
if (!$is_front) {
|
||||
$redirect = true;
|
||||
}
|
||||
$entity_type = null;
|
||||
$entity_bundle = null;
|
||||
$entity_id = null;
|
||||
$entity_uuid = null;
|
||||
$base_alias = null;
|
||||
|
||||
foreach (['node', 'taxonomy_term'] as $type) {
|
||||
$entity = \Drupal::routeMatch()->getParameter($type);
|
||||
if($entity){
|
||||
$entity_type = $type;
|
||||
$entity_bundle = $entity->bundle();
|
||||
$entity_id = $entity->id();
|
||||
$entity_uuid = $entity->uuid();
|
||||
|
||||
// $pathauto_patterns = \Drupal::entityTypeManager()->getStorage('pathauto_pattern')->loadByProperties(['type' => "canonical_entities:".$entity_type]);
|
||||
// foreach ($pathauto_patterns as $id => $pattern) {
|
||||
// $conditions = $pattern->getSelectionConditions();
|
||||
// $condition_config = $conditions->getConfiguration();
|
||||
// foreach ($condition_config as $key => $config) {
|
||||
// $bundles = array_keys($config['bundles']);
|
||||
// if (in_array($entity_bundle, $bundles)) {
|
||||
// $motif = $pattern->getPattern();
|
||||
// preg_match('/(\/.+)+\/\[[^]]+\]/', $motif, $matches);
|
||||
// $base_alias = $matches[1];
|
||||
// break 2;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// route_parameters:'".json_encode($route_parameters)."',\n
|
||||
$js_str = "var drupalDecoupled = {\n
|
||||
sys_path:'".$current_path."',\n
|
||||
route_name:'".$route_name."',\n
|
||||
is_front:".($is_front ? 'true':'false').",\n
|
||||
base_alias:'".$base_alias."',\n
|
||||
redirect:".($redirect ? 'true':'false').",\n
|
||||
lang_code:'".$current_language."',\n
|
||||
entity_type:'".$entity_type."',\n
|
||||
entity_bundle:'".$entity_bundle."',\n
|
||||
entity_id:'".$entity_id."',\n
|
||||
entity_uuid:'".$entity_uuid."',\n
|
||||
};";
|
||||
|
||||
$attachments['#attached']['html_head'][] = [
|
||||
[
|
||||
'#type' => 'html_tag',
|
||||
'#tag' => 'script',
|
||||
'#value' => $js_str,
|
||||
'#weight' => -999,
|
||||
'#group' => 'decoupled'
|
||||
],
|
||||
// A key, to make it possible to recognize this HTML element when altering.
|
||||
'decoupled',
|
||||
];
|
||||
}
|
|
@ -1 +1 @@
|
|||
Subproject commit 47a87c53193ba7b7fb7dfdee68273035c46d9440
|
||||
Subproject commit 18c6b02464fdc76846d9ed4261a9403fb7d0dc18
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
console.log("CARAVANE THEME redirect.js drupalDecoupled",drupalDecoupled);drupalDecoupled.redirect?(console.log("redirect",drupalDecoupled),console.log("window.location",window.location),drupalDecoupled.sys_path=edlp.sys_path.replace(/^\//,""),drupalDecoupled.url=window.location.pathname,drupalDecoupled.hash=window.location.hash,window.localStorage.setItem("decoupled_origin",JSON.stringify(drupalDecoupled)),window.location.replace(window.location.origin)):console.log("history do not redirect");
|
|
@ -43,6 +43,7 @@ import router from './router/router';
|
|||
|
||||
function initVues(){
|
||||
initVueContentModale();
|
||||
|
||||
}
|
||||
|
||||
function initVueContentModale(){
|
||||
|
@ -62,6 +63,8 @@ import router from './router/router';
|
|||
mapStore.maxZoom = settings.settings.maxZoom;
|
||||
mapStore.defaultZoom = settings.settings.minZoom;
|
||||
|
||||
|
||||
initFirstLoadRouting(store, map);
|
||||
processEtapeLinks(store, map);
|
||||
processStaticLinks(store, map);
|
||||
processHeaderLogo(store, map);
|
||||
|
@ -71,6 +74,38 @@ import router from './router/router';
|
|||
}
|
||||
}
|
||||
|
||||
function initFirstLoadRouting(store, map){
|
||||
var decoupled_origin = JSON.parse(window.localStorage.getItem('decoupled_origin'));
|
||||
console.log('decoupled_origin', decoupled_origin);
|
||||
|
||||
|
||||
if(decoupled_origin && decoupled_origin.entity_id){
|
||||
// Si c'était moi je ne ferais qu'une seule function fetchdata capable de dealer avec les différent type de contenus
|
||||
switch (decoupled_origin.entity_bundle) {
|
||||
case 'etape':
|
||||
store.fetchEtapeData(decoupled_origin.entity_id, map);
|
||||
break;
|
||||
case 'static':
|
||||
store.fetchEtapeData(decoupled_origin.entity_id, map);
|
||||
break;
|
||||
}
|
||||
|
||||
router.push({
|
||||
// name: decoupled_origin.entity_bundle,
|
||||
path: decoupled_origin.url,
|
||||
// params: {
|
||||
// title: decoupled_origin.entity_uuid
|
||||
// },
|
||||
// props: {
|
||||
// nid: decoupled_origin.entity_id
|
||||
// }
|
||||
});
|
||||
|
||||
// reset the storage
|
||||
window.localStorage.removeItem("decoupled_origin");
|
||||
}
|
||||
}
|
||||
|
||||
function onClickContentLink(e, store, map, category){
|
||||
e.preventDefault();
|
||||
let a;
|
||||
|
@ -82,7 +117,7 @@ import router from './router/router';
|
|||
a = e.target.closest('a');
|
||||
}
|
||||
|
||||
let nid = a.dataset.nodeNid;
|
||||
let nid = a.dataset.nid;
|
||||
|
||||
if (category === 'etape') {
|
||||
store.fetchEtapeData(nid, map);
|
||||
|
@ -100,10 +135,11 @@ import router from './router/router';
|
|||
function processStaticLinks(store, map) {
|
||||
let general_link_fields = document.querySelectorAll('#menu > ul > li > a');
|
||||
for (let i =1; i < general_link_fields.length; i ++) {
|
||||
let general_link_href = general_link_fields[i].getAttribute('href');
|
||||
const nid = general_link_href.charAt(general_link_href.length-1);
|
||||
if (!isNaN(nid)) {
|
||||
general_link_fields[i].setAttribute('data-node-nid', parseInt(nid));
|
||||
let general_link_path = general_link_fields[i].getAttribute('data-drupal-link-system-path');
|
||||
const match = [...general_link_path.match(/^node\/(\d+)$/)];
|
||||
if (match) {
|
||||
const nid = match[1];
|
||||
general_link_fields[i].setAttribute('data-nid', parseInt(nid));
|
||||
general_link_fields[i].addEventListener('click', (e) => onClickContentLink(e, store, map, 'static'));
|
||||
}
|
||||
}
|
||||
|
@ -117,15 +153,13 @@ import router from './router/router';
|
|||
function processEtapeLinks(store, map) {
|
||||
let etape_li = document.querySelectorAll('#etapes-liste li');
|
||||
etape_li.forEach((li) => {
|
||||
let nidElement = li.querySelector('.views-field-nid');
|
||||
let nid = nidElement.innerText;
|
||||
let etape_link = li.querySelector('a.etape-link');
|
||||
let nid = etape_link.dataset.nid;
|
||||
|
||||
if (nid) {
|
||||
let a = li.querySelector('a');
|
||||
a.setAttribute('data-node-nid', nid);
|
||||
li.addEventListener('click', (e) => onClickContentLink(e, store, map, 'etape'));
|
||||
}
|
||||
let couleur = li.querySelector('.views-field-field-couleur .snippets-description').innerText;
|
||||
let couleur = etape_link.dataset.couleur;
|
||||
let iconElements = li.querySelectorAll('.icone-arret > div');
|
||||
for (let element of iconElements) {
|
||||
element.style.backgroundColor = couleur;
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
console.log('CARAVANE THEME redirect.js drupalDecoupled', drupalDecoupled);
|
||||
|
||||
// var drupalDecoupled is provided by edlp_ajax.module file
|
||||
if(drupalDecoupled.redirect){
|
||||
console.log('redirect', drupalDecoupled);
|
||||
console.log('window.location', window.location);
|
||||
|
||||
drupalDecoupled.sys_path = drupalDecoupled.sys_path.replace(/^\//, '');
|
||||
drupalDecoupled.url = window.location.pathname;
|
||||
drupalDecoupled.hash = window.location.hash;
|
||||
window.localStorage.setItem('decoupled_origin', JSON.stringify(drupalDecoupled));
|
||||
// redirect to home
|
||||
window.location.replace(window.location.origin);
|
||||
}else{
|
||||
console.log('history do not redirect');
|
||||
}
|
|
@ -2,8 +2,17 @@ import { createRouter, createWebHistory } from 'vue-router';
|
|||
import ModaleView from '../vuejs/Modale.vue';
|
||||
|
||||
const routes = [
|
||||
{ path: '/node/:id', component: ModaleView, name: 'modale' },
|
||||
{ path: '/', component: ModaleView, name: 'home' },
|
||||
{
|
||||
name: 'etape',
|
||||
path: '/etapes/:title?',
|
||||
component: ModaleView,
|
||||
props: {id: null}
|
||||
},
|
||||
{
|
||||
name: 'home',
|
||||
path: '/',
|
||||
component: ModaleView
|
||||
},
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
# redirect-js:
|
||||
# header: true
|
||||
# js:
|
||||
# assets/dist/scripts/redirect.min.js: { weight: -998, preprocess: false, minified: true }
|
||||
|
||||
# Main theme library.
|
||||
global:
|
||||
js:
|
||||
assets/dist/scripts/redirect.min.js: { weight: -998, preprocess: false, minified: true }
|
||||
assets/dist/main.js: {}
|
||||
# assets/js/main.js: {}
|
||||
css:
|
||||
|
@ -14,7 +20,12 @@ vitehmr:
|
|||
type: external
|
||||
attributes:
|
||||
type: module
|
||||
http://localhost:5173/assets/js/redirect.js:
|
||||
type: external
|
||||
attributes:
|
||||
type: module
|
||||
http://localhost:5173/assets/js/main.js:
|
||||
type: external
|
||||
attributes:
|
||||
type: module
|
||||
type: module
|
||||
|
|
@ -13,6 +13,7 @@ function caravane_page_attachments_alter(&$page) {
|
|||
// $page['#attached']['library'][] = 'http://localhost:5173/assets/js/main.js';
|
||||
$page['#attached']['library'][] = 'caravane/vitehmr';
|
||||
}else{
|
||||
// $page['#attached']['library'][] = 'caravane/redirect-js';
|
||||
$page['#attached']['library'][] = 'caravane/global';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,12 @@ export default defineConfig({
|
|||
build: {
|
||||
outDir: 'assets/dist',
|
||||
rollupOptions: {
|
||||
input: 'assets/js/main.js',
|
||||
input: {
|
||||
main: 'assets/js/main.js',
|
||||
redirect: 'assets/js/redirect'
|
||||
},
|
||||
output: {
|
||||
entryFileNames: 'main.js',
|
||||
entryFileNames: '[name].js',
|
||||
assetFileNames: 'main.css'
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue