diff --git a/api_taster.gemspec b/api_taster.gemspec index 00820b2..e8d445d 100644 --- a/api_taster.gemspec +++ b/api_taster.gemspec @@ -18,6 +18,7 @@ Gem::Specification.new do |s| s.add_dependency 'jquery-rails' s.add_dependency 'sass-rails' s.add_dependency 'bootstrap-sass', '~> 2.0.3' + s.add_dependency 'redcarpet' s.add_development_dependency 'rake' s.add_development_dependency 'simplecov' diff --git a/app/controllers/api_taster/routes_controller.rb b/app/controllers/api_taster/routes_controller.rb index 47d8dcd..f17e8ae 100644 --- a/app/controllers/api_taster/routes_controller.rb +++ b/app/controllers/api_taster/routes_controller.rb @@ -11,6 +11,7 @@ def index def show @route = Route.find(params[:id]) @params = Route.params_for(@route) + @comment = Route.comment_for(params[:id]) end def missing_definitions diff --git a/app/helpers/api_taster/application_helper.rb b/app/helpers/api_taster/application_helper.rb index f7de1c7..194c161 100644 --- a/app/helpers/api_taster/application_helper.rb +++ b/app/helpers/api_taster/application_helper.rb @@ -1,4 +1,10 @@ +require 'redcarpet' + module ApiTaster module ApplicationHelper + def markdown(text) + markdown_renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML) + markdown_renderer.render(text).html_safe + end end end diff --git a/app/views/api_taster/routes/show.html.erb b/app/views/api_taster/routes/show.html.erb index 796ab6e..5716469 100644 --- a/app/views/api_taster/routes/show.html.erb +++ b/app/views/api_taster/routes/show.html.erb @@ -8,6 +8,13 @@ <% if @params.is_a?(Hash) && @params.has_key?(:undefined) %> <%= render 'undefined_route', :route => @params[:undefined] %> <% else %> + + <% if @comment %> +