Sha256: b23506b13905e0a0d32121a6688ce29d731a3ea14fbb9f7dc9c9588cc94ccf88

Contents?: true

Size: 745 Bytes

Versions: 18

Compression:

Stored size: 745 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_path
    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_path
    end

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
locomotive_cms-2.5.7 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.5.6 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.5.6.rc2 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.5.6.rc1 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.5.5 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.5.4 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.5.3 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.5.2 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.5.1 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.5.0 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.5.0.rc3 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.5.0.rc2 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.5.0.rc1 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.4.1 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.4.0 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.3.1 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.3.0 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.2.3 app/controllers/locomotive/sites_controller.rb