Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions app/components/admin/currently_featured_tab_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,12 @@ def remaining
def table(caption, featured)
if features.present?
render Admin::Features::FeaturedDocumentsTableComponent.new(caption:, features: featured)
else
# Legacy
render Admin::TopicalEvents::Featurings::FeaturedDocumentsTableComponent.new(caption:, featurings: featured)
end
end

def reorder_path
if features.present?
reorder_admin_feature_list_path(features.first.feature_list)
else
# legacy
reorder_admin_topical_event_topical_event_featurings_path(featurings.first.topical_event)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ def title_row(feature)
def title(feature)
if feature.document&.live_edition.present?
feature
elsif feature.topical_event.present? # legacy
feature.topical_event
elsif feature.offsite_link.present?
feature.offsite_link
else
Expand All @@ -52,8 +50,6 @@ def type_row(feature)
def type(feature)
if feature.document&.live_edition.present?
"#{feature.document.live_edition.display_type} (document)"
elsif feature.topical_event.present?
"Topical Event"
elsif feature.offsite_link.present?
"#{feature.offsite_link.humanized_link_type} (offsite link)"
else
Expand All @@ -76,8 +72,6 @@ def actions_row(feature)
def edit_link(feature)
if feature.document&.live_edition.present?
link_to(sanitize("Edit #{tag.span(feature, class: 'govuk-visually-hidden')}"), admin_edition_path(feature.document.live_edition), class: "govuk-link")
elsif feature.topical_event.present? # legacy
link_to(sanitize("Edit #{tag.span(feature.topical_event, class: 'govuk-visually-hidden')}"), edit_admin_topical_event_path(feature.topical_event), class: "govuk-link")
elsif feature.offsite_link.present?
link_to(sanitize("Edit #{tag.span(feature.offsite_link, class: 'govuk-visually-hidden')}"), polymorphic_path([:edit, :admin, feature.offsite_link.parent, feature.offsite_link]), class: "govuk-link")
else
Expand All @@ -86,7 +80,7 @@ def edit_link(feature)
end

def unfeature_link(feature)
if feature.document&.live_edition.present? || feature.topical_event.present? || feature.offsite_link.present?
if feature.document&.live_edition.present? || feature.offsite_link.present?
link_to(sanitize("Unfeature #{tag.span(title(feature), class: 'govuk-visually-hidden')}"), confirm_unfeature_admin_feature_list_feature_path(feature.feature_list, feature), class: "gem-link--destructive govuk-!-margin-left-2")
else
""
Expand Down
13 changes: 0 additions & 13 deletions app/components/admin/organisations/show/summary_list_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def rows
recruitment_url_row,
political_row,
parent_organisations_row,
topical_events_row, # legacy
featured_links_position_row,
featured_links_row,
foi_exempt_row,
Expand Down Expand Up @@ -193,13 +192,6 @@ def parent_organisations_row
associations_rows(parent_organisations, "Sponsoring organisation")
end

# legacy
def topical_events_row
return if topical_events.blank?

associations_rows(topical_events, "Topical event")
end

def featured_links_position_row
{
field: "Featured link position",
Expand Down Expand Up @@ -259,11 +251,6 @@ def parent_organisations
@parent_organisations ||= organisation.parent_organisations
end

# legacy
def topical_events
@topical_events ||= organisation.topical_events
end

def featured_links
@featured_links ||= organisation.featured_links
end
Expand Down

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions app/controllers/admin/editions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ def permitted_edition_attributes
world_location_ids: [],
worldwide_organisation_ids: [],
topic_ids: [],
topical_event_ids: [], # LEGACY
topical_event_document_ids: [], # New
topical_event_document_ids: [],
related_detailed_guide_ids: [],
role_appointment_ids: [],
statistical_data_set_document_ids: [],
Expand Down
8 changes: 1 addition & 7 deletions app/controllers/admin/features_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Admin::FeaturesController < Admin::BaseController
before_action :find_feature_list
before_action :build_feature, only: %i[new create]
before_action :find_edition, :find_topical_event, :find_offsite_link, only: [:new]
before_action :find_edition, :find_offsite_link, only: [:new]

def new; end

Expand Down Expand Up @@ -47,7 +47,6 @@ def feature_params
params.fetch(:feature, {}).permit(
:alt_text,
:document_id,
:topical_event_id, # LEGACY
:offsite_link_id,
image_attributes: %i[file],
)
Expand All @@ -57,11 +56,6 @@ def find_edition
@feature.document = Edition.find(params[:edition_id]).document if params[:edition_id]
end

# LEGACY
def find_topical_event
@feature.topical_event = TopicalEvent.find(params[:topical_event_id]) if params[:topical_event_id]
end

def find_offsite_link
@feature.offsite_link = OffsiteLink.find(params[:offsite_link_id]) if params[:offsite_link_id]
end
Expand Down
13 changes: 2 additions & 11 deletions app/controllers/admin/offsite_links_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def destroy
def load_parent
@parent = WorldLocation.friendly.find(params[:world_location_news_id]).world_location_news if params[:world_location_news_id]
@parent = Organisation.friendly.find(params[:organisation_id]) if params[:organisation_id]
@parent = TopicalEvent.friendly.find(params[:topical_event_id]) if params[:topical_event_id] # Legacy
@parent = Edition.find(params[:standard_edition_id]) if params[:standard_edition_id]
end

Expand All @@ -53,19 +52,11 @@ def load_offsite_link
end

def offsite_link_path(offsite_link)
if offsite_link.parent.is_a? TopicalEvent # legacy
polymorphic_path([:admin, offsite_link.parent, :topical_event_featurings])
else
polymorphic_url([:features, :admin, offsite_link.parent])
end
polymorphic_url([:features, :admin, offsite_link.parent])
end

def offsite_links_path
if @parent.is_a? TopicalEvent #  legacy
polymorphic_path([:admin, @parent, :topical_event_featurings], anchor: "non_govuk_government_links_tab")
else
polymorphic_path([:features, :admin, @parent], anchor: "non_govuk_government_links_tab")
end
polymorphic_path([:features, :admin, @parent], anchor: "non_govuk_government_links_tab")
end

def offsite_link_params
Expand Down
25 changes: 0 additions & 25 deletions app/controllers/admin/organisations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def features
)

@filter = Admin::EditionFilter.new(Edition, current_user, filter_params)
@featurable_topical_events = TopicalEvent.active #  legacy
@featurable_offsite_links = @organisation.offsite_links

render :features
Expand All @@ -56,7 +55,6 @@ def features
def edit; end

def update
delete_absent_topical_event_organisations
if @organisation.update(organisation_params)
redirect_to admin_organisation_path(@organisation), notice: "Organisation updated successfully."
else
Expand Down Expand Up @@ -116,32 +114,10 @@ def organisation_params
default_news_image_attributes: %i[file file_cache id],
organisation_roles_attributes: %i[id ordering],
parent_organisation_ids: [],
topical_event_organisations_attributes: %i[topical_event_id ordering id _destroy],
featured_links_attributes: %i[title url _destroy id],
)
end

def build_topical_event_organisations
n = @organisation.topical_event_organisations.count
@organisation.topical_event_organisations.each.with_index do |ot, i|
ot.ordering = i
end
(n...13).each do |i|
@organisation.topical_event_organisations.build(ordering: i)
end
end

def delete_absent_topical_event_organisations
return unless organisation_params &&
organisation_params[:topical_event_organisations_attributes]

organisation_params[:topical_event_organisations_attributes].each do |p|
if p[:topical_event_id].blank?
p["_destroy"] = true
end
end
end

def build_organisation
@organisation = Organisation.new
end
Expand All @@ -151,7 +127,6 @@ def load_organisation
end

def build_dependencies
build_topical_event_organisations
@organisation.build_default_news_image if @organisation.default_news_image.blank?
@organisation.featured_links.build if @organisation.featured_links.blank?
end
Expand Down
45 changes: 0 additions & 45 deletions app/controllers/admin/topical_event_about_pages_controller.rb

This file was deleted.

Loading