diff --git a/app/views/apitome/docs/_all_examples.html.erb b/app/views/apitome/docs/_all_examples.html.erb index 51cb11e..7f2fa9f 100644 --- a/app/views/apitome/docs/_all_examples.html.erb +++ b/app/views/apitome/docs/_all_examples.html.erb @@ -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$/, '') %>
- <%= render partial: 'example', locals: { example: set_example(link), link: link } %> + <%= render partial: 'example', locals: { example: set_example(link).merge!(link: link) } %>
<% end %> diff --git a/app/views/apitome/docs/_example.html.erb b/app/views/apitome/docs/_example.html.erb index 22578bc..496e494 100644 --- a/app/views/apitome/docs/_example.html.erb +++ b/app/views/apitome/docs/_example.html.erb @@ -18,7 +18,7 @@

<%= t(:response, scope: :apitome) %>

<%- 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} %> diff --git a/app/views/apitome/docs/show.html.erb b/app/views/apitome/docs/show.html.erb index cf98692..22245a5 100644 --- a/app/views/apitome/docs/show.html.erb +++ b/app/views/apitome/docs/show.html.erb @@ -1,3 +1,3 @@

<%= example['resource'] %>

<%= 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]) } %>