diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb new file mode 100644 index 000000000..efb114bdc --- /dev/null +++ b/app/controllers/templates_controller.rb @@ -0,0 +1,5 @@ +class TemplatesController < ApplicationController + def show + @template = EcTemplate.find_by_name!(params[:name]) + end +end \ No newline at end of file diff --git a/app/views/templates/show.json.jbuilder b/app/views/templates/show.json.jbuilder new file mode 100644 index 000000000..cff89037b --- /dev/null +++ b/app/views/templates/show.json.jbuilder @@ -0,0 +1,3 @@ +json.template do + json.partial! 'attachments/attachment_simple', attachment: @template.attachments.last +end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 2c02c6a79..847afaa83 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -818,6 +818,7 @@ Rails.application.routes.draw do post :feedback end end + resource :template, only: [:show] end namespace :admins do