Class: Locomotive::Api::ContentEntriesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/locomotive/api/content_entries_controller.rb

Instance Method Summary collapse

Methods included from Locomotive::ActionController::LocaleHelpers

#back_to_default_site_locale, #current_content_locale, #localized?, #set_back_office_locale, #set_current_content_locale, #setup_i18n_fallbacks

Instance Method Details

#createObject



21
22
23
24
25
# File 'app/controllers/locomotive/api/content_entries_controller.rb', line 21

def create
  @content_entry.from_presenter(params[:content_entry] || params[:entry])
  @content_entry.save
  respond_with @content_entry, location: main_app.locomotive_api_content_entries_url(@content_type.slug)
end

#destroyObject



33
34
35
36
# File 'app/controllers/locomotive/api/content_entries_controller.rb', line 33

def destroy
  @content_entry.destroy
  respond_with @content_entry, location: main_app.locomotive_api_content_entries_url(@content_type.slug)
end

#indexObject



12
13
14
15
# File 'app/controllers/locomotive/api/content_entries_controller.rb', line 12

def index
  @content_entries = @content_entries.order_by([get_content_type.order_by_definition])
  respond_with @content_entries
end

#showObject



17
18
19
# File 'app/controllers/locomotive/api/content_entries_controller.rb', line 17

def show
  respond_with @content_entry, status: @content_entry ? :ok : :not_found
end

#updateObject



27
28
29
30
31
# File 'app/controllers/locomotive/api/content_entries_controller.rb', line 27

def update
  @content_entry.from_presenter(params[:content_entry] || params[:entry])
  @content_entry.save
  respond_with @content_entry, location: main_app.locomotive_api_content_entries_url(@content_type.slug)
end