Class: Panda::CMS::Admin::Settings::BulkEditorController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/panda/cms/admin/settings/bulk_editor_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#set_current_request_details

Methods included from Panda::CMS::ApplicationHelper

#active_link?, #block_link_to, #component, #level_indent, #menu_indent, #nav_class, #nav_highlight_colour_classes, #panda_cms_collection, #panda_cms_collection_items, #panda_cms_editor, #panda_cms_feature_enabled?, #panda_cms_form_with, #selected_nav_highlight_colour_classes, #table_indent, #title_tag

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/panda/cms/admin/settings/bulk_editor_controller.rb', line 14

def create
  begin
    debug_output = BulkEditor.import(params[:site_content])
  rescue JSON::ParserError
    redirect_to admin_cms_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_cms_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



10
11
12
# File 'app/controllers/panda/cms/admin/settings/bulk_editor_controller.rb', line 10

def new
  @json_data = BulkEditor.export
end