Sha256: 72f82bbe0acd4a06d51f962f99dfdadf3726bd757bc17d82d6c71aacf781e78b

Contents?: true

Size: 686 Bytes

Versions: 8

Compression:

Stored size: 686 Bytes

Contents

module Locomotive
  class SitesController < BaseController

    account_required

    layout '/locomotive/layouts/without_site'

    def index
      authorize Site
      @sites = service.list
      respond_with @sites
    end

    def new
      authorize Site
      @site = service.build_new
      respond_with @site
    end

    def create
      authorize Site
      @site = service.create(site_params)
      respond_with @site, location: -> { dashboard_path(@site) }
    end

    private

    def service
      @service ||= Locomotive::SiteService.new(self.current_locomotive_account)
    end

    def site_params
      params.require(:site).permit(:name, :handle)
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
locomotivecms-3.0.0.rc4 app/controllers/locomotive/sites_controller.rb
locomotivecms-3.0.0.rc3 app/controllers/locomotive/sites_controller.rb
locomotivecms-3.0.0.rc2 app/controllers/locomotive/sites_controller.rb
locomotivecms-3.0.0.rc1 app/controllers/locomotive/sites_controller.rb
locomotivecms-3.0.0.pre.beta.1 app/controllers/locomotive/sites_controller.rb
locomotivecms-3.0.0.pre.alpha.3 app/controllers/locomotive/sites_controller.rb
locomotivecms-3.0.0.pre.alpha.2 app/controllers/locomotive/sites_controller.rb
locomotivecms-3.0.0.pre.alpha app/controllers/locomotive/sites_controller.rb