|
936 | 936 | $location.hash(hash); |
937 | 937 | $anchorScroll(); |
938 | 938 |
|
939 | | - var lines = jqXhr.responseText.split('\n').length; |
940 | | - var editorHeight = lines > 100 ? 2000 : 25*lines; |
| 939 | + // If the response fails because of CORS, responseText is null |
| 940 | + var editorHeight = 50; |
| 941 | + if (jqXhr.responseText) { |
| 942 | + var lines = jqXhr.responseText.split('\n').length; |
| 943 | + var editorHeight = lines > 100 ? 2000 : 25*lines; |
| 944 | + } |
941 | 945 |
|
942 | 946 | $scope.editorStyle = { |
943 | 947 | height: editorHeight + 'px' |
|
1246 | 1250 | var $panelContent = $panel.find('.raml-console-resource-panel-primary'); |
1247 | 1251 | var $sidebar = $panel.find('.raml-console-sidebar'); |
1248 | 1252 | var animation = 430; |
| 1253 | + var speed = 200; |
1249 | 1254 |
|
1250 | 1255 | if ((!$sidebar.hasClass('raml-console-is-fullscreen') && !$sidebar.hasClass('raml-console-is-collapsed')) || $sidebar.hasClass('raml-console-is-responsive')) { |
1251 | 1256 | animation = 0; |
1252 | 1257 | } |
1253 | 1258 |
|
1254 | 1259 | if ($scope.singleView) { |
1255 | 1260 | $panel.toggleClass('raml-console-has-sidebar-fullscreen'); |
| 1261 | + speed = 0; |
1256 | 1262 | } |
1257 | 1263 |
|
1258 | 1264 | $sidebar.velocity( |
1259 | 1265 | { width: animation }, |
1260 | 1266 | { |
1261 | | - duration: 200, |
| 1267 | + duration: speed, |
1262 | 1268 | complete: completeAnimation |
1263 | 1269 | } |
1264 | 1270 | ); |
1265 | 1271 |
|
1266 | 1272 | $panelContent.velocity( |
1267 | 1273 | { 'padding-right': animation }, |
1268 | 1274 | { |
1269 | | - duration: 200, |
| 1275 | + duration: speed, |
1270 | 1276 | complete: completeAnimation |
1271 | 1277 | } |
1272 | 1278 | ); |
|
1525 | 1531 | $this.toggleClass('raml-console-is-active'); |
1526 | 1532 | }; |
1527 | 1533 |
|
| 1534 | + $scope.toggleInverted = function ($event) { |
| 1535 | + var $section = jQuery($event.currentTarget) |
| 1536 | + .closest('.raml-console-resource-list-item') |
| 1537 | + .find('.raml-console-resource-list'); |
| 1538 | + |
| 1539 | + var $this = $section |
| 1540 | + .closest('.raml-console-resource-list-item') |
| 1541 | + .find('.raml-console-resource-root-toggle'); |
| 1542 | + |
| 1543 | + if ($section.hasClass('raml-console-is-collapsed')) { |
| 1544 | + $section.velocity('slideDown', { |
| 1545 | + duration: 200 |
| 1546 | + }); |
| 1547 | + } else { |
| 1548 | + $section.velocity('slideUp', { |
| 1549 | + duration: 200 |
| 1550 | + }); |
| 1551 | + } |
| 1552 | + |
| 1553 | + $section.toggleClass('raml-console-is-collapsed'); |
| 1554 | + $this.toggleClass('raml-console-is-active'); |
| 1555 | + }; |
| 1556 | + |
1528 | 1557 | $scope.collapseAll = function ($event) { |
1529 | 1558 | var $this = jQuery($event.currentTarget); |
1530 | 1559 |
|
@@ -5025,7 +5054,7 @@ angular.module('ramlConsoleApp').run(['$templateCache', function($templateCache) |
5025 | 5054 |
|
5026 | 5055 |
|
5027 | 5056 | $templateCache.put('directives/resource-panel.tpl.html', |
5028 | | - "<div class=\"raml-console-resource-panel\" ng-if=\"showPanel\" ng-class=\"{ 'raml-console-has-sidebar-fullscreen': singleView }\">\n" + |
| 5057 | + "<div class=\"raml-console-resource-panel\" ng-if=\"showPanel\" ng-class=\"{ 'raml-console-has-sidebar-collapsed': singleView }\">\n" + |
5029 | 5058 | " <div class=\"raml-console-resource-panel-wrapper\">\n" + |
5030 | 5059 | " <documentation></documentation>\n" + |
5031 | 5060 | "\n" + |
@@ -5114,7 +5143,7 @@ angular.module('ramlConsoleApp').run(['$templateCache', function($templateCache) |
5114 | 5143 |
|
5115 | 5144 |
|
5116 | 5145 | $templateCache.put('directives/sidebar.tpl.html', |
5117 | | - " <form name=\"form\" class=\"raml-console-sidebar\" novalidate ng-class=\"{ 'raml-console-is-fullscreen': singleView }\">\n" + |
| 5146 | + " <form name=\"form\" class=\"raml-console-sidebar\" novalidate ng-class=\"{ 'raml-console-is-collapsed': singleView }\">\n" + |
5118 | 5147 | " <div class=\"raml-console-sidebar-flex-wrapper\">\n" + |
5119 | 5148 | " <div class=\"raml-console-sidebar-content\">\n" + |
5120 | 5149 | " <header class=\"raml-console-sidebar-row raml-console-sidebar-header\">\n" + |
@@ -5360,7 +5389,9 @@ angular.module('ramlConsoleApp').run(['$templateCache', function($templateCache) |
5360 | 5389 | " <button class=\"raml-console-resource-root-toggle\" ng-class=\"{'raml-console-is-active': collapsed}\" ng-if=\"resourceGroup.length > 1\" ng-click=\"toggle($event)\"></button>\n" + |
5361 | 5390 | "\n" + |
5362 | 5391 | " <h2 class=\"raml-console-resource-heading raml-console-resource-heading-large\">\n" + |
5363 | | - " <span class=\"raml-console-resource-path-active\" ng-repeat='segment in resource.pathSegments'>{{segment.toString()}}</span>\n" + |
| 5392 | + " <a class=\"raml-console-resource-path-active\" ng-repeat='segment in resource.pathSegments' ng-if=\"resourceGroup.length > 1\" ng-click=\"toggleInverted($event)\">{{segment.toString()}}</a>\n" + |
| 5393 | + "\n" + |
| 5394 | + " <span class=\"raml-console-resource-path-active\" ng-repeat='segment in resource.pathSegments' ng-if=\"resourceGroup.length <= 1\">{{segment.toString()}}</span>\n" + |
5364 | 5395 | " </h2>\n" + |
5365 | 5396 | "\n" + |
5366 | 5397 | " <resource-type></resource-type>\n" + |
|
0 commit comments