Class: LatoCms::Api::PagesController

Inherits:
ActionController::API
  • Object
show all
Defined in:
app/controllers/lato_cms/api/pages_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
10
11
# File 'app/controllers/lato_cms/api/pages_controller.rb', line 7

def index
  pages = LatoCms::Page.for_lato_spaces_group(@lato_spaces_group_id).order(title: :asc)
  pages = pages.where(locale: params[:locale]) if params[:locale].present?
  render json: pages.map(&:as_json)
end

#showObject



13
14
15
16
# File 'app/controllers/lato_cms/api/pages_controller.rb', line 13

def show
  @page.fields.load
  render json: @page.as_json(include_fields: true)
end