Sha256: f81c8ee21db2d05a43ed6f3ca18a7693b56cf9527291162669ea1cd9458a44b4

Contents?: true

Size: 750 Bytes

Versions: 11

Compression:

Stored size: 750 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 => @current_locomotive_account, :role => 'admin'
      @site.save
      respond_with @site, :location => edit_my_account_url
    end

    def destroy
      @site = 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

11 entries across 11 versions & 1 rubygems

Version Path
locomotive_cms-2.0.0.rc12 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.0.0.rc11 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.0.0.rc10 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.0.0.rc9 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.0.0.rc8 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.0.0.rc7 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.0.0.rc6 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.0.0.rc5 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.0.0.rc4 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.0.0.rc2 app/controllers/locomotive/sites_controller.rb
locomotive_cms-2.0.0.rc1 app/controllers/locomotive/sites_controller.rb