-
Notifications
You must be signed in to change notification settings - Fork 7
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
Nested facets for admin form #3035
Open
lauraghiorghisor-tw
wants to merge
9
commits into
main
Choose a base branch
from
nested-facets-for-admin-form
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit enables the rendering of subfacet values from the schema. In the schema, a nested facet includes a `sub_facets` key with additional label-value pairs. As per this commit, the main facet's values and their subfacet's values are mapped to "blocks" of facets: - the first line is the main facet (which will slow as label only on a new form "Main Facet" and label-key on edit form "Main Facet{main-facet}") - subsequent rows include the subfacets in the same style: "Sub Facet", and "Sub Facet{sub-facet}" respectively. - each facet block is separated from the next by an empty line. The splitting of the allowed value text area string (see subsequent commits) required that I render the two new lines as "\r\n\r\n" - it basically means one **visible** blank line.
This commit prepares the views and permits controller params for passing values for nested facets. We require the name and key of a subfacet, which are here mixed one single input called subfacet. This value will be given as "Facet {key}", as we do elsewhere on the form.
This is to minimize difference in the schema diff, as well as offering the option in the admin UI.
The field `short_` should be before `special_`. This is to ensure we don't get unnecessary diffs when generating a schema in the admin area.
This is to ensure we don't get unnecessary diffs when generating a schema in the admin area.
This test was not running with the test suite as it was missing the _spec suffix. Other tests such as: - creating_a_data_ethics_guidance_document.rb - creating_a_product_safety_alert_report_recall.rb - creating_an_animal_disease_case.rb should also be renamed but will be deleted in a parallel PR so leaving them.
201b337
to
b440a73
Compare
There was a `Polynomial regular expression used on uncontrolled data` alert due to the potential length of the string on which we're then calling match. The fix is to truncate the string. The assumption here is that any such string would include a very long key, so the cropping includes an ending "}".
a448105
to
75fbcc8
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces the ability to add and edit nested facets in the admin form.
We decided to not do a full design for this feature, but provide a developer-readable solution as MVP.
Nested Facet
Show option select filter
Additionally, this PR includes a few clean-up commits to finish the IPO finder. Note in particular the introducing of the
show_option_select_filter
on the generated schema. This is an option we only use for Licence finder and Trademark Decisons. But it is handy to have it includes so that we don't get unnecessary diffs. It was required to pass the feature test added for Trademarks.It's also handy to have it as a viable option on the admin UI. This option enables the kind of search seen for Appointed person/ hearing officer here.
Trello