Skip to content

Commit

Permalink
Merge pull request #30 from andreyzb/main
Browse files Browse the repository at this point in the history
 fix: Bugfixes - DS-640, DS-656, DS-657, DS-658
  • Loading branch information
podarok authored May 15, 2023
2 parents 237a60b + 551d71d commit 641b720
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 23 deletions.
13 changes: 10 additions & 3 deletions modules/openy_map_lb/assets/css/openy-map-lb.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/openy_map_lb/assets/js/map.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/openy_map_lb/assets/js/map.js.map

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions modules/openy_map_lb/assets/src/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,12 @@
this.distance_limit_el.on('change', $.proxy(this.apply_distance_limit, this));
this.amenities_filter_el.find('input[type=checkbox]').on('change', $.proxy(this.update_amenities_filters, this));

$('.amenities-group', this.amenities_filter_el).each(function (group) {
$('ul', group).on('show.bs.collapse', function () {
$('header i', group).removeClass('fa-plus').addClass('fa-times');
$('.amenities-group', this.amenities_filter_el).each(function (idx, group){
$('ul', this).on('show.bs.collapse', () => {
$('header i', this).removeClass('fa-plus').addClass('fa-times');
});
$('ul', group).on('hide.bs.collapse', function () {
$('header i', group).removeClass('fa-times').addClass('fa-plus');
$('ul', this).on('hide.bs.collapse', () => {
$('header i', this).removeClass('fa-times').addClass('fa-plus');
});
});
},
Expand Down Expand Up @@ -933,12 +933,12 @@
this.distance_limit_el.on('change', $.proxy(this.apply_distance_limit, this));
this.amenities_filter_el.find('input[type=checkbox]').on('change', $.proxy(this.update_amenities_filters, this));

$('.amenities-group', this.amenities_filter_el).each(function (group){
$('ul', group).on('show.bs.collapse', function (){
$('header i', group).removeClass('fa-plus').addClass('fa-times');
$('.amenities-group', this.amenities_filter_el).each(function (idx, group){
$('ul', this).on('show.bs.collapse', () => {
$('header i', this).removeClass('fa-plus').addClass('fa-times');
});
$('ul', group).on('hide.bs.collapse', function (){
$('header i', group).removeClass('fa-times').addClass('fa-plus');
$('ul', this).on('hide.bs.collapse', () => {
$('header i', this).removeClass('fa-times').addClass('fa-plus');
});
});
},
Expand Down
2 changes: 1 addition & 1 deletion modules/openy_map_lb/assets/src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "map.js",
"version": "1.0.1",
"version": "1.0.2",
"description": "Open Y LB map library",
"main": "map.js",
"scripts": {
Expand Down
9 changes: 8 additions & 1 deletion modules/openy_map_lb/assets/src/scss/openy-map-lb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,18 @@
padding-left: 30px;
}
.group-header {
font-family: var(--ylb-font-family-verdana);
font-size: 15px;
text-transform: uppercase;
font-size: 16px;
line-height: 26px;
margin-bottom: 21px;
}
ul {
margin-bottom: 20px;
}
header {
font-family: var(--ylb-font-family-verdana);
font-size: 15px;
position: relative;
@include media-breakpoint-up(md){
margin-bottom: 20px;
Expand Down Expand Up @@ -211,6 +214,10 @@
border-radius: 20px;
text-transform: none;
padding: 1px 15px;
margin-bottom: 15px;
@include media-breakpoint-down(sm){
margin-bottom: 30px;
}
input {
display: none;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/openy_map_lb/openy_map_lb.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Y Layout Builder - Open Y Map
type: module
description: Renders a map with locations. Provides Layout Builder block for Locations page.
core_version_requirement: ^8.8 || ^9 || ^10
version: 1.0.1
version: 1.0.2
package: 'YMCA Website Services'
dependencies:
- openy_map:openy_map
Expand Down
2 changes: 1 addition & 1 deletion modules/openy_map_lb/openy_map_lb.libraries.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
openy_map:
version: 1.0.1
version: 1.0.2
js:
assets/js/map.js: { preprocess: true }
css:
Expand Down
22 changes: 18 additions & 4 deletions modules/openy_map_lb/openy_map_lb.module
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* @file
* Module file.
*/

use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\node\NodeInterface;

/**
Expand Down Expand Up @@ -51,6 +54,17 @@ function openy_map_lb_preprocess_block__lb_openy_map(&$variables) {
$variables['content'] = $render;
}

/**
* Implements hook_ENTITY_TYPE_view_alter().
*/
function openy_map_lb_node_view_alter( array &$build, EntityInterface $entity, EntityViewDisplayInterface $display ) {
$activeTypes = \Drupal::configFactory()->get('openy_map.settings')->get('active_types');
$activeTypes = !empty($activeTypes) ? array_keys(array_filter($activeTypes)) : [];
if ($build['#view_mode'] == 'teaser' && $entity->hasField('field_location_coordinates') && in_array($entity->bundle(), $activeTypes)) {
$build['#cache']['contexts'][] = 'url.path.parent';
}
}

/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
Expand All @@ -62,12 +76,12 @@ function openy_map_lb_theme_suggestions_node_alter(array &$suggestions, array $v
// Check for active types.
$activeTypes = \Drupal::configFactory()->get('openy_map.settings')->get('active_types');
$activeTypes = !empty($activeTypes) ? array_keys(array_filter($activeTypes)) : [];
if (is_null($has_layout)) {
$current_page = Drupal::routeMatch()->getParameter('node');
$has_layout = ($current_page instanceof NodeInterface) && $current_page->hasField('layout_builder__layout');
}
// Add universal template for all location content type teasers.
if ($view_mode == 'teaser' && $node->hasField('field_location_coordinates') && in_array($node->bundle(), $activeTypes)) {
if (is_null($has_layout)) {
$current_page = Drupal::routeMatch()->getParameter('node');
$has_layout = ($current_page instanceof NodeInterface) && $current_page->hasField('layout_builder__layout');
}
if ($has_layout) {
$suggestions[] = 'node__location_type__lb_teaser';
}
Expand Down

0 comments on commit 641b720

Please sign in to comment.