decidim-api 0.26.2 → 0.27.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/decidim/api/documentation_controller.rb +21 -0
- data/app/packs/entrypoints/decidim_api_docs.js +1 -26
- data/app/packs/entrypoints/decidim_api_docs.scss +1318 -0
- data/app/views/decidim/api/documentation/graphql_docs_template.html.erb +7 -0
- data/app/views/decidim/api/documentation/show.html.erb +2 -11
- data/app/views/decidim/api/graphiql/show.html.erb +3 -1
- data/app/views/layouts/decidim/api/documentation.html.erb +1 -4
- data/config/routes.rb +1 -0
- data/lib/decidim/api/schema.rb +3 -3
- data/lib/decidim/api/test/component_context.rb +2 -2
- data/lib/decidim/api/version.rb +1 -1
- data/lib/decidim/api.rb +17 -0
- data/lib/tasks/decidim_api_docs.rake +34 -0
- metadata +23 -28
- data/app/helpers/decidim/api/application_helper.rb +0 -24
- data/app/packs/stylesheets/decidim/api/docs.scss +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 346ea3a2f53b09f8ec29bfd65f2e25ee9110d5415ef47977ec14f489ab17e128
|
4
|
+
data.tar.gz: b58b069e865ce003b81193b1550d3f459efb66298cf0564de6381f1e07e54aac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed4f172559ec8f46e2cb7f928c724687f69e4676bc18ae6122a69ce5664d5c999a5c80079af2cbe5b15b0765b2bcd71413d69c47b202ed2f067a5548181c1404
|
7
|
+
data.tar.gz: 2eb6f79d2415137f75302aeb0cea18802c306bbbd6008682afca7b18e9d76af0a60375a1e8ed544570a10b82f0094b0ae3ab98a09e2c34b294641cb488de38d2
|
@@ -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
|
-
|
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";
|