Prevent double article submission on v1 editor (#1791)
This commit is contained in:
parent
81c889bc78
commit
09c82fe69e
1 changed files with 68 additions and 70 deletions
|
|
@ -2,7 +2,6 @@
|
||||||
<% if @article.errors.any? %>
|
<% if @article.errors.any? %>
|
||||||
<div id="error_explanation">
|
<div id="error_explanation">
|
||||||
<h2><%= pluralize(@article.errors.count, "error") %> prohibited this article from being saved:</h2>
|
<h2><%= pluralize(@article.errors.count, "error") %> prohibited this article from being saved:</h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% @article.errors.full_messages.each do |message| %>
|
<% @article.errors.full_messages.each do |message| %>
|
||||||
<li><%= message %></li>
|
<li><%= message %></li>
|
||||||
|
|
@ -130,16 +129,12 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="editor-help" class="editor-view editor-article-view hidden">
|
<div id="editor-help" class="editor-view editor-article-view hidden">
|
||||||
<%= render "pages/editor_guide_text", version: "1" %>
|
<%= render "pages/editor_guide_text", version: "1" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<%= javascript_include_tag 'lib/js-yaml', async: true %>
|
<%= javascript_include_tag 'lib/js-yaml', async: true %>
|
||||||
<%= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/postscribe/2.0.8/postscribe.min.js', async: true %>
|
<%= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/postscribe/2.0.8/postscribe.min.js', async: true %>
|
||||||
<%= javascript_include_tag 'https://embed.runkit.com', async: true %>
|
<%= javascript_include_tag 'https://embed.runkit.com', async: true %>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var html,parsed;
|
var html,parsed;
|
||||||
|
|
||||||
|
|
@ -368,7 +363,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let alreadySubmitted = false;
|
||||||
document.getElementsByClassName("submit")[0].onclick = function (e) {
|
document.getElementsByClassName("submit")[0].onclick = function (e) {
|
||||||
|
if (alreadySubmitted) return;
|
||||||
|
alreadySubmitted = true;
|
||||||
var butts = document.getElementsByClassName("editor-button");
|
var butts = document.getElementsByClassName("editor-button");
|
||||||
for(var i = 0; i < butts.length; i++) {
|
for(var i = 0; i < butts.length; i++) {
|
||||||
butts[i].classList.add("disabled");
|
butts[i].classList.add("disabled");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue