Class: Admin::Settings::BulkEditorController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb', line 9

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

#newObject



5
6
7
# File 'app/controllers/panda_cms/admin/settings/bulk_editor_controller.rb', line 5

def new
  @json_data = BulkEditor.export
end