Sha256: 3d240dfe7a079830f319a60a49086af22a714f9cd06e380eb4713c0675623f6c

Contents?: true

Size: 743 Bytes

Versions: 8

Compression:

Stored size: 743 Bytes

Contents

module Locomotive
  class SitesController < BaseController

    sections 'settings'

    respond_to :json, only: [:create, :destroy]

    def new
      @site = Site.new
      respond_with @site
    end

    def create
      @site = Site.new(params[:site])
      @site.memberships.build account: self.current_locomotive_account, role: 'admin'
      @site.save
      respond_with @site, location: edit_my_account_url
    end

    def destroy
      @site = self.current_locomotive_account.sites.find(params[:id])

      if @site != current_site
        @site.destroy
      else
        @site.errors.add(:base, 'Can not destroy the site you are logging in now')
      end

      respond_with @site, location: edit_my_account_url
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
locomotive_cms-2.2.2 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.2.1 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.2.0 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.1.4 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.1.3 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.1.2 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.1.1 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.1.0 app/controllers/locomotive/sites_controller.rb