-
Notifications
You must be signed in to change notification settings - Fork 194
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
(647) Support embed codes in inline preview #9635
(647) Support embed codes in inline preview #9635
Conversation
This fits better with the pattern we’ve established that makes Minitest a bit more Rspec-like
This will make it easier to get a representation of a particular edition
61ebdcc
to
6feae72
Compare
end | ||
|
||
def content_blocks | ||
@content_blocks ||= ContentBlockManager::ContentBlock::Edition.joins(:document).where( |
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.
This query would return all published Editions (of which there could be many per Document because we don't have a superseded
workflow) but I think we would only want the latest_edition
scope?
I'm wondering if the render
should belong to the Document, as the embed code isn't going to change throughout its lifecycle, so we will always only be referring to the live
content right?
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.
otherwise when you update an edition the changes wouldn't propagate to other content blocks, or am I misunderstanding?
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 on the latest edition scope. I did consider having it on the document, but I thought we might want to render draft blocks too (for example, when doing the in-app preview)
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 might want to render draft blocks too (for example, when doing the in-app preview)
ah yeah that's true... I guess as long as this service and the API only ever returns the live one then it will be ok, would be worth adding a Document with a couple of Editions in the test
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.
I've tweaked it so we have a current_versions
scope now, which ensures we're only querying the latest published editions.
This ensures we’re only querying editions that are the most current published version
6feae72
to
f5cfede
Compare
Although this will be used in Whitehall proper, it makes sense to have this namespaced under the ContentBlockManager
This updates `govspeak_to_admin_html` to call the new service on any generated HTML, so embed codes are transformed in the live preview.
f5cfede
to
50acb8b
Compare
https://trello.com/c/cbXSET85/647-investigate-inline-preview-in-whitehall
This updates the inline Govspeak preview within Whitehall to support embed codes. As we have the luxury of Whitehall being within the confines of Whitehall, it's fairly easy for us to use the
content_block_tools
gem to parse the Govspeak, pull out the references, fetch the content blocks and then replace the embed code with the rendered blocks.Screenshots
Raw Govspeak
Preview