Skip to content

Commit

Permalink
make tab ids unique to version
Browse files Browse the repository at this point in the history
  • Loading branch information
davidejones committed Feb 3, 2021
1 parent 575bd74 commit 975bcf3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion layouts/api/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ <h3 class="mt-2">{{ i18n "overview" }}</h3>
{{ partial "api/request-body.html" (dict "context" $dot "body" $endpoint.action.requestBody "resourcePage" $resourcePage "operationid" $endpoint.action.operationId "translate_action" $translate_action) }}

<!-- response -->
{{ partial "api/response.html" (dict "responses" $endpoint.action.responses "resourcePage" $resourcePage "operationid" $endpoint.action.operationId "translate_action" $translate_action) }}
{{ partial "api/response.html" (dict "responses" $endpoint.action.responses "resourcePage" $resourcePage "operationid" $endpoint.action.operationId "translate_action" $translate_action "version" $versionNum) }}

<!-- code example -->
{{ partial "api/code-example.html" (dict "context" $dot "resourcePage" $resourcePage "operationid" $endpoint.action.operationId "securitySchemes" $adat.components.securitySchemes "endpoint" $endpoint) }}
Expand Down
5 changes: 3 additions & 2 deletions layouts/partials/api/response.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{{ $operationid := .operationid }}
{{ $resourcePage := .resourcePage }}
{{ $translate_action := .translate_action }}
{{ $version := .version }}
{{ $s := newScratch }}

<h3 class="mt-3 mb-2">{{ i18n "response" }}</h3>
Expand All @@ -11,7 +12,7 @@ <h3 class="mt-3 mb-2">{{ i18n "response" }}</h3>
{{ $count := 0}}
{{ range $response_code, $response := $responses }}
<li class="nav-item">
<a class="nav-link mr-1 {{ if eq $count 0}}active{{end}}" href="#{{ $operationid }}-{{ $response_code }}" data-toggle="tab">{{ $response_code }}</a>
<a class="nav-link mr-1 {{ if eq $count 0}}active{{end}}" href="#{{ $operationid }}-{{ $response_code }}-{{ $version }}" data-toggle="tab">{{ $response_code }}</a>
</li>
{{ $count = add $count 1 }}
{{ end }}
Expand All @@ -25,7 +26,7 @@ <h3 class="mt-3 mb-2">{{ i18n "response" }}</h3>
{{ with $translate_action.responses }}
{{ $translate_action_response = (index $translate_action.responses $response_code) }}
{{ end }}
<div role="tabpanel" class="tab-pane {{ if eq $count 0}} active {{end}}" id="{{ $operationid }}-{{ $response_code }}">
<div role="tabpanel" class="tab-pane {{ if eq $count 0}} active {{end}}" id="{{ $operationid }}-{{ $response_code }}-{{ $version }}">
{{ with $response.content }}

<p class="mb-2">{{ $translate_action_response.description | default $response.description }}</p>
Expand Down

0 comments on commit 975bcf3

Please sign in to comment.