Class: Locomotive::Api::SitesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/locomotive/api/sites_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



22
23
24
25
26
27
# File 'app/controllers/locomotive/api/sites_controller.rb', line 22

def create
  @site = Locomotive::Site.from_presenter(params[:site])
  @site.memberships.build :account => self., :role => 'admin'
  @site.save
  respond_with(@site)
end

#destroyObject



36
37
38
39
# File 'app/controllers/locomotive/api/sites_controller.rb', line 36

def destroy
  @site.destroy
  respond_with(@site)
end

#indexObject



13
14
15
16
# File 'app/controllers/locomotive/api/sites_controller.rb', line 13

def index
  @sites = self..sites.all
  respond_with(@sites)
end

#showObject



18
19
20
# File 'app/controllers/locomotive/api/sites_controller.rb', line 18

def show
  respond_with(@site)
end

#updateObject



29
30
31
32
33
34
# File 'app/controllers/locomotive/api/sites_controller.rb', line 29

def update
  @site = Locomotive::Site.find(params[:id])
  @site.from_presenter(params[:site])
  @site.save
  respond_with @site
end