Skip to content

Commit

Permalink
Fixes an issue with simulated links not working in multiple pages mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
jejacks0n committed Apr 13, 2019
1 parent f690932 commit 21e817e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/views/apitome/docs/_all_examples.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<%= render partial: 'resource_explanation', locals: { explanation: resource['explanation'] } if resource['explanation'] %>
<% resource['examples'].each do |example| %>
<% link = example['link'].gsub('.json', '') %>
<% link = example['link'].gsub(/.json$/, '') %>
<article id="<%= id_for(link) %>">
<%= render partial: 'example', locals: { example: set_example(link), link: link } %>
<%= render partial: 'example', locals: { example: set_example(link).merge!(link: link) } %>
</article>
<% end %>
</section>
Expand Down
2 changes: 1 addition & 1 deletion app/views/apitome/docs/_example.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<h3><%= t(:response, scope: :apitome) %></h3>
<div class="response">
<%- if Apitome.configuration.simulated_response %>
<%= link_to('Simulated Response', simulated_path(link)) unless link.empty? %>
<%= link_to('Simulated Response', simulated_path(example[:link])) if example[:link].present? %>
<%- end %>
<%= render partial: 'apitome/docs/response_fields', locals: {params: example['response_fields']} if example['response_fields'].size > 0 %>
<%= render partial: 'apitome/docs/status', locals: {request: request, index: index} %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/apitome/docs/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<h1 class="resource-name"><%= example['resource'] %></h1>
<%= render partial: 'resource_explanation', locals: { explanation: example['resource_explanation'] } if example['resource_explanation'] %>
<%= render partial: 'example', example: example, link: example['link'].to_s.gsub('.json', '') %>
<%= render partial: 'example', locals: { example: example.merge!(link: params[:path]) } %>

0 comments on commit 21e817e

Please sign in to comment.