Skip to content

Commit

Permalink
Merge pull request #9668 from alphagov/content-modelling/707-update-w…
Browse files Browse the repository at this point in the history
…hitehall-to-allow-insert-journey

(707) Add Content Block guidance to Whitehall in non-production environments
  • Loading branch information
pezholio authored Nov 28, 2024
2 parents aeef421 + 704dc45 commit bb2bc28
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/helpers/admin/sidebar_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ def simple_formatting_sidebar(options = {})
sidebar_content = []
sidebar_content << render("admin/editions/govspeak_help", options)
sidebar_content << render("admin/editions/style_guidance", options)
sidebar_content << render("admin/editions/content_block_guidance", options) if Flipflop.show_link_to_content_block_manager?
raw sidebar_content.join("\n")
end
end
6 changes: 6 additions & 0 deletions app/views/admin/editions/_content_block_guidance.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<h3 class="govuk-heading-m">Content block</h3>

<p class="govuk-body">
To create, edit and use standardised content, go to the
<%= link_to "Content Block Manager (opens in new tab)", content_block_manager.content_block_manager_root_path, class: "govuk-link", target: "_blank", rel: "noopener" %>.
</p>
1 change: 1 addition & 0 deletions config/features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
# description: "Take over the world."
feature :govspeak_visual_editor, description: "Enables a visual editor for Govspeak fields", default: false
feature :override_government, description: "Enables GDS Editors and Admins to override the government associated with a document", default: false
feature :show_link_to_content_block_manager, description: "Shows link to Content Block Manager from Whitehall editor", default: Whitehall.integration_or_staging?
end
32 changes: 32 additions & 0 deletions test/unit/app/helpers/admin/sidebar_helper_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require "test_helper"

class Admin::SidebarHelperTest < ActionView::TestCase
extend Minitest::Spec::DSL

before do
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:show_link_to_content_block_manager, content_block_enabled)
end

context "when #show_link_to_content_block_manager? is false" do
let(:content_block_enabled) { false }

it "does not include content block guidance" do
result = simple_formatting_sidebar
assert_includes result, "Formatting"
assert_includes result, "Use plain English"
assert_not_includes result, "Content block"
end
end

context "when #show_link_to_content_block_manager? is true" do
let(:content_block_enabled) { true }

it "includes content block guidance" do
result = simple_formatting_sidebar
assert_includes result, "Formatting"
assert_includes result, "Use plain English"
assert_includes result, "Content block"
end
end
end

0 comments on commit bb2bc28

Please sign in to comment.