Skip to content

Commit

Permalink
reading API base from Swagger config (part 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler committed Feb 2, 2017
1 parent f37ff64 commit 789747c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion api/v1/controller.xql
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ declare namespace xmldb="http://exist-db.org/xquery/xmldb";

(: Change this line to point at your local api module :)
import module namespace api="http://xquery.weber-gesamtausgabe.de/modules/api" at "../../modules/api.xqm";
import module namespace config="http://xquery.weber-gesamtausgabe.de/modules/config" at "../../modules/config.xqm";

import module namespace controller="http://xquery.weber-gesamtausgabe.de/modules/controller" at "../../modules/controller.xqm";

(: Change this line to point at your swagger config file :)
declare variable $local:swagger-config := json-doc('xmldb:exist:///db/apps/WeGA-WebApp/api/v1/swagger.json');
declare variable $local:swagger-config := json-doc($config:swagger-config-path);

(: Change this if you are using a different prefix for your module in line XX :)
declare variable $local:api-module-prefix as xs:string := 'api';
Expand Down
2 changes: 1 addition & 1 deletion api/v1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ <h1 data-template="lang:translate">openapiDocumentation</h1>
</div>
</div>
<div class="container paddingTopIcon paddingBottomIcon">
<div class="row swagger-section">
<div class="row swagger-section" data-template="app:inject-api-base">
<div class="col-md-12">
<div id="message-bar" class="swagger-ui-wrap" data-sw-translate="">&#160;</div>
<div id="swagger-ui-container" class="swagger-ui-wrap"/>
Expand Down
2 changes: 1 addition & 1 deletion resources/js/swagger.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$(function () {
var url = "http://localhost:8080/exist/apps/WeGA-WebApp/api/v1/swagger.json";
var url = $('.swagger-section').attr('data-api-base') + "/swagger.json";

hljs.configure({
highlightSizeThreshold: 5000
Expand Down
2 changes: 1 addition & 1 deletion templates/ajax/diaries.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="col-md-3 col-md-push-9">
<div>
<h2 data-template="lang:translate">calendar</h2>
<div id="datePicker" data-template="app:set-attr" data-template-attr="data-api-url" data-template-key="api-base" style="margin-bottom:4ex;"/>
<div id="datePicker" data-template="app:inject-api-base" style="margin-bottom:4ex;"/>
</div>
<!-- Facetten Filter-->
<div class="allFilter">
Expand Down
2 changes: 1 addition & 1 deletion templates/document.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h1 class="document" data-template="app:document-title">CARL MARIA VON WEBER AN
<div class="allFilter" data-template="facets:document-allFilter">
<div data-template="app:if-matches" data-template-key="docType" data-template-value="diaries">
<h2><a href="#datePicker" data-template="lang:translate" class="collapseSingle collapsed" data-toggle="collapse">calendar</a></h2>
<div class="panel-collapse collapse" id="datePicker" data-template="app:set-attr" data-template-attr="data-api-url" data-template-key="api-base"/>
<div class="panel-collapse collapse" id="datePicker" data-template="app:inject-api-base"/>
</div>
<div>
<h2><a href="#dokument" data-template="lang:translate" class="collapseSingle collapsed" data-toggle="collapse">document</a></h2>
Expand Down

0 comments on commit 789747c

Please sign in to comment.