blob: c1d3153bf7ff2a5dfe7db90c1fce8e5b54d42957 [file] [log] [blame]
Nils Diewald02df9912014-06-03 16:08:07 +00001% use JSON::XS;
Nils Diewaldf2e02a92014-11-12 18:31:05 +00002% use Mojo::JSON;
Nils Diewald02df9912014-06-03 16:08:07 +00003
Nils Diewaldb40ddad2014-06-23 15:39:18 +00004% if (stash('search.query') && stash('test_port')) {
Nils Diewald7cad8402014-07-08 17:06:56 +00005% my $action;
6% if (param('action') && param('action') eq 'inspect') {
7% $action = ' active" style="cursor: default';
8% };
9% state $json = JSON::XS->new->allow_blessed->pretty->canonical(1);
10<pre class="query serial<%== $action // '' %>">
Nils Diewald44a72782014-06-20 16:03:21 +000011 <span>JSON-LD Serialization for <%= param 'q' %> (<%= param 'ql' %>)</span>
Nils Diewald7cad8402014-07-08 17:06:56 +000012 <code>
Nils Diewaldf2e02a92014-11-12 18:31:05 +000013%# Workaround to keep true, false, and null intact
14%= $json->encode($json->decode(Mojo::JSON::encode_json(stash('search.query'))))
Nils Diewald7cad8402014-07-08 17:06:56 +000015 </code>
16</pre>
17%= javascript begin
18hljs.initHighlightingOnLoad();
19% unless ($action) {
20$("pre.query.serial").on("click", function () {
21 $(this).toggleClass('active');
22});
23% };
24% end
Nils Diewald44a72782014-06-20 16:03:21 +000025% };