Skip to content

Commit 7531dae

Browse files
committed
Remove legacy case study code
This commit removes legacy case study MVC: - model - views - controllers - factories - presenters It also removes lead image component related code, which will be moved into a seperate commit. This is currently a WIP.
1 parent 7eabff5 commit 7531dae

68 files changed

Lines changed: 141 additions & 1362 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/components/admin/edition_images/image_component.html.erb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,6 @@
3434
<div class="app-view-edition-resource__actions govuk-grid-column-full govuk-button-group govuk-!-margin-top-4">
3535
<%= link_to("Edit details", edit_admin_edition_image_path(edition, image), class: "govuk-link govuk-!-margin-top-2 app-view-edition-resource__actions__link") %>
3636
<%= link_to("Delete image", confirm_destroy_admin_edition_image_path(edition, image), class: "govuk-link gem-link--destructive govuk-!-margin-top-2 app-view-edition-resource__actions__link") %>
37-
38-
<% if can_be_used_as_case_study_lead_image? %>
39-
<%= form_with url: admin_edition_lead_image_path(edition, image), method: :patch do |form| %>
40-
<%= render "govuk_publishing_components/components/button", {
41-
text: "Select as lead image",
42-
secondary_solid: true,
43-
margin_bottom: 4,
44-
} %>
45-
<% end %>
46-
<% end %>
4737
</div>
4838
<% end %>
4939
</li>

app/components/admin/edition_images/image_component.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,4 @@ def image_markdown
2222
def find_image_index
2323
edition.images.find_index(image)
2424
end
25-
26-
def can_be_used_as_case_study_lead_image?
27-
edition.is_a?(CaseStudy) && image_usage.embeddable? && !image.svg? && !image.image_data.requires_crop?
28-
end
2925
end

app/components/admin/edition_images/lead_image_component.html.erb

Lines changed: 0 additions & 64 deletions
This file was deleted.

app/components/admin/edition_images/lead_image_component.rb

Lines changed: 0 additions & 70 deletions
This file was deleted.

app/controllers/admin/case_studies_controller.rb

Lines changed: 0 additions & 26 deletions
This file was deleted.

app/controllers/admin/edition_images_controller.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def toggle_default_lead_image_behaviour
3333
def destroy
3434
filename = image.image_data.carrierwave_image
3535
image.destroy!
36-
@edition.update_lead_image if @edition.is_a?(CaseStudy) # Legacy: remove when CaseStudy migrated to StandardEdition
3736
PublishingApiDocumentRepublishingJob.perform_async(@edition.document_id, false)
3837

3938
redirect_to admin_edition_images_path(@edition), notice: "#{filename} has been deleted"
@@ -98,7 +97,6 @@ def create
9897

9998
if @images.any? && @images.map(&:valid?).all?
10099
@images.each(&:save)
101-
@edition.update_lead_image if @edition.is_a?(CaseStudy) # Legacy: remove when CaseStudy migrated to StandardEdition
102100
@edition.update!(image_display_option: nil) if @image_usage.key == "lead"
103101
PublishingApiDocumentRepublishingJob.perform_async(@edition.document_id, false)
104102
flash.notice = "Images successfully uploaded"

app/controllers/admin/edition_lead_images_controller.rb

Lines changed: 0 additions & 41 deletions
This file was deleted.

app/helpers/admin/base_path_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Admin::BasePathHelper
44
MAPPINGS = [
55
{ "CallForEvidence" => "/government/calls-for-evidence" },
6-
{ "CaseStudy" => "/government/case-studies" },
6+
{ "StandardEdition" => "/government/case-studies" },
77
{ "Consultation" => "/government/consultations" },
88
{ "DetailedGuide" => "/guidance" },
99
{ "DocumentCollection" => "/government/collections" },
@@ -20,7 +20,7 @@ module Admin::BasePathHelper
2020
HTML_ATTACHMENT_PATH_REGEX = %r{
2121
\A/government/
2222
(?!statistics/announcements/) # exclude /government/statistics/announcements/...
23-
[^/]+ # section (e.g. calls-for-evidence, publications, case-studies, etc.)
23+
[^/]+ # section (e.g. calls-for-evidence, publications etc.)
2424
/[^/]+ # document slug
2525
/[^/]+ # attachment slug
2626
\z

app/helpers/admin/edition_actions_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def legacy_types_options(user)
6161
legacy_classes.map { |edition_type|
6262
next if edition_type == FatalityNotice && !user.can_handle_fatalities?
6363
next if edition_type == PlanForChangeLandingPage && !user.gds_admin?
64-
next if edition_type == CaseStudy
6564

6665
[edition_type.format_name.humanize.pluralize, edition_type.model_name.singular]
6766
}.compact

app/helpers/admin/republishing_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def bulk_content_type_metadata
8484
def republishable_content_types
8585
legacy_editionable_content_types = %w[
8686
CallForEvidence
87-
CaseStudy
8887
Consultation
8988
CorporateInformationPage
9089
DetailedGuide

0 commit comments

Comments
 (0)