Skip to content

Commit 0f5896d

Browse files
authored
Merge pull request #11451 from alphagov/remove-legacy-case-study-code-v2
Remove legacy case study code [WHIT-3250]
2 parents 2dca661 + 1aaff63 commit 0f5896d

69 files changed

Lines changed: 140 additions & 1384 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/controllers/admin/editions_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Admin::EditionsController < Admin::BaseController
66
before_action :clean_edition_parameters, only: %i[create update]
77
before_action :clear_scheduled_publication_if_not_activated, only: %i[create update]
88
before_action :clear_response_form_file_cache, only: %i[create update]
9-
before_action :find_edition, only: %i[show edit update revise diff confirm_destroy destroy update_bypass_id update_image_display_option features]
9+
before_action :find_edition, only: %i[show edit update revise diff confirm_destroy destroy update_bypass_id features]
1010
before_action :prevent_modification_of_unmodifiable_edition, only: %i[update]
1111
before_action :delete_absent_edition_organisations, only: %i[create update]
1212
before_action :build_national_exclusion_params, only: %i[create update]
@@ -33,7 +33,7 @@ def enforce_permissions!
3333
enforce_permission!(:create, edition_class || Edition)
3434
when "create"
3535
enforce_permission!(:create, @edition)
36-
when "edit", "update", "revise", "diff", "update_bypass_id", "update_image_display_option", "features"
36+
when "edit", "update", "revise", "diff", "update_bypass_id", "features"
3737
enforce_permission!(:update, @edition)
3838
when "destroy", "confirm_destroy"
3939
enforce_permission!(:delete, @edition)

app/helpers/admin/base_path_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)