Skip to content

Commit

Permalink
Strip the "editionable" prefix when displaying document type names
Browse files Browse the repository at this point in the history
We're adding support for editionable topical events. This requires us
to create a new content type that we've called "editionable_topical_events".
When displaying the name we should strip the editionable bit so it looks
nicer.
  • Loading branch information
JonathanHallam committed Dec 11, 2024
1 parent c5ebfd8 commit 8364ba4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/helpers/admin/new_document_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def new_document_type_list
.select { |edition_type| can?(:create, edition_type) }
.map do |edition_type|
title_value = edition_type.name.underscore
title_label = title_value.humanize
title_label = title_value.gsub("editionable_", "").humanize
{
value: title_value,
text: title_label,
Expand Down
4 changes: 4 additions & 0 deletions app/models/editionable_topical_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ class EditionableTopicalEvent < Edition
def display_type_key
"editionable_topical_event"
end

def self.format_name
"topical event"
end
end
2 changes: 1 addition & 1 deletion features/support/document_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def begin_drafting_document(options)
create(:organisation) if Organisation.count.zero?
visit admin_root_path
find("li.app-c-sub-navigation__list-item a", text: "New document").click
page.choose(options[:type].humanize)
page.choose(options[:type].gsub("editionable_", "").humanize)
click_button("Next")

if options[:locale]
Expand Down

0 comments on commit 8364ba4

Please sign in to comment.