Class: Locomotive::Api::ContentEntriesController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Locomotive::Api::ContentEntriesController
show all
- Defined in:
- app/controllers/locomotive/api/content_entries_controller.rb
Instance Method Summary
collapse
#back_to_default_site_locale, #current_content_locale, #localized?, #set_back_office_locale, #set_current_content_locale, #setup_i18n_fallbacks
Instance Method Details
#create ⇒ Object
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
|
#destroy ⇒ Object
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
|
#destroy_all ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'app/controllers/locomotive/api/content_entries_controller.rb', line 38
def destroy_all
service.destroy_all
respond_to do |format|
format.html { render text: true }
format.json { render json: { success: true } }
format.xml { render xml: { success: true } }
end
end
|
#index ⇒ Object
12
13
14
15
|
# File 'app/controllers/locomotive/api/content_entries_controller.rb', line 12
def index
@content_entries = service.all(params.slice(:page, :per_page, :order_by, :where))
respond_with(@content_entries)
end
|
#show ⇒ Object
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
|
#update ⇒ Object
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
|