Class: Locomotive::CurrentSiteController

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

Instance Method Summary collapse

Instance Method Details

#destroyObject



26
27
28
29
30
# File 'app/controllers/locomotive/current_site_controller.rb', line 26

def destroy
  authorize @site
  @site.destroy
  respond_with @site, location: sites_path
end

#editObject



15
16
17
18
# File 'app/controllers/locomotive/current_site_controller.rb', line 15

def edit
  authorize @site
  respond_with @site
end

#new_domainObject



32
33
34
35
36
37
38
# File 'app/controllers/locomotive/current_site_controller.rb', line 32

def new_domain
  if params[:domain].present?
    render partial: 'domain', locals: { domain: params[:domain] }
  else
    head :unprocessable_entity
  end
end

#new_localeObject



40
41
42
43
44
45
46
# File 'app/controllers/locomotive/current_site_controller.rb', line 40

def new_locale
  if params[:locale].present?
    render partial: 'locale', locals: { locale: params[:locale] }
  else
    head :unprocessable_entity
  end
end

#new_url_redirectionObject



48
49
50
51
52
53
54
55
56
57
# File 'app/controllers/locomotive/current_site_controller.rb', line 48

def new_url_redirection
  if params[:url_redirection].present? && params[:url_redirection].include?(' ')
    source, target = params[:url_redirection].split(' ')
    render partial: 'url_redirection', locals: {
      url_redirection: { 'source' => source, 'target' => target }
    }
  else
    head :unprocessable_entity
  end
end

#updateObject



20
21
22
23
24
# File 'app/controllers/locomotive/current_site_controller.rb', line 20

def update
  authorize @site
  service.update(@site, site_params)
  respond_with @site, location: -> { edit_current_site_path(current_site) }
end