Class: Homeland::Wiki::Admin::PageVersionsController
- Inherits:
-
Admin::ApplicationController
- Object
- Admin::ApplicationController
- Homeland::Wiki::Admin::PageVersionsController
- Defined in:
- app/controllers/homeland/wiki/admin/page_versions_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
3 4 5 6 |
# File 'app/controllers/homeland/wiki/admin/page_versions_controller.rb', line 3 def index @page = Page.find(params[:page_id]) @page_versions = @page.versions.order(version: :desc).page(params[:page]) end |
#revert ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/homeland/wiki/admin/page_versions_controller.rb', line 13 def revert @page = Page.find(params[:page_id]) @page_version = @page.versions.find(params[:id]) if @page.revert_version(@page_version.version) redirect_to admin_page_versions_path(params[:page_id]), notice: "Wiki 内容已经撤销到了版本 #{@page_version.version}" else redirect_to admin_page_versions_path(params[:page_id]), alert: "版本撤销失败,原因: #{@page.errors..join('<br />')}" end end |
#show ⇒ Object
8 9 10 11 |
# File 'app/controllers/homeland/wiki/admin/page_versions_controller.rb', line 8 def show @page = Page.find(params[:page_id]) @page_version = @page.versions.find(params[:id]) end |