summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin_controller.rb4
-rw-r--r--app/controllers/nodes_controller.rb2
-rw-r--r--app/controllers/revisions_controller.rb16
3 files changed, 15 insertions, 7 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 3fa0519..6ab2135 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -5,10 +5,10 @@ class AdminController < ApplicationController
5 before_action :login_required 5 before_action :login_required
6 6
7 def index 7 def index
8 @drafts = Node.where("draft_id IS NOT NULL") 8 @drafts = Node.where("draft_id IS NOT NULL OR autosave_id IS NOT NULL")
9 .limit(50).order("updated_at desc") 9 .limit(50).order("updated_at desc")
10 10
11 @drafts_count = Node.where("draft_id IS NOT NULL").count 11 @drafts_count = Node.where("draft_id IS NOT NULL OR autosave_id IS NOT NULL").count
12 12
13 @recent_changes = Node.where( 13 @recent_changes = Node.where(
14 "updated_at < ? AND updated_at > ? AND parent_id IS NOT NULL", 14 "updated_at < ? AND updated_at > ? AND parent_id IS NOT NULL",
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb
index 38d42d9..d1538e1 100644
--- a/app/controllers/nodes_controller.rb
+++ b/app/controllers/nodes_controller.rb
@@ -72,7 +72,7 @@ class NodesController < ApplicationController
72 if @node.autosave 72 if @node.autosave
73 flash.now[:notice] = 73 flash.now[:notice] =
74 "This page has unsaved changes from a previous session, shown below. " \ 74 "This page has unsaved changes from a previous session, shown below. " \
75 "Save to keep them, or use \"Discard changes\" below to go back to the last saved version." 75 "Save to keep them, or use \"Discard Autosave\" below to go back to the last saved version."
76 elsif freshly_locked 76 elsif freshly_locked
77 flash.now[:notice] = "Node locked and ready to edit" 77 flash.now[:notice] = "Node locked and ready to edit"
78 end 78 end
diff --git a/app/controllers/revisions_controller.rb b/app/controllers/revisions_controller.rb
index 9acb26f..4b0c549 100644
--- a/app/controllers/revisions_controller.rb
+++ b/app/controllers/revisions_controller.rb
@@ -21,10 +21,18 @@ class RevisionsController < ApplicationController
21 params[:start_revision], params[:end_revision] = 1, 1 21 params[:start_revision], params[:end_revision] = 1, 1
22 end 22 end
23 23
24 @start = @node.pages.find_by_revision( params[:start_revision] ) 24 @start = @node.resolve_page_reference(params[:start_revision])
25 @end = @node.pages.find_by_revision( params[:end_revision] ) 25 @end = @node.resolve_page_reference(params[:end_revision])
26 @diff_view = params[:view] == "side_by_side" ? :side_by_side : :inline 26
27 @diff = @end.diff_against( @start, view: @diff_view ) 27 if @start.nil? || @end.nil?
28 flash[:error] = "That comparison is no longer available."
29 redirect_to(node_path(@node)) and return
30 end
31
32 @diff_view = params[:view] == "side_by_side" ? :side_by_side : :inline
33 @diff = @end.diff_against(@start, view: @diff_view)
34 @available_layer_pairs = @node.available_layer_pairs
35 @locked_by_other = @node.locked? && @node.lock_owner != current_user
28 end 36 end
29 37
30 def show 38 def show