-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1987 from alphagov/render-simple-smart-answer-dia…
…gram Create a new page for displaying SSA diagrams
- Loading branch information
Showing
10 changed files
with
2,236 additions
and
1,092 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//= require mermaid/dist/mermaid | ||
|
||
(function (Modules) { | ||
'use strict' | ||
|
||
Modules.SmartAnswerFlowchart = function () { | ||
this.start = function (element) { | ||
var diagram = element.find('.flowchart') | ||
var flowchartLoading = element.find('.flowchart__loading') | ||
|
||
// eslint-disable-next-line | ||
mermaid.initialize( | ||
{ | ||
startOnLoad: true, | ||
flowchart: { | ||
useMaxWidth: false | ||
} | ||
} | ||
) | ||
|
||
diagram.removeClass('flowchart--hidden') | ||
flowchartLoading.addClass('flowchart__loading--hidden') | ||
} | ||
} | ||
})(window.GOVUKAdmin.Modules) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.smart-answer-flowchart { | ||
.mermaid { | ||
background-color: #ffffff; | ||
} | ||
|
||
.flowchart--hidden, | ||
.flowchart__loading--hidden { | ||
display: none; | ||
} | ||
|
||
pre { | ||
word-break: normal; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<%= render 'shared/edition_header' %> | ||
|
||
<p> | ||
<%= link_to "Back to current edition", edition_path(@resource.history.first), :class => "btn btn-default" %> | ||
</p> | ||
|
||
<div class="smart-answer-flowchart" data-module="smart-answer-flowchart"> | ||
<pre class="mermaid flowchart flowchart--hidden"> | ||
<%= @resource.generate_mermaid %> | ||
</pre> | ||
|
||
<p class="flowchart__loading">Generating diagram ...</p> | ||
</div> | ||
|
||
<% content_for :page_title, "Diagram for #{@resource.title}" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.