decidim-api 0.26.10 → 0.27.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b99462cbf4a9bec4e866f4aaa948da28611dec379c81b8fad6b17ab4fb9e627
4
- data.tar.gz: 16a18f9bc2d0491cf3f9f817fccf63b2f1ad74cbf661cb8e601d3b6a84fc0e57
3
+ metadata.gz: 375abae8676bbaa74f4c9154b1f5bd5054f11a8aea0e55dd24c95a8301194639
4
+ data.tar.gz: 40b74c9f85f075c6837bfbdc4b0b595ddac35d719aaef847e03154830e47acc8
5
5
  SHA512:
6
- metadata.gz: 2789a8f7362471e56c0dee743685d35e8a062dd19102190ff68e6eccc5cab9e1d11045f0ea879b3b33a97c18dccfa34d69c8f5445ecbb84bfd5ab7fef3f9b337
7
- data.tar.gz: 02f404231eb137c189f487c2a8b9583e64d9f38af28ec89b4297d3787b888572d5ea974083b40f86cc938f8c090890a3791fb734e535fe69ad8a2088ae5bd997
6
+ metadata.gz: 6c33a5d70f54b4c86a75bfdb632fdb3923fcf4123a24cf7600499e975192bf81a6348641161b07536dc149e24283a5f8b594358c86681dc8cdc7dc683aca80e4
7
+ data.tar.gz: deb1025710b486eb047c35b498b83db87497852cfacdfd6e2098de05351aaaacc4e77010851d55b8e758c42420f504b848b546cd0257d63c60ddf66303f2531f
@@ -6,6 +6,27 @@ module Decidim
6
6
  # the Schema to be executed, later returning the response as JSON.
7
7
  class DocumentationController < Api::ApplicationController
8
8
  layout "decidim/api/documentation"
9
+
10
+ helper_method :static_api_docs_content
11
+ before_action :set_cache_headers
12
+
13
+ private
14
+
15
+ def static_api_docs_content
16
+ render_to_string(File.join("static", "api", "docs", *safe_content_path, "index"), layout: false)
17
+ end
18
+
19
+ def safe_content_path
20
+ return "" unless params[:path]
21
+
22
+ params[:path].split("/").excluding("..", ".")
23
+ end
24
+
25
+ def set_cache_headers
26
+ response.headers["Cache-Control"] = "no-cache, no-store"
27
+ response.headers["Pragma"] = "no-cache"
28
+ response.headers["Expires"] = "Mon, 01 Jan 1990 00:00:00 GMT"
29
+ end
9
30
  end
10
31
  end
11
32
  end
@@ -1,26 +1 @@
1
- /* eslint-disable react/jsx-no-undef */
2
-
3
- import jQuery from "jquery"
4
- import { render } from "react-dom"
5
- import { GraphQLDocs } from "graphql-docs"
6
- import "stylesheets/decidim/api/docs.scss"
7
-
8
- const fetcherFactory = (path) => {
9
- return (query) => {
10
- return jQuery.ajax({
11
- url: path,
12
- data: JSON.stringify({ query }),
13
- method: "POST",
14
- contentType: "application/json",
15
- dataType: "json"
16
- });
17
- };
18
- }
19
-
20
- window.renderDocumentation = (path) => {
21
- render(
22
- <GraphQLDocs fetcher={fetcherFactory(path)} />,
23
- document.getElementById("documentation"),
24
- );
25
- };
26
-
1
+ import "entrypoints/decidim_api_docs.scss";