Sha256: 87b1fea5c91c8b5deb20f9162ac1f16037b5d2621b82cd7fc745ae1b3fdc0b26

Contents?: true

Size: 626 Bytes

Versions: 6

Compression:

Stored size: 626 Bytes

Contents

module Admin
  class CurrentSitesController < BaseController

    sections 'settings', 'site'

    actions :edit, :update

    respond_to :json, :only => :update

    def update
      update! do |success, failure|
        success.html { redirect_to edit_admin_current_site_url(new_host_if_subdomain_changed) }
      end
    end

    protected

    def resource
      @site = current_site
    end

    def new_host_if_subdomain_changed
      if @site.domains.include?(request.host)
        {}
      else
        { :host => "#{@site.subdomain}.#{Locomotive.config.default_domain}:#{request.port}" }
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
locomotive_cms-0.0.4.beta5 app/controllers/admin/current_sites_controller.rb
locomotive_cms-0.0.4.beta4 app/controllers/admin/current_sites_controller.rb
locomotive_cms-0.0.4.beta3 app/controllers/admin/current_sites_controller.rb
locomotive_cms-0.0.4.beta2 app/controllers/admin/current_sites_controller.rb
locomotive_cms-0.0.4.beta1 app/controllers/admin/current_sites_controller.rb
locomotive_cms-0.0.4 app/controllers/admin/current_sites_controller.rb