Skip to content
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

(703) Add Content Block guidance to Whitehall in non-production environments #2449

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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