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

fix returns displaying #635

Merged
merged 1 commit into from
Oct 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions app/views/apipie/apipies/_method_detail.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,22 @@
</tbody>
</table>
<% end %>
<% unless method[:returns].blank? %>
<%= heading(t('apipie.returns'), h_level) %>
<% method[:returns].each do |item| %>
<%= heading("#{t('apipie.code')}: #{item[:code]}", h_level + 1) %>
<table class='table'>
<thead>
<tr>
<th><%= t('apipie.param_name') %></th>
<th><%= t('apipie.description') %></th>
</tr>
</thead>
<tbody>
<%= render(:partial => "params", :locals => {:params => item[:returns_object]}) %>
</tbody>
</table>
<% end %>
<% end %>

<%= render(:partial => "headers", :locals => {:headers => method[:headers], :h_level => h_level }) %>
6 changes: 4 additions & 2 deletions app/views/apipie/apipies/_params.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
<%- if param[:validator].present? %>
<li><%= Apipie.markup_to_html(param[:validator]).html_safe %></li>
<%- end %>
<%- param[:validations].each do |item| %>
<li><%= item.html_safe %></li>
<%- if param[:validations].present? %>
<%- param[:validations].each do |item| %>
<li><%= item.html_safe %></li>
<%- end %>
<%- end %>
</ul>
<%- end %>
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ en:
api_documentation: API documentation
headers: Headers
header_name: Header name
code: Code
1 change: 1 addition & 0 deletions lib/apipie/method_description.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def to_json(lang=nil)
:full_description => Apipie.app.translate(@full_description, lang),
:errors => errors.map(&:to_json),
:params => params_ordered.map{ |param| param.to_json(lang) }.flatten,
:returns => @returns.map{ |return_item| return_item.to_json(lang) }.flatten,
:examples => @examples,
:metadata => @metadata,
:see => see.map(&:to_json),
Expand Down