Sha256: a52a25dff9bcf9ac1f5d6ab8fda69aca7afffea8e6b61778d05961f9b986e845

Contents?: true

Size: 1.08 KB

Versions: 31

Compression:

Stored size: 1.08 KB

Contents

module PandaCms
  class Admin::Settings::BulkEditorController < ApplicationController
    before_action :set_initial_breadcrumb, only: %i[new]

    def new
      @json_data = BulkEditor.export
    end

    def create
      begin
        debug_output = BulkEditor.import(params[:site_content])
      rescue JSON::ParserError
        redirect_to admin_settings_bulk_editor_path, flash: {error: "Error parsing content; are you sure this update is valid? Reverting..."}
        return
      end

      # Grab the latest content back so it's all formatted properly
      @json_data = BulkEditor.export

      if debug_output[:error].empty? && debug_output[:warning].empty? && debug_output[:success].empty?
        redirect_to admin_settings_bulk_editor_path, flash: {success: "No changes were found!"}
      else
        @debug = debug_output
        render :new, flash: {warning: "Please review the output below for more information."}
      end
    end

    private

    def set_initial_breadcrumb
      add_breadcrumb "Settings", admin_settings_path
      add_breadcrumb "Bulk Editor", "#"
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
panda_cms-0.6.3 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.6.2 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.6.1 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.6.0 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.5.10 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.5.9 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.5.8 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.5.7 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.5.6 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.5.5 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.5.4 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.5.3 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.5.2 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.5.1 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.5.0 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.3.15 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.3.14 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.3.13 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.3.12 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb
panda_cms-0.3.11 app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb