Skip to content

Commit c720276

Browse files
author
Hadrien Kohl
committed
Add a simple show more/show less link after the description
1 parent db48cf3 commit c720276

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/app/directives/raml-console.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
$scope.disableTitle = $attrs.hasOwnProperty('disableTitle');
2727
$scope.disableTryIt = $attrs.hasOwnProperty('disableTryIt');
2828
$scope.disableDescription = $attrs.hasOwnProperty('disableDescription');
29+
$scope.descriptionLimit = $attrs.hasOwnProperty('descriptionLimit') || 300;
2930
$scope.documentationCollapsed = $attrs.hasOwnProperty('documentationCollapsed');
3031
$scope.proxy = $window.RAML.Settings.proxy;
3132
$scope.readResourceTraits = readResourceTraits;

src/app/directives/raml-console.tpl.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66

77
<h1 ng-if="!disableTitle" class="raml-console-title">{{raml.title}}</h1>
88

9-
<div ng-if="!disableDescription" markdown="raml.description"></div>
9+
10+
<div ng-if="!disableDescription" ng-init="actualSize = descriptionLimit" >
11+
<div markdown="raml.description | limitTo : actualSize"></div>
12+
<span>
13+
<a ng-click="actualSize = descriptionLimit" ng-hide="raml.description.length > actualSize || raml.description.length < actualSize" style="cursor: default;">show less</a>
14+
<a ng-click="actualSize = raml.description.length" ng-hide="raml.description.length == actualSize" style="cursor: default;">show more</a>
15+
</span>
16+
</div>
1017

1118
<root-documentation></root-documentation>
1219

0 commit comments

Comments
 (0)