Skip to content

1.7.0 release #622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 57 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d486f69
sets color for dialog backdrop and margin for dialog
markconroy Aug 6, 2024
f18e1fc
sets margin for dialog
markconroy Aug 6, 2024
c692733
Use shared Github workflows
stephen-cox Aug 6, 2024
65d36fa
Merge pull request #582 from localgovdrupal/fix/1.x/user-shared-workf…
stephen-cox Aug 8, 2024
c5be885
Merge pull request #583 from localgovdrupal/1.x
finnlewis Aug 13, 2024
ed97266
Adds a variable to let us print a token for replacement in the breadc…
rupertj Aug 13, 2024
f6865f2
Merge pull request #581 from localgovdrupal/fix/580/alert-banner-dialog
finnlewis Aug 13, 2024
d5d6c3c
Merge pull request #585 from localgovdrupal/feature/1.x/584-breadcrum…
markconroy Aug 15, 2024
cfc7d34
adds better focus orders for services button/menu
markconroy Aug 16, 2024
84432f1
feat: replaces standalone prev-next code with included version
ctorgalson Aug 21, 2024
e5752d6
fix: swaps double quotes for single quotes for project consistency
ctorgalson Aug 21, 2024
baf7610
Add tabindex -1 to skip link target
anthonylindsay Aug 22, 2024
8c73c11
Merge pull request #589 from anthonylindsay/202408_skiplink_tabindex
markconroy Aug 22, 2024
e9c9ea8
fix: ensures no colon rendered in prev/next links unless a title is set
ctorgalson Aug 22, 2024
34db467
feat: adds back-to-top link them setting and page variable
ctorgalson Aug 26, 2024
cfb9d31
feat: adds new back-to-top js, css, twig template and libraries entry
ctorgalson Aug 26, 2024
e7e4e8e
feat: places back-to-top include in page.html.twig
ctorgalson Aug 26, 2024
537cbac
feat: adds icon to back-to-top button
ctorgalson Aug 26, 2024
a356288
feat: completes css for back-to-top link
ctorgalson Aug 26, 2024
64bdd0e
Merge pull request #586 from localgovdrupal/fix/578-header-services-b…
markconroy Aug 26, 2024
d1da494
Merge pull request #588 from localgovdrupal/565_use_prev_next_twig_fo…
markconroy Aug 26, 2024
160e4f3
adds empty alt text for start icon button
markconroy Aug 26, 2024
02d8328
feat: explicitly set target dimensions to smallest possible
ctorgalson Aug 26, 2024
ad7bbb6
feat: re-hide the link on click
ctorgalson Aug 26, 2024
eafd219
feat: completes docs, moves various values to vars (anticipating SDC)
ctorgalson Aug 26, 2024
ba3707e
feat: makes default hidden attr value "until-found"
ctorgalson Aug 26, 2024
74f0c34
fix: matches project quote style
ctorgalson Aug 26, 2024
45fea15
fix: matches project quote style
ctorgalson Aug 26, 2024
810314f
feat: localgov_base override of book-navigation--publication.html.twig
ctorgalson Aug 26, 2024
d1c1699
Merge pull request #596 from localgovdrupal/564-use-prev-next-twig-fo…
markconroy Aug 28, 2024
a68d722
Merge branch '1.x' into 312-add-back-to-top-button
markconroy Aug 29, 2024
019e481
fixes typo
markconroy Aug 29, 2024
5149888
Merge pull request #595 from localgovdrupal/312-add-back-to-top-button
markconroy Aug 29, 2024
e6c8082
Merge pull request #594 from localgovdrupal/427/fix/stop-jaws-reading…
markconroy Sep 3, 2024
7238b24
feat: add expand/collapse icon to accordion
millnut Sep 14, 2024
8762135
feat: add expand/collapse icon to accordion
millnut Sep 14, 2024
bd084bf
fix: set color on service status heading
millnut Sep 14, 2024
a38be8c
hides guides/steps navigation in print mode
markconroy Sep 23, 2024
d33856e
adds CSS for blockquotes created via WYSIWYG
markconroy Sep 23, 2024
2b5da22
ensures quick fact content is inside a <p> tag
markconroy Sep 23, 2024
b2a1254
uses variable for accordion icon
markconroy Sep 23, 2024
dd2572f
adds more space for clickable area for pager items
markconroy Sep 23, 2024
928c53e
formatting code
markconroy Sep 24, 2024
1c66e02
adds alt text for map opening in new tab
markconroy Sep 24, 2024
a1362aa
Merge pull request #617 from localgovdrupal/fix/607/quick-fact-semantics
ekes Sep 24, 2024
2028da7
Merge pull request #616 from localgovdrupal/fix/611/blockquote-wysiwyg
ekes Sep 24, 2024
3833ab0
Merge pull request #615 from localgovdrupal/feature/614/hide-guides-s…
ekes Sep 24, 2024
66ec604
Merge pull request #603 from localgovdrupal/feature/1.x/add-expand-co…
ekes Sep 24, 2024
671d694
Merge pull request #619 from localgovdrupal/fix/618/page-target-area
ekes Sep 24, 2024
19a463a
Merge pull request #604 from localgovdrupal/fix/1.x/set-color-on-serv…
ekes Sep 24, 2024
77a749e
sticky header settings for localgov_base (#569)
markconroy Sep 24, 2024
aa313c9
Merge pull request #620 from localgovdrupal/fix/612/alt-text-service-…
markconroy Sep 24, 2024
d563ab4
Fixes #366 - text overlapping Guide Nav (#625)
mccrodp Oct 1, 2024
7ffc23a
Fix config schema error #629 (#630)
stephen-cox Oct 2, 2024
ae91066
removes localgov_base_helper module (#632)
markconroy Oct 15, 2024
0e70057
Adds support for facet forms (#634)
markconroy Oct 15, 2024
6b5cac7
Adds empty breadcrumbs block for use by microsites_base (#636)
markconroy Oct 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/install/localgov_base.settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ localgov_base_remove_css: FALSE
localgov_base_remove_js: FALSE
localgov_base_add_unpublished_background_colour: TRUE
localgov_base_add_draft_note_to_unpublished_content: FALSE
localgov_base_header_behaviour: 'default'
9 changes: 9 additions & 0 deletions config/schema/localgov_base.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,12 @@ localgov_base.settings:
localgov_base_add_draft_note_to_unpublished_content:
type: boolean
label: 'Add "[Draft]" to title of unpublished content.'
localgov_base_header_behaviour:
type: enum
label: 'Header behaviour'
description: 'Choose whether the header should be sticky or not.'
default: 'default'
options:
'default': 'Default - scrolls away with the page'
'sticky': 'Sticky - remains at the top of the page'
'appears_on_scroll': 'Scroll - appears when scrolling up'
15 changes: 15 additions & 0 deletions css/components/sticky-header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.sticky-header--sticky .lgd-header {
top: var(--lgd-sticky-header-position);
width: 100%;
z-index: 1000;
}

.sticky-header--sticky .lgd-header + * {
margin-top: calc(var(--lgd-sticky-header-position) + var(--lgd-sticky-header-height));
scroll-padding: var(--lgd-sticky-header-height);
}

.sticky-header-html,
.sticky-header--sticky {
scroll-padding-top: var(--lgd-sticky-header-height);
}
65 changes: 65 additions & 0 deletions js/sticky-header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
(function stickyHeaderScript(Drupal) {
Drupal.behaviors.stickyHeader = {
attach: function (context) {
const headers = once('allSticyHeaders', '.lgd-header', context);

if (!headers) {
return;
}

headers.forEach(header => {
function calculatePositions() {
let tabsHeight = 0;
const tabs = header.closest('body').querySelector('.lgd-region--tabs');
if (tabs) {
tabsHeight = tabs.offsetHeight;
}

let displaceOffsetTop = 0;
const displaceOffsetTopValue = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--drupal-displace-offset-top').replace('px', ''));
if (displaceOffsetTopValue) {
displaceOffsetTop = displaceOffsetTopValue;
}

const headerHeight = header.offsetHeight;
const headerPosition = displaceOffsetTop + tabsHeight;

if (header.closest('body').classList.contains('sticky-header')) {
document.documentElement.style.setProperty('--lgd-sticky-header-position', `${headerPosition}px`);
document.documentElement.style.setProperty('--lgd-sticky-header-height', `${headerHeight}px`);
}

if (header.closest('body').classList.contains('sticky-header--sticky')) {
header.style.position = 'fixed';
}
}

// Initialize oldScroll, so we can use it in the scroll event.
let oldScroll = window.scrollY;

function handleScroll() {
if (oldScroll > window.scrollY) {
header.closest('body').classList.add('sticky-header--sticky');
} else {
header.closest('body').classList.remove('sticky-header--sticky');
header.style.position = 'relative';
}
// Update oldScroll to the new scroll position after the comparison
oldScroll = window.scrollY;

calculatePositions();
}

if (header.closest('body').classList.contains('sticky-header--scroll')) {
window.addEventListener('scroll', handleScroll);
}

setTimeout(() => {
calculatePositions();
}, 50);

});

}
};
})(Drupal);
3 changes: 3 additions & 0 deletions localgov_base.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ ckeditor_stylesheets:
ckeditor5-stylesheets:
- css/base/ckeditor5.css

dependencies:
- localgov_base:localgov_base_helper

regions:
tabs: "Tabs"
header: "Header"
Expand Down
20 changes: 15 additions & 5 deletions localgov_base.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,14 @@ wysiwyg-styles:
theme:
css/components/wysiwyg-styles.css: {}

header:
css:
theme:
css/components/header.css: {}

secondary-menu:
css:
theme:
css/components/secondary-menu.css: {}
header:
css:
theme:
css/components/header.css: {}

header-js:
js:
Expand All @@ -67,6 +66,17 @@ header-js:
- core/drupal.debounce
- core/once

sticky-header:
css:
theme:
css/components/sticky-header.css: {}
js:
js/sticky-header.js: {}
dependencies:
- core/drupal
- core/drupal.debounce
- core/once

footer:
css:
theme:
Expand Down
41 changes: 40 additions & 1 deletion localgov_base.theme
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,52 @@ function localgov_base_form_system_theme_settings_alter(&$form, FormStateInterfa
'#default_value' => theme_get_setting('localgov_base_add_draft_note_to_unpublished_content'),
'#description' => t('This adds the word "Draft" to the title of any unpublished content. This is useful if you have removed the pink background from unpublished content.'),
];

$form['localgov_base_show_back_to_top_link'] = [
'#type' => 'checkbox',
'#title' => t('Display a "Back to Top" link on long pages.'),
'#default_value' => theme_get_setting('localgov_base_show_back_to_top_link'),
'#description' => t('This adds a link to the beginning of the page content (<code>#main-content</code>).'),
];
$form['localgov_base_header_behaviour'] = [
'#type' => 'radios',
'#title' => t('Header behaviour'),
'#default_value' => theme_get_setting('localgov_base_header_behaviour'),
'#options' => [
'default' => t('Default - scrolls away with the page'),
'sticky' => t('Sticky - remains at the top of the page'),
'appears_on_scroll' => t('Scroll - appears when scrolling up the page'),
],
'#description' => t('Select how you want the header to behave. This setting only apply to anonymous users.'),
];

}

/**
* Implements hook_preprocess_html().
*/
function localgov_base_preprocess_html(&$variables) {
// Add the 'sticky-header' library if the sticky header setting is enabled.
if (theme_get_setting('localgov_base_header_behaviour') !== 'default') {

// Check if the user is logged out.
// We have much fewer calculations if we keep this to anonymous users only.
if (\Drupal::currentUser()->isAnonymous()) {
$variables['#attached']['library'][] = 'localgov_base/sticky-header';
$variables['attributes']['class'][] = 'sticky-header';
$variables['html_attributes']['class'] = [];
$variables['html_attributes']['class'][] = 'sticky-header-html';

// If 'sticky' is chosen add a class to the body element.
if (theme_get_setting('localgov_base_header_behaviour') === 'sticky') {
$variables['attributes']['class'][] = 'sticky-header--sticky';
}

// If 'scroll' is chosen add a class to the body element.
if (theme_get_setting('localgov_base_header_behaviour') === 'appears_on_scroll') {
$variables['attributes']['class'][] = 'sticky-header--scroll';
}
}
}
}

/**
Expand Down
8 changes: 8 additions & 0 deletions modules/localgov_base_helper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## INTRODUCTION

The LocalGov Base Helper module is a module to allow us to add update hooks and other module functionality to LocalGov Base.

## INSTALLATION

Install as you would normally install a contributed Drupal module.
See: https://www.drupal.org/node/895232 for further information.
5 changes: 5 additions & 0 deletions modules/localgov_base_helper/localgov_base_helper.info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: 'LocalGov Base Helper'
type: module
description: 'Adds update hooks to LocalGov Base.'
package: LocalGov Drupal
core_version_requirement: ^10 || ^11
28 changes: 28 additions & 0 deletions modules/localgov_base_helper/localgov_base_helper.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/**
* @file
* Install, update and uninstall functions for LocalGov Base Helper.
*/

/**
* Implements hook_install().
*/
function localgov_base_helper_install() {
$theme_handler = \Drupal::service('theme_handler');
// Check if the 'localgov_base' theme is available.
if ($theme_handler->themeExists('localgov_base')) {
// Now, check if it is enabled.
// If not yet enabled, these settings will be taken from the theme's
// /config/install directory, instead of here.
$theme = $theme_handler->getTheme('localgov_base');
if ($theme->status) {
// The theme is installed and enabled, proceed to set the config.
$config = \Drupal::configFactory()->getEditable('theme.localgov_base.settings');
if ($config->get('localgov_base_header_behaviour') === NULL) {
$config->set('localgov_base_header_behaviour', 'default');
}
$config->save();
}
}
}
6 changes: 6 additions & 0 deletions modules/localgov_base_helper/localgov_base_helper.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

/**
* @file
* Primary module hooks for LocalGov Base Helper module.
*/
Loading