Skip to content

Commit

Permalink
button to set the text area to the pretty version.
Browse files Browse the repository at this point in the history
  • Loading branch information
bleonard committed Jul 9, 2019
1 parent 7356bf6 commit 7a9c3bd
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/resque_bus/server/views/bus.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ if (agree)
else
return false ;
}

function setSample() {
var text = document.getElementById("query_attributes").textContent;
var textArea = document.getElementById('querytext');
textArea.value = text;
return false;
}
// -->
</script>

Expand Down Expand Up @@ -112,7 +119,7 @@ else
<p class='intro'>Enter JSON of an event to see applicable subscriptions.</p>
<div style="text-align: center;width:700px;">
<form method="GET" action="<%= u "bus" %>" style="float:none;padding:0;margin:0;">
<textarea name="query" style="padding: 10px;height:150px;width:700px;font-size:14px;font-family:monospace"><%=
<textarea id="querytext" name="query" style="padding: 10px;height:150px;width:700px;font-size:14px;font-family:monospace"><%=
h(query_string)
%></textarea>
<br/>
Expand All @@ -127,9 +134,12 @@ else
%></code></pre></blockquote>
<% end %>
<% if query_attributes %>
<blockquote><pre style="text-align:left;font-family:monospace;margin:5px 0 5px 0;padding:10px;background:#dff0d8;color:#3c763d;"><code><%=
<blockquote><pre style="text-align:left;font-family:monospace;margin:5px 0 5px 0;padding:10px;background:#dff0d8;color:#3c763d;"><code id="query_attributes"><%=
h(JSON.pretty_generate(query_attributes).strip)
%></code></pre></blockquote>
<div style="text-align:right;">
<button onclick="return setSample();">Set Sample</button>
</div>
<% end %>

<hr/>
Expand Down

0 comments on commit 7a9c3bd

Please sign in to comment.