Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Create a new page for displaying SSA diagrams" #1988

Merged
merged 1 commit into from
Dec 18, 2023
Merged
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
25 changes: 0 additions & 25 deletions app/assets/javascripts/modules/smart_answer_flowchart.js

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
// Pages
@import "downtime";
@import "smart_answer_builder";
@import "smart_answer_flowchart";

// GOVUK Design System
@import "govuk_publishing_components/all_components";
14 changes: 0 additions & 14 deletions app/assets/stylesheets/smart_answer_flowchart.scss

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/editions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,6 @@ def process_unpublish
end
end

def diagram
# [MT] TODO: What's the best way to handle requests for a diagram for a non-simple smart answer?
if @resource.format != "SimpleSmartAnswer"
render plain: "404 Not Found", status: :not_found
end
end

protected

def permitted_params(subtype: nil)
Expand Down
15 changes: 0 additions & 15 deletions app/views/editions/diagram.html.erb

This file was deleted.

6 changes: 0 additions & 6 deletions app/views/editions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@
<div class="tab-content add-top-margin">
<div role="tabpanel" class="tab-pane <% if active_tab.name == 'edit'%>active<% end %>" id="edit">
<div class="link-check-report col-md-4">
<% if @edition.class.to_s == "SimpleSmartAnswerEdition" %>
<p>
View the <%= link_to "flow diagram", diagram_edition_path(@edition) %>
</p>
<% end %>

<%= render 'link_check_reports/link_check_report', edition: @edition, report: @edition.latest_link_check_report %>

<% if @edition.class.to_s.in?(Edition::HAS_GOVSPEAK_FIELDS) %>
Expand Down
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
get "tagging", to: "editions#linking"
get "related_external_links", to: "editions#linking"
get "unpublish"
get "diagram"
post "duplicate"
post "update_tagging"
post "process_unpublish"
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"stylelint-config-gds": "^1.1.0"
},
"dependencies": {
"mermaid": "10.5.1",
"paste-html-to-govspeak": "^0.4.0"
},
"resolutions": {
Expand Down
54 changes: 0 additions & 54 deletions test/functional/editions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1032,32 +1032,6 @@ class EditionsControllerTest < ActionController::TestCase
assert_response :success
assert_not_nil assigns(:resource)
end

should "render a link to the diagram when edition is a simple smart answer" do
simple_smart_answer_artefact = FactoryBot.create(
:artefact,
slug: "my-simple-smart-answer",
kind: "guide",
name: "test",
owning_app: "publisher",
)
simple_smart_answer = SimpleSmartAnswerEdition.create!(
title: "test ssa",
panopticon_id: simple_smart_answer_artefact.id,
)

get :show, params: { id: simple_smart_answer.id }

assert_select ".link-check-report p", { text: "View the flow diagram" } do
assert_select "a[href=?]", diagram_edition_path(simple_smart_answer).to_s,
{ count: 1, text: "flow diagram" }
end
end

should "not render a link to the diagram when edition is not a simple smart answer" do
get :show, params: { id: @guide.id }
assert_select "p", { count: 0, text: "View the flow diagram" }
end
end

context "#admin" do
Expand Down Expand Up @@ -1230,32 +1204,4 @@ class EditionsControllerTest < ActionController::TestCase
assert_equal "Option One", question.options.first.label
end
end

context "#diagram" do
context "given a simple smart answer exists" do
setup do
@artefact = FactoryBot.create(:artefact, slug: "foo", name: "Foo", kind: "simple_smart_answer", owning_app: "publisher")
@edition = FactoryBot.create(:simple_smart_answer_edition, body: "blah", state: "draft", slug: "foo", panopticon_id: @artefact.id)
@edition.save!
end

should "render a diagram page for it" do
get :diagram, params: { id: @edition.id }

assert_response :success
assert_select "title", "Diagram for #{@edition.title} | GOV.UK Publisher"
end
end

context "given a non-simple smart answer exists" do
setup do
@welsh_guide = FactoryBot.create(:guide_edition, :welsh, :in_review)
end

should "return a 404" do
get :diagram, params: { id: @welsh_guide.id }
assert_response :not_found
end
end
end
end
Loading