From 5b78bee15181ed0c59ba5e8654661a5928808b36 Mon Sep 17 00:00:00 2001 From: Samuel Gordalina Date: Wed, 4 Jul 2012 16:31:06 +0200 Subject: [PATCH 1/2] Moved response headers above response body with a click to expand/shrink --- Resources/public/css/screen.css | 10 ++++++++++ Resources/views/layout.html.twig | 17 +++++++++++++++++ Resources/views/method.html.twig | 6 +++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Resources/public/css/screen.css b/Resources/public/css/screen.css index 430cc84..29857f1 100644 --- a/Resources/public/css/screen.css +++ b/Resources/public/css/screen.css @@ -1153,6 +1153,16 @@ body ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operatio overflow: auto; } +.result pre.to-shrink, +.result pre.to-expand { + cursor:pointer; +} + +.result pre.to-expand { + height: 1em; + overflow:hidden; +} + .tabs li { display: inline; float: left; diff --git a/Resources/views/layout.html.twig b/Resources/views/layout.html.twig index a1a3949..9b09969 100644 --- a/Resources/views/layout.html.twig +++ b/Resources/views/layout.html.twig @@ -198,6 +198,23 @@ e.preventDefault(); }); + $('.pane.sandbox').delegate('.to-expand, .to-shrink', 'click', function(e) { + var $headers = $(this).parents('.result').find('.headers'); + var $label = $(this).parents('.result').find('a.to-expand'); + + if ($headers.hasClass('to-expand')) { + $headers.removeClass('to-expand'); + $headers.addClass('to-shrink'); + $label.text('Shrink'); + } else { + $headers.removeClass('to-shrink'); + $headers.addClass('to-expand'); + $label.text('Expand'); + } + + e.preventDefault(); + }); + $('.pane.sandbox').on('click', '.add', function() { var html = $(this).parents('.pane').find('.tuple_template').html(); diff --git a/Resources/views/method.html.twig b/Resources/views/method.html.twig index a59857c..b813024 100644 --- a/Resources/views/method.html.twig +++ b/Resources/views/method.html.twig @@ -145,11 +145,11 @@

Request URL


 
+                

Response Headers [Expand]

+

+
                 

Response Body [Raw]


-
-                

Response Headers

-

             
         
       

From ba8d1ae8fc94b4a9facd6faf33bede9805795281 Mon Sep 17 00:00:00 2001
From: Samuel Gordalina 
Date: Wed, 4 Jul 2012 22:36:55 +0200
Subject: [PATCH 2/2] Corrected indentation

---
 Resources/views/layout.html.twig | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Resources/views/layout.html.twig b/Resources/views/layout.html.twig
index 9b09969..6afc12b 100644
--- a/Resources/views/layout.html.twig
+++ b/Resources/views/layout.html.twig
@@ -203,13 +203,13 @@
                 var $label = $(this).parents('.result').find('a.to-expand');
 
                 if ($headers.hasClass('to-expand')) {
-                  $headers.removeClass('to-expand');
-                  $headers.addClass('to-shrink');
-                  $label.text('Shrink');
+                    $headers.removeClass('to-expand');
+                    $headers.addClass('to-shrink');
+                    $label.text('Shrink');
                 } else {
-                  $headers.removeClass('to-shrink');
-                  $headers.addClass('to-expand');
-                  $label.text('Expand');
+                    $headers.removeClass('to-shrink');
+                    $headers.addClass('to-expand');
+                    $label.text('Expand');
                 }
 
                 e.preventDefault();