-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Can now pass an arbitrary block to the inset-text component to have content rendered inset. If both 'text' and a block are provided, 'text' takes precedence (mutually exclusive). This is a compromise solution, rather than copying the inset-prompt component from content-publisher (for use in collections-publisher), for the reason that under current GOV.UK architecture the component CSS would be added to the stylesheets for our end users (not just the users using the publishing app). See: #1077 Once merged, we will use this latest inset-text component and manually recreate what the inset-prompt component looks like by passing components to the inset-text component as a block. Trello: https://trello.com/c/TcBpLRuC/48-add-inset-prompt-component-to-govukpublishingcomponents
- Loading branch information
1 parent
9f1d4d5
commit 2f046dc
Showing
3 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
7 changes: 5 additions & 2 deletions
7
app/views/govuk_publishing_components/components/_inset_text.html.erb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
<% | ||
id ||= "inset-text-#{SecureRandom.hex(4)}" | ||
%> | ||
|
||
<%= tag.div id: id, class: "gem-c-inset-text govuk-inset-text" do %> | ||
<%= text %> | ||
<% if defined? text %> | ||
<%= text %> | ||
<% elsif block_given? %> | ||
<%= yield %> | ||
<% end %> | ||
<% end %> |
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 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