Skip to content

Commit

Permalink
Merge pull request #1988 from alphagov/revert-1987-render-simple-smar…
Browse files Browse the repository at this point in the history
…t-answer-diagram

Revert "Create a new page for displaying SSA diagrams"
  • Loading branch information
anatron authored Dec 18, 2023
2 parents a2fa19e + e5f3efa commit e4aafeb
Show file tree
Hide file tree
Showing 10 changed files with 1,092 additions and 2,236 deletions.
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

0 comments on commit e4aafeb

Please sign in to comment.