Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API/documentation #5582

Merged
merged 67 commits into from
Jan 31, 2020
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
bb327e2
refactor participatory spaces query_extensions by adding customizable…
microstudi Dec 13, 2019
b5b41cf
Add basic order type for participatory spaces
microstudi Dec 13, 2019
074da3f
add filter objects (wip)
microstudi Dec 13, 2019
fa069dd
add custom filters/orders for participatory processes
microstudi Dec 13, 2019
882ab7c
add generics filter/order for components search. Apply to proposals
microstudi Dec 15, 2019
02029f7
add reusable multiplanguage filters/orders. Apply in components
microstudi Dec 15, 2019
f0a6d39
add advanced settings json filter for components
microstudi Dec 15, 2019
3cc2d0a
refactor bare component classes
microstudi Dec 17, 2019
0f1b32e
fix creation of test_app by lazy instantiation model_class constantiz…
microstudi Dec 17, 2019
5bea9ef
refactor locale argument. use it only when needed
microstudi Dec 17, 2019
679e4f4
begin documentation. improve default design of graphql-docs.
microstudi Dec 16, 2019
63e77eb
gemfile app design
microstudi Dec 16, 2019
8d5e956
gemfile updates
microstudi Dec 17, 2019
e89da63
lint fixes
microstudi Dec 17, 2019
12af4f2
filter docs
microstudi Dec 17, 2019
ffdd1c0
section connections
microstudi Dec 17, 2019
099e922
add filters/orders notes
microstudi Dec 17, 2019
b66f8b1
gramar
microstudi Dec 17, 2019
54439bc
add generic api doc
microstudi Dec 17, 2019
bd251d0
changelog
microstudi Dec 17, 2019
75a7046
test fix
microstudi Dec 17, 2019
ff9d4de
lint
microstudi Dec 17, 2019
5c1a2e4
refactor participatory spaces query_extensions by adding customizable…
microstudi Dec 13, 2019
f1b92ac
Add basic order type for participatory spaces
microstudi Dec 13, 2019
32b1ced
add filter objects (wip)
microstudi Dec 13, 2019
567c7c7
add custom filters/orders for participatory processes
microstudi Dec 13, 2019
05ac9ff
add generics filter/order for components search. Apply to proposals
microstudi Dec 15, 2019
14f622b
add reusable multiplanguage filters/orders. Apply in components
microstudi Dec 15, 2019
ae7aa04
add advanced settings json filter for components
microstudi Dec 15, 2019
708f531
refactor bare component classes
microstudi Dec 17, 2019
02127d2
test for participatory space input sort and filter with publishable i…
davidbeig Dec 17, 2019
65c1925
fix creation of test_app by lazy instantiation model_class constantiz…
microstudi Dec 17, 2019
cdeb71c
refactor locale argument. use it only when needed
microstudi Dec 17, 2019
d84ac13
test for participatory process input sort and filter with hashtaggabl…
davidbeig Dec 17, 2019
d8e3afb
fix hashtag test
microstudi Dec 17, 2019
c34726b
fix tests based on shared examples for hashtaggable and publishable i…
davidbeig Dec 17, 2019
1b958aa
add spec for proposal input sort
davidbeig Dec 17, 2019
161579e
add spec for proposal input filter
davidbeig Dec 17, 2019
9440d83
rubocop
microstudi Dec 18, 2019
3a45182
first tests for component_input_filter
davidbeig Dec 18, 2019
d6b18e9
changelog
microstudi Dec 18, 2019
0e07196
add tests for component input filter
davidbeig Dec 18, 2019
9ba802f
fix tests
microstudi Dec 18, 2019
bf7a285
start tests for name in component_input_filter
davidbeig Dec 18, 2019
7c43f6a
finish test for component input filter and add tests for component in…
davidbeig Dec 18, 2019
8918b5a
rubocop offenses
davidbeig Dec 18, 2019
26f5c58
remove duplicated test
davidbeig Dec 18, 2019
9d72f1c
reorganize and clean tests
microstudi Dec 18, 2019
4d2fe09
fix proposal vote order test
microstudi Dec 19, 2019
4697249
Update decidim-core/app/functions/decidim/core/component_list.rb
microstudi Jan 17, 2020
b0853b6
mispelling
microstudi Jan 17, 2020
ef94060
fix changelog
microstudi Jan 17, 2020
7474b53
comment improvements
microstudi Jan 17, 2020
18b25a8
Merge branch 'master' into api/search
microstudi Jan 17, 2020
f5d3c70
Merge branch 'api/search' into api/documentation
microstudi Jan 17, 2020
2eee162
Merge branch 'master' into api/search
microstudi Jan 21, 2020
58f6563
be more specific using api class names
microstudi Jan 21, 2020
01df856
change name for locale filter/sort artifacts
microstudi Jan 21, 2020
9d22f64
Merge branch 'master' into api/search
tramuntanal Jan 22, 2020
fd027f4
Merge branch 'master' into api/search
microstudi Jan 31, 2020
7fbfa24
Merge branch 'api/search' into api/documentation
microstudi Jan 31, 2020
2cbd6e8
correct the usage text
microstudi Jan 31, 2020
83c387b
fix api.md description
microstudi Jan 31, 2020
92ef7a6
Merge branch 'master' into api/documentation
microstudi Jan 31, 2020
cbfe13e
Merge branch 'master' into api/documentation
microstudi Jan 31, 2020
39fe670
changelog fix
microstudi Jan 31, 2020
e4dace9
Merge branch 'master' into api/documentation
microstudi Jan 31, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Decidim::Blogs::Post.find_each(&:add_to_index_as_search_resource)

