Skip to content

Commit 7a9c3bd

Browse files
committed
button to set the text area to the pretty version.
1 parent 7356bf6 commit 7a9c3bd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/resque_bus/server/views/bus.erb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ if (agree)
99
else
1010
return false ;
1111
}
12+
13+
function setSample() {
14+
var text = document.getElementById("query_attributes").textContent;
15+
var textArea = document.getElementById('querytext');
16+
textArea.value = text;
17+
return false;
18+
}
1219
// -->
1320
</script>
1421

@@ -112,7 +119,7 @@ else
112119
<p class='intro'>Enter JSON of an event to see applicable subscriptions.</p>
113120
<div style="text-align: center;width:700px;">
114121
<form method="GET" action="<%= u "bus" %>" style="float:none;padding:0;margin:0;">
115-
<textarea name="query" style="padding: 10px;height:150px;width:700px;font-size:14px;font-family:monospace"><%=
122+
<textarea id="querytext" name="query" style="padding: 10px;height:150px;width:700px;font-size:14px;font-family:monospace"><%=
116123
h(query_string)
117124
%></textarea>
118125
<br/>
@@ -127,9 +134,12 @@ else
127134
%></code></pre></blockquote>
128135
<% end %>
129136
<% if query_attributes %>
130-
<blockquote><pre style="text-align:left;font-family:monospace;margin:5px 0 5px 0;padding:10px;background:#dff0d8;color:#3c763d;"><code><%=
137+
<blockquote><pre style="text-align:left;font-family:monospace;margin:5px 0 5px 0;padding:10px;background:#dff0d8;color:#3c763d;"><code id="query_attributes"><%=
131138
h(JSON.pretty_generate(query_attributes).strip)
132139
%></code></pre></blockquote>
140+
<div style="text-align:right;">
141+
<button onclick="return setSample();">Set Sample</button>
142+
</div>
133143
<% end %>
134144

135145
<hr/>

0 commit comments

Comments
 (0)