Class: Spotlight::VersionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/spotlight/versions_controller.rb

Overview

Controller for reverting to historical versions of e.g. pages

Instance Method Summary collapse

Methods included from Concerns::ApplicationController

#enabled_in_spotlight_view_type_configuration?, #field_enabled?

Methods included from Controller

#blacklight_config, #current_exhibit, #current_masthead, #current_masthead=, #current_site, #exhibit_masthead?, #exhibit_search_action_url, #exhibit_search_facet_url, #resource_masthead?, #search_action_url, #search_facet_url

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#revertObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/spotlight/versions_controller.rb', line 9

def revert
  obj = @version.reify
  if obj && authorize!(:manage, obj)
    if obj.save
      redirect_to [obj.exhibit, obj], flash: { html_safe: true }, notice: undo_link
    else
      redirect_to [obj.exhibit, obj], flash: { html_safe: true }, notice: view_context.t(:'spotlight.versions.undo_error')
    end
  else
    redirect_to :back, flash: { html_safe: true }, notice: view_context.t(:'spotlight.versions.undo_error')
  end
end