Skip to content

Commit

Permalink
fix(shs-5963): fix js files and libraries naming
Browse files Browse the repository at this point in the history
  • Loading branch information
cienvaras committed Dec 4, 2024
1 parent 8bbc525 commit 2be0832
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 84 deletions.
2 changes: 1 addition & 1 deletion docroot/modules/humsci/hs_layouts/hs_layouts.layouts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ three_column:
template: layouts/three-column/three-column
default_region: main
class: '\Drupal\hs_layouts\Plugin\Layout\HumsciLayout'
library: hs_layouts/verticaltabs
library: hs_layouts/vertical-tabs
icon_map:
- [sidebar_first, main, sidebar_second]
regions:
Expand Down
2 changes: 1 addition & 1 deletion docroot/modules/humsci/hs_layouts/hs_layouts.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ images_loaded:
dependencies:
- core/jquery

verticaltabs:
vertical-tabs:
js:
js/vertical-tabs.js: {}
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion docroot/themes/humsci/humsci_basic/humsci_basic.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package: 'Humanities & Sciences'
core_version_requirement: ^9.4 || ^10
'base theme': stable9
libraries:
- humsci_basic/maincontentfallback
- humsci_basic/main-content-fallback
- humsci_basic/editoria11y

regions:
Expand Down
54 changes: 27 additions & 27 deletions docroot/themes/humsci/humsci_basic/humsci_basic.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ addtocal:
js:
dist/js/addtocal.js: {}

carouselslidesheight:
carousel-slides-height:
js:
dist/js/carouselslidesheight.js: {}
dist/js/carousel-slides-height.js: {}

colorbox:
js:
Expand All @@ -18,57 +18,57 @@ editoria11y:
js:
dist/js/editoria11y.js: {}

equalheightgrid:
equal-height-grid:
js:
dist/js/equalheightgrid.js: {}
dist/js/equal-height-grid.js: {}

linkedcards:
linked-cards:
js:
dist/js/linkedcards.js: {}
dist/js/linked-cards.js: {}

maincontentfallback:
main-content-fallback:
js:
dist/js/maincontentfallback.js: {}
dist/js/main-content-fallback.js: {}

mainmenu:
main-menu:
js:
dist/js/mainmenutoggle.js: {}
dist/js/mainmenunestedtoggler.js: {}
dist/js/collapsemainmenu.js: {}
dist/js/megamenu.js: {}
dist/js/main-menu-toggle.js: {}
dist/js/main-menu-nested-toggler.js: {}
dist/js/collapse-main-menu.js: {}
dist/js/mega-menu.js: {}

pagescrollanimations:
page-scroll-animations:
js:
dist/js/pagescrollanimations.js: {}
dist/js/page-scroll-animations.js: {}

preferedreducedmotion:
prefered-reduced-motion:
js:
dist/js/preferedreducedmotion.js: {}
dist/js/prefered-reduced-motion.js: {}

search:
js:
dist/js/search.js: {}

secondarymenu:
secondary-menu:
js:
dist/js/secondarytoggler.js: {}
dist/js/secondary-toggler.js: {}

tablepattern:
table-pattern:
js:
dist/js/tablepattern.js: {}
dist/js/table-pattern.js: {}

tablescope:
table-scope:
js:
dist/js/tablescope.js: {}
dist/js/table-scope.js: {}

tablewrap:
table-wrap:
js:
dist/js/tablewrap.js: {}
dist/js/table-wrap.js: {}

timeline:
js:
dist/js/timeline.js: {}

videowithcaption:
video-with-caption:
js:
dist/js/videowithcaption.js: {}
dist/js/video-with-caption.js: {}
15 changes: 7 additions & 8 deletions docroot/themes/humsci/humsci_basic/humsci_basic.theme
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ function _humsci_basic_check_link_access(array &$link_items) {
}
}


/**
* Implements hook_preprocess_HOOK() for we_megamenu li.
*/
Expand Down Expand Up @@ -220,8 +219,8 @@ function humsci_basic_preprocess_we_megamenu_frontend(&$vars) {
*/
function humsci_basic_preprocess_views_view(&$variables) {
$view = $variables['view'];
$variables['#attached']['library'][] = 'humsci_basic/tablewrap';
$variables['#attached']['library'][] = 'humsci_basic/tablepattern';
$variables['#attached']['library'][] = 'humsci_basic/table-wrap';
$variables['#attached']['library'][] = 'humsci_basic/table-pattern';

switch ($view->id()) {
case 'hs_default_search':
Expand All @@ -235,9 +234,9 @@ function humsci_basic_preprocess_views_view(&$variables) {
*/
function humsci_basic_preprocess_paragraph(&$variables) {
$paragraph = $variables['paragraph'];
// Attach library to stanford gallery
// Attach library to stanford gallery.
if ($paragraph->bundle() == 'stanford_gallery') {
$variables['#attached']['library'][] = 'humsci_basic/preferedreducedmotion';
$variables['#attached']['library'][] = 'humsci_basic/prefered-reduced-motion';
$variables['#attached']['library'][] = 'humsci_basic/colorbox';
}
if ($paragraph->bundle() != 'hs_view') {
Expand All @@ -263,9 +262,9 @@ function humsci_basic_preprocess_paragraph(&$variables) {
*/
function humsci_basic_preprocess_field(&$variables) {
if ($variables['field_name'] == 'field_hs_text_area') {
$variables['#attached']['library'][] = 'humsci_basic/tablewrap';
$variables['#attached']['library'][] = 'humsci_basic/tablescope';
$variables['#attached']['library'][] = 'humsci_basic/videowithcaption';
$variables['#attached']['library'][] = 'humsci_basic/table-wrap';
$variables['#attached']['library'][] = 'humsci_basic/table-scope';
$variables['#attached']['library'][] = 'humsci_basic/video-with-caption';
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* @ingroup themeable
*/
#}
{{ attach_library('humsci_basic/equalheightgrid') }}
{{ attach_library('humsci_basic/equal-height-grid') }}

{% set raised_cards = false %}
{% if paragraph.field_raised_cards.value == true %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* @ingroup themeable
*/
#}
{{ attach_library('humsci_basic/equalheightgrid') }}
{{ attach_library('humsci_basic/equal-height-grid') }}

{%
set classes = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{ attach_library('humsci_basic/pagescrollanimations') }}
{{ attach_library('humsci_basic/page-scroll-animations') }}

{% include '@humsci_basic/components/paragraph.html.twig' %}
{% include '@humsci_basic/components/paragraph.html.twig' %}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{ attach_library('humsci_basic/linkedcards') }}
{{ attach_library('humsci_basic/linked-cards') }}

{% include '@hs_layouts/date-stacked-vertical-card/date-stacked-vertical-card.html.twig' %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ attach_library('humsci_basic/pagescrollanimations') }}
{{ attach_library('humsci_basic/carouselslidesheight') }}
{{ attach_library('humsci_basic/preferedreducedmotion') }}
{{ attach_library('humsci_basic/page-scroll-animations') }}
{{ attach_library('humsci_basic/carousel-slides-height') }}
{{ attach_library('humsci_basic/prefered-reduced-motion') }}

{% include '@hs_layouts/gradient-hero/gradient-hero.html.twig' %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ attach_library('humsci_basic/pagescrollanimations') }}
{{ attach_library('humsci_basic/carouselslidesheight') }}
{{ attach_library('humsci_basic/preferedreducedmotion') }}
{{ attach_library('humsci_basic/page-scroll-animations') }}
{{ attach_library('humsci_basic/carousel-slides-height') }}
{{ attach_library('humsci_basic/prefered-reduced-motion') }}

{% include '@hs_layouts/hero-text-overlay/hero-text-overlay.html.twig' %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ attach_library('humsci_basic/carouselslidesheight') }}
{{ attach_library('humsci_basic/preferedreducedmotion') }}
{{ attach_library('humsci_basic/carousel-slides-height') }}
{{ attach_library('humsci_basic/prefered-reduced-motion') }}

{% include '@hs_layouts/spotlight/spotlight.html.twig' %}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{ attach_library('humsci_basic/linkedcards') }}
{{ attach_library('humsci_basic/linked-cards') }}

{% include '@hs_layouts/vertical-card/vertical-card.html.twig' %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ attach_library('humsci_basic/linkedcards') }}
{{ attach_library('humsci_basic/linked-cards') }}

{% include '@hs_layouts/vertical-link-card/vertical-link-card.html.twig' %}

Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
*/
#}

{{ attach_library('humsci_basic/mainmenu') }}
{{ attach_library('humsci_basic/main-menu') }}

{% if use_hs_megamenu %}
{# Twig megamenu attributes #}
{% set attributes = attributes.addClass(['megamenu', 'js-megamenu']) %}
{% set attributes = attributes.setAttribute('aria-label', 'main menu') %}
{% include "@humsci_basic/menus-twig/secondary-menu.twig" %}

{% else %}
{% else %}
{# Legacy Drupal menu #}
{% set attributes = attributes.addClass(['hb-main-nav', 'su-main-nav', 'hb-main-nav--is-still-loading']) %}
{% set attributes = attributes.setAttribute('aria-label', 'main menu') %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{# The main and only way it is used on the site now is to create secondary nav #}
{%- import "@humsci_basic/menus/macros/secondary-nav-menu.twig" as menus -%}

{{ attach_library('humsci_basic/secondarymenu') }}
{{ attach_library('humsci_basic/secondary-menu') }}

{% apply spaceless %}
{% if items is iterable %}
Expand Down
28 changes: 14 additions & 14 deletions docroot/themes/humsci/humsci_basic/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ const srcDir = path.resolve(__dirname, 'src/js/');
const shared = {
accordion: 'shared/accordion/accordion-toggle-all.js',
addtocal: 'shared/addtocal/addtocal.js',
pagescrollanimations: 'shared/animation/page-scroll.js',
carouselslidesheight: 'shared/carousel-slides/carousel-slides-height.js',
'page-scroll-animations': 'shared/animation/page-scroll.js',
'carousel-slides-height': 'shared/carousel-slides/carousel-slides-height.js',
editoria11y: 'shared/editoria11y/editoria11y.js',
equalheightgrid: 'shared/equal-height-grid/index.js',
linkedcards: 'shared/linked-cards/linked-cards.js',
maincontentfallback: 'shared/main-content-fallback/main-content-fallback.js',
videowithcaption: 'shared/media/video-with-caption.js',
'equal-height-grid': 'shared/equal-height-grid/index.js',
'linked-cards': 'shared/linked-cards/linked-cards.js',
'main-content-fallback': 'shared/main-content-fallback/main-content-fallback.js',
'video-with-caption': 'shared/media/video-with-caption.js',
megamenu: 'shared/megamenu/index.js',
mainmenutoggle: 'shared/navigation/main-menu-toggle.js',
mainmenunestedtoggler: 'shared/navigation/main-menu-nested-toggler.js',
collapsemainmenu: 'shared/navigation/collapse-main-menu.js',
secondarytoggler: 'shared/navigation/secondary-toggler.js',
'main-menu-toggle': 'shared/navigation/main-menu-toggle.js',
'main-menu-nested-toggler': 'shared/navigation/main-menu-nested-toggler.js',
'collapse-main-menu': 'shared/navigation/collapse-main-menu.js',
'secondary-toggler': 'shared/navigation/secondary-toggler.js',
colorbox: 'shared/photo-album/colorbox.js',
preferedreducedmotion: 'shared/prefered-reduced-motion/prefered-reduced-motion.js',
'prefered-reduced-motion': 'shared/prefered-reduced-motion/prefered-reduced-motion.js',
search: 'shared/search/search-expand.js',
tablescope: 'shared/tables/scope.js',
tablepattern: 'shared/tables/table-pattern.js',
tablewrap: 'shared/tables/wrap.js',
'table-scope': 'shared/tables/scope.js',
'table-pattern': 'shared/tables/table-pattern.js',
'table-wrap': 'shared/tables/wrap.js',
timeline: 'shared/timeline/expand-collapse-timeline.js',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ function su_humsci_gin_admin_preprocess(&$variables, $hook) {
*/
function su_humsci_gin_admin_preprocess_field(&$variables) {
if ($variables['field_name'] == 'field_hs_text_area') {
$variables['#attached']['library'][] = 'humsci_basic/tablewrap';
$variables['#attached']['library'][] = 'humsci_basic/tablescope';
$variables['#attached']['library'][] = 'humsci_basic/videowithcaption';
$variables['#attached']['library'][] = 'humsci_basic/table-wrap';
$variables['#attached']['library'][] = 'humsci_basic/table-scope';
$variables['#attached']['library'][] = 'humsci_basic/video-with-caption';
}
}

Expand All @@ -70,9 +70,9 @@ function su_humsci_gin_admin_preprocess_field(&$variables) {
*/
function su_humsci_gin_admin_preprocess_paragraph(&$variables) {
$paragraph = $variables['paragraph'];
// Attach library to stanford gallery
// Attach library to stanford gallery.
if ($paragraph->bundle() == 'stanford_gallery') {
$variables['#attached']['library'][] = 'humsci_basic/preferedreducedmotion';
$variables['#attached']['library'][] = 'humsci_basic/prefered-reduced-motion';
$variables['#attached']['library'][] = 'humsci_basic/colorbox';
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ attach_library('humsci_basic/carouselslidesheight') }}
{{ attach_library('humsci_basic/preferedreducedmotion') }}
{{ attach_library('humsci_basic/carousel-slides-height') }}
{{ attach_library('humsci_basic/prefered-reduced-motion') }}

<div class="paragraph-admin-preview">
<div{{wrapper_attributes}}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ attach_library('humsci_basic/carouselslidesheight') }}
{{ attach_library('humsci_basic/preferedreducedmotion') }}
{{ attach_library('humsci_basic/carousel-slides-height') }}
{{ attach_library('humsci_basic/prefered-reduced-motion') }}

<div class="paragraph-admin-preview">
<div{{wrapper_attributes.addClass('paragraph-item', 'ptype-hs-hero-image')}}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ attach_library('humsci_basic/carouselslidesheight') }}
{{ attach_library('humsci_basic/preferedreducedmotion') }}
{{ attach_library('humsci_basic/carousel-slides-height') }}
{{ attach_library('humsci_basic/prefered-reduced-motion') }}

<div class="paragraph-admin-preview">
<div{{wrapper_attributes.addClass('paragraph-item', 'ptype-hs-spotlight')}}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ attach_library('humsci_basic/linkedcards') }}
{{ attach_library('humsci_basic/linked-cards') }}

<div class="paragraph-admin-preview">
<div{{wrapper_attributes.addClass('paragraph-item', 'ptype-hs-postcard')}}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ attach_library('humsci_basic/linkedcards') }}
{{ attach_library('humsci_basic/linked-cards') }}

<div class="paragraph-admin-preview">
<div{{wrapper_attributes.addClass('paragraph-item', 'ptype-hs-postcard')}}>
Expand Down

0 comments on commit 2be0832

Please sign in to comment.