-
Notifications
You must be signed in to change notification settings - Fork 17
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 content item links rules subgroups #1032
Conversation
54329f6
to
a0069b6
Compare
a0069b6
to
b38a83d
Compare
config/links_out.json
Outdated
@@ -0,0 +1,167 @@ | |||
{ |
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.
We could maybe represent this configuration in YAML instead of JSON?
Doing so would allow us to use Rails' built in mechanism to load configuration files.
module MyApp
class Application < Rails::Application
config.taxonomy_navigation_links_out = config_for(:taxonomy_navigation_links_out)
end
end
---
default: &default
content_purpose_supergroup:
news_and_communications:
- title: policy_and_engagement
type: content_purpose_supergroup
supergroup: policy_and_engagement
- title: research_and_data
type: content_purpose_subgroup
supergroup: transparency
- title: guidance
type: content_purpose_subgroup
supergroup: guidance_and_regulation
- title: news
type: content_purpose_subgroup
supergroup: news_and_communications
- title: incidents
type: content_purpose_subgroup
supergroup: transparency
guidance_and_regulation:
- title: services
type: content_purpose_supergroup
supergroup: services
- title: guidance
type: content_purpose_subgroup
supergroup: guidance_and_regulation
- title: news
type: content_purpose_subgroup
supergroup: news_and_communications
- title: decisions
type: content_purpose_subgroup
supergroup: transparency
- title: step_by_step
type: document_type
supergroup: services
services:
- title: services
type: content_purpose_supergroup
supergroup: services
- title: guidance
type: content_purpose_subgroup
supergroup: guidance_and_regulation
content_purpose_subgroup:
policy:
- title: policy_and_engagement
type: content_purpose_supergroup
supergroup: policy_and_engagement
- title: policy
type: content_purpose_subgroup
supergroup: policy_and_engagement
incidents:
- title: incidents
type: content_purpose_subgroup
supergroup: transparency
- title: news
type: content_purpose_subgroup
supergroup: news_and_communications
- title: research_and_data
type: content_purpose_supergroup
supergroup: transparency
- title: guidance
type: content_purpose_subgroup
supergroup: guidance_and_regulation
research_and_data:
- title: research_and_data
type: content_purpose_supergroup
supergroup: transparency
decisions:
- title: news
type: content_purpose_subgroup
supergroup: news_and_communications
- title: guidance
type: content_purpose_subgroup
supergroup: guidance_and_regulation
document_type:
fatality_notice: []
manual: []
manual_section: []
open_consultation:
- title: policy_and_engagement
type: content_purpose_supergroup
supergroup: policy_and_engagement
- title: decisions
type: content_purpose_subgroup
supergroup: transparency
closed_consultation:
- title: policy_and_engagement
type: content_purpose_supergroup
supergroup: policy_and_engagement
- title: decisions
type: content_purpose_subgroup
supergroup: transparency
consultation_outcome:
- title: decisions
type: content_purpose_subgroup
supergroup: transparency
development:
<<: *default
test:
<<: *default
production:
<<: *default
@@ -0,0 +1,107 @@ | |||
module ContentItem | |||
module LinksOut | |||
def links_out_supergroups |
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.
Should all these methods be added to the public interface of the class that includes this module?
end | ||
|
||
def any? | ||
[email protected]? |
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.
Should we use the public links
interface here since it implements a default?
We could maybe delegate the any?
method to the links object and initialise the default like so:
class LinkRule
extend Forwardable
def initialize(content_item)
@content_item = content_item
@rules = load_rules
@links = fetch_links || []
end
def_delegator :@links, :any?
# ...
end
902839c
to
c20318d
Compare
remove force b variant fixed json file fixed minor controller mistype Add links out to configure taxonomy navigation linting Filter content page navigation links by subgroups remove force b variant fixed json file started
c20318d
to
b549356
Compare
Extend content item navigation links to show content filtered by subgroups. Supersedes PR #1028 (add-content-item-links-rules)
Visual regression results:
https://government-frontend-pr-1032.surge.sh/gallery.html
Component guide for this PR:
https://government-frontend-pr-1032.herokuapp.com/component-guide
Trello card
https://trello.com/c/A55u68Xw/98-implement-ruleset-for-showing-navigation-in-government-frontend