**Added**:

- **decidim-api**: Added documentation to use the API (newcomers friendly). [\#5582](https://github.com/decidim/decidim/pull/5582)
- **many modules**: Added all spaces and many entities to global search, see Upgrade notes for more detail. [\#5469](https://github.com/decidim/decidim/pull/5469)
- **decidim-core**: Add weight to categories and sort them by that field. [\#5505](https://github.com/decidim/decidim/pull/5505)
- **decidim-proposals**: Add: Additional sorting filters for proposals index. [\#5506](https://github.com/decidim/decidim/pull/5506)
Expand Down
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ PATH
graphiql-rails (~> 1.4, < 1.5)
graphql (~> 1.9)
rack-cors (~> 1.0)
redcarpet (~> 3.4)
sprockets-es6 (~> 0.9.2)
decidim-assemblies (0.20.0.dev)
decidim-core (= 0.20.0.dev)
Expand Down Expand Up @@ -405,7 +406,7 @@ GEM
graphiql-rails (1.4.11)
railties
sprockets-rails
graphql (1.9.14)
graphql (1.9.16)
hashdiff (1.0.0)
hashie (3.6.0)
highline (2.0.3)
Expand Down
61 changes: 61 additions & 0 deletions decidim-api/app/assets/stylesheets/decidim/api/docs.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
body{
max-width: 1200px;
}

.intro,
.info{
margin-left: 270px;
color: #333;
}

.info{
li{
margin-bottom: 1rem;
}

h3{
margin-top: 2em;
}
}

.version{
display: inline-block;
font-size: .8rem;
margin-right: 1rem;
padding: 3px 7px;
background: #f33;
border-radius: 10px;
margin-top: 5px;
color: white;
}

@media only screen and (max-width: 767px){
.intro,
.info{
margin: 10px;
}
}

code{
font-size: .8em;
background: #ddd;
padding: .1em;
}

pre{
padding: .5rem;
background: #f0f0f0;
border: 1px solid #e8e8e8;

code{
background: none;
}
}

blockquote{
border-left: 3px solid burlywood;
padding: .1em 0 .1em 1rem;
margin: 1rem 0;
background: #f9f7f5;
width: 100%;
}
24 changes: 24 additions & 0 deletions decidim-api/app/helpers/decidim/api/application_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

require "redcarpet"

module Decidim
module Api
# Custom helpers, scoped to the api engine.
#
module ApplicationHelper
def render_doc(file)
md_render File.read(File.join(File.dirname(__FILE__), "../../../../docs", "#{file}.md"))
end

def md_render(text)
text = Redcarpet::Markdown.new(markdown, autolink: true, tables: true, fenced_code_blocks: true).render(text)
text.html_safe
end

def markdown
@markdown ||= Redcarpet::Render::HTML.new
end
end
end
end
13 changes: 11 additions & 2 deletions decidim-api/app/views/decidim/api/documentation/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
<div style="text-align: center;">

<div class="intro">
<div class="version">Decidim <%= Decidim.version %></div>

<h1><%= current_organization.name %> API documentation</h1>
<%= link_to "Explore the API interactively with GraphiQL", graphiql_path %>
<% if defined?(graphiql_path) %>
<%= link_to "Explore the API interactively with GraphiQL", graphiql_path %>
<% end %>
</div>

<div class="info">
<%= render_doc("usage") %>
</div>

<div id="documentation"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<head>
<title><%= current_organization.name %> - API Documentation</title>
<%= javascript_include_tag "decidim/api/docs" %>
<%= stylesheet_link_tag "decidim/api/docs" %>
<style>
</style>
</head>
<body>
<%= yield %>
Expand Down
1 change: 1 addition & 0 deletions decidim-api/decidim-api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Gem::Specification.new do |s|
s.add_dependency "graphiql-rails", "~> 1.4", "< 1.5"
s.add_dependency "graphql", "~> 1.9"
s.add_dependency "rack-cors", "~> 1.0"
s.add_dependency "redcarpet", "~> 3.4"
s.add_dependency "sprockets-es6", "~> 0.9.2"

s.add_development_dependency "decidim-comments", Decidim::Api.version
Expand Down
Loading