Skip to content

Commit

Permalink
Merge pull request #2449 from alphagov/content-modelling/703-update-m…
Browse files Browse the repository at this point in the history
…ainstream-publisher-to-allow-insert-journey

(703) Add Content Block guidance to Whitehall in non-production environments
  • Loading branch information
pezholio authored Dec 2, 2024
2 parents 5dabee7 + 7400b3b commit 868b971
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/views/legacy_editions/_content_block_guidance.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<h3 class="remove-top-margin add-bottom-margin">Content block</h3>

<div class="well">
<p>
To create, edit and use standardised content, go to the
<%= link_to "Content Block Manager (opens in new tab)", "#{Plek.external_url_for('whitehall-admin')}/content-block-manager", target: "_blank", rel: "noopener" %>.
</p>
</div>
4 changes: 4 additions & 0 deletions app/views/legacy_editions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
<div class="well">
<%= render "shared/govspeak_help" %>
</div>

<% if Flipflop.show_link_to_content_block_manager? %>
<%= render "content_block_guidance" %>
<% end %>
<% end %>
</div>

Expand Down
4 changes: 4 additions & 0 deletions config/features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@
feature :restrict_access_by_org,
default: false,
description: "Restrict access to editions based on the user's org and which org(s) own the edition"

feature :show_link_to_content_block_manager,
default: %w[integration staging].include?(ENV["GOVUK_ENVIRONMENT"]),
description: "Shows link to Content Block Manager from Mainstream editor"
end
26 changes: 26 additions & 0 deletions test/integration/edition_edit_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,32 @@ class EditionEditTest < IntegrationTest
end
end
end

context "content block guidance" do
context "when show_link_to_content_block_manager? is false" do
setup do
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:show_link_to_content_block_manager, false)
visit_draft_edition
end

should "not show the content block guidance" do
assert_not page.has_text?("Content block")
end
end

context "when show_link_to_content_block_manager? is true" do
setup do
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:show_link_to_content_block_manager, true)
visit_draft_edition
end

should "show the content block guidance" do
assert page.has_text?("Content block")
end
end
end
end

private
Expand Down

0 comments on commit 868b971

Please sign in to comment.