Class: Ninetails::SectionTemplatesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ninetails/section_templates_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
# File 'app/controllers/ninetails/section_templates_controller.rb', line 4

def index
  templates = Rails.root.join("app", "components", "section_template").children.collect do |entry|
    entry.basename.to_s.sub(/(\..*)$/, '').classify
  end

  render json: { templates: templates }
end

#showObject



12
13
14
# File 'app/controllers/ninetails/section_templates_controller.rb', line 12

def show
  render json: "SectionTemplate::#{params[:id]}".safe_constantize.new.serialize
end