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
Add in-page filtering to implementation record #4532
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, LGTM 👍
This is irrelevant to this PR, but the Cookies
link in the footer 404's on the analytics page, as it's trying to go to /analytics/cookies
instead of /cookies
. Thought it might be worth fixing in this PR but I'm happy for it to be a separate PR that one of us does.
source/javascripts/filter-list.js
Outdated
return | ||
} | ||
|
||
this.$module.input.addEventListener('input', function (e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: since e
is never used, does it need to be defined here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, have removed.
source/javascripts/filter-list.js
Outdated
FilterList.prototype.init = function () { | ||
// find the input element | ||
this.$module.input = this.$module.nodeName === 'INPUT' ? this.$module : this.$module.querySelector('input') | ||
if(!this.$module.input) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: standardx
would add a space between if(
here. E.g. if (!this.$module.input) {
Slightly off topic, but we could add standardx
to this repo by running yarn add standardx
and then adding this to the package.json
- but I guess as it's not a part of the CI it would only be useful for devs.
"standardx": {
"ignore": []
},
"eslintConfig": {
"rules": {
"no-var": 0
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have changed. Yeah, standardx could be useful, let's think about it for a separate PR.
- forgot to update this as part of the move to put analytics on the whole of the dev docs, not just the implementation record
28f67d9
to
713c005
Compare
@AshGDS have fixed following your comments and fixed the cookies link in the footer - good spot, thanks. |
What
Adds filters to pages on the GA4 implementation record to allow users to 'search' through lists of events and attributes.
I've tried to write the script as generically as possible so it can be applied to other things if needed. It's written as a GOVUK module, so is initialised by the modules script in the gem. It uses data attributes on the list of things to filter. For the list of events by type I've extended the script to check for titles and items, and hide the titles if all of the items in that section are hidden. I've also included the name of the event in a hidden span to improve the filtering (if you're searching for the title, it matches the children, e.g. the
select_content
events aren't actually called that, but if you search for that you'll find them).I'm not entirely happy with this code for a few reasons, but it might be the best we can manage for now. Specifically:
/component_guide
because it relates to that, but scripts in there aren't available to import from the gem currently.Why
Part of a number of changes to improve the usability of the implementation record.
Visual changes
Trello card: https://trello.com/c/m6vL7lJy/186-add-filters-to-events-and-attributes-pages-on-implementation-record