Class: Comfy::Admin::Cms::Revisions::BaseController
- Inherits:
-
BaseController
- Object
- BaseController
- Comfy::Admin::Cms::Revisions::BaseController
show all
- Defined in:
- app/controllers/comfy/admin/cms/revisions/base_controller.rb
Instance Method Summary
collapse
Instance Method Details
#index ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'app/controllers/comfy/admin/cms/revisions/base_controller.rb', line 11
def index
revision = @record.revisions.order(created_at: :desc).first
if revision
redirect_to action: :show, id: revision.id
else
redirect_to record_path
end
end
|
#revert ⇒ Object
27
28
29
30
31
|
# File 'app/controllers/comfy/admin/cms/revisions/base_controller.rb', line 27
def revert
@record.restore_from_revision(@revision)
flash[:success] = I18n.t("comfy.admin.cms.revisions.reverted")
redirect_to record_path
end
|
#show ⇒ Object
20
21
22
23
24
25
|
# File 'app/controllers/comfy/admin/cms/revisions/base_controller.rb', line 20
def show
@current_content = @record.revision_fields.each_with_object({}) { |f, c| c[f] = @record.send(f) }
@versioned_content = @record.revision_fields.each_with_object({}) { |f, c| c[f] = @revision.data[f] }
render "comfy/admin/cms/revisions/show"
end
|