Skip to content

Commit

Permalink
Merge pull request #9696 from alphagov/content-modelling/change-edit-…
Browse files Browse the repository at this point in the history
…heading

Change header when editing
  • Loading branch information
pezholio authored Dec 4, 2024
2 parents 5d9f300 + 19d8c34 commit 14edf18
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
class ContentBlockManager::ContentBlock::EditionsController < ContentBlockManager::BaseController
def new
if params[:document_id]
@title = "Edit a content block"
@content_block_document = ContentBlockManager::ContentBlock::Document.find(params[:document_id])
@schema = ContentBlockManager::ContentBlock::Schema.find_by_block_type(@content_block_document.block_type)
content_block_edition = @content_block_document.latest_edition
else
@title = "Create a content block"
@schema = ContentBlockManager::ContentBlock::Schema.find_by_block_type(params[:block_type].underscore)
content_block_edition = ContentBlockManager::ContentBlock::Edition.new
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% content_for :context, "Create a content block" %>
<% content_for :context, @title %>
<% content_for :title, @form.title %>

<% content_for :back_link do %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class ContentBlockManager::ContentBlock::EditionsTest < ActionDispatch::Integrat
schema:,
).returns(form)

get content_block_manager.new_content_block_manager_content_block_document_edition_path(content_block_document)
visit content_block_manager.new_content_block_manager_content_block_document_edition_path(content_block_document)

assert_text "Edit a content block"
end
end

Expand All @@ -40,7 +42,9 @@ class ContentBlockManager::ContentBlock::EditionsTest < ActionDispatch::Integrat
schema:,
).returns(form)

get content_block_manager.new_content_block_manager_content_block_edition_path(block_type: "block-type")
visit content_block_manager.new_content_block_manager_content_block_edition_path(block_type: "block-type")

assert_text "Create a content block"
end
end
end
Expand Down

0 comments on commit 14edf18

Please sign in to comment.