diff --git a/app/controllers/public/api_controller.rb b/app/controllers/public/api_controller.rb index b7fffcd..cb1404f 100644 --- a/app/controllers/public/api_controller.rb +++ b/app/controllers/public/api_controller.rb @@ -2,12 +2,18 @@ class ApiController < PublicController no_design_blocks + helper_method :endpoints + def index - @api = Noosfero::API.api_class end def playground - @api = Noosfero::API.api_class + end + + private + + def endpoints + Noosfero::API::API.endpoints(environment) end end diff --git a/app/views/api/index.html.erb b/app/views/api/index.html.erb index bdce7c3..3e2e27d 100644 --- a/app/views/api/index.html.erb +++ b/app/views/api/index.html.erb @@ -4,7 +4,7 @@ <%= s_('api-playground|Try the %s') % link_to('API Playground', '/api/playground') %> -<%= @api.endpoints.map do |endpoint| +<%= endpoints.map do |endpoint| app = endpoint.options[:app].to_s unless app.blank? content_tag(:h2, app.split('::').last.to_s, title: app) + diff --git a/app/views/api/playground.html.erb b/app/views/api/playground.html.erb index c953da6..1d0cc57 100644 --- a/app/views/api/playground.html.erb +++ b/app/views/api/playground.html.erb @@ -2,7 +2,7 @@