Skip to content
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

added collapsible contents block #217

Open
wants to merge 6 commits into
base: 1.x
Choose a base branch
from

Conversation

josh-webcurl
Copy link

What does this change?

Adds a collapsible contents block to LocalGov publication pages.

Copy link
Member

@rupertj rupertj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this Josh. There's a few things that'll need to change before we could merge this. I've added some comments to the MR.

const menuCollapseBreakpoint = 992;

var headers = [
$('.bfc-publication-navigation__content-header', context),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like some Bracknell forest specific code.

*/
Drupal.behaviors.publicationMenuToggle = {
attach: function(context) {
const menuCollapseBreakpoint = 992;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this value correct for every LGD site? If not, it'll need to be configurable somehow, or done another way.

});
}
headers.forEach(function(header, index) {
if (!header.data('menuToggleAttached')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it's re-inventing once. Could it use once instead?

@@ -15,3 +15,54 @@
}
};
})(jQuery, Drupal);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this code should be inside the closure that the existing JS code defines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I've just realised the existing code is only for admin pages. This new code should probably be in its own file and library definition.

header.data('menuToggleAttached', true);
}
});
initializeStateForMenus();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need a way to make this feature optional. It can be defaulted to on for new installs, but we can't enable it by default for existing sites.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be achieved by adding a toggle in the block config for setting enabled/disabled?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that seems like a sensible approach.

@josh-webcurl
Copy link
Author

Thank you for your insight @rupertj, I will review and improve this based on the suggestions provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants