Merge pull request #1225 from repotag/follow_renames

Follow page renames in history view. Close #565
This commit is contained in:
Dawa Ometto
2017-04-13 19:59:59 +02:00
committed by GitHub
4 changed files with 20 additions and 1 deletions
+6
View File
@@ -111,6 +111,12 @@ MSG
opts.on("--no-live-preview", "Disable the live preview feature in page editor.") do
wiki_options[:live_preview] = false
end
opts.on("--follow-renames", "Follow pages across renames in the History view. Default except on jruby.") do
wiki_options[:follow_renames] = true
end
opts.on("--no-follow-renames", "Do not follow pages across renames in the History view.") do
wiki_options[:follow_renames] = false
end
opts.on("--allow-uploads [MODE]", [:dir, :page], "Enable file uploads.",
"If set to 'dir', Gollum will store all uploads in the '<git-repo>/uploads/' directory.",
"If set to 'page', Gollum will store each upload at the currently edited page.") do |mode|
+1 -1
View File
@@ -404,7 +404,7 @@ module Precious
@page = wiki_page(params[:splat].first).page
@page_num = [params[:page].to_i, 1].max
unless @page.nil?
@versions = @page.versions :page => @page_num
@versions = @page.versions(:page => @page_num, :follow => settings.wiki_options.fetch(:follow_renames, git_adapter == 'rjgit' ? false : true))
mustache :history
else
redirect to("/")
+4
View File
@@ -6,6 +6,10 @@ module Precious
EMOJI_PATHNAME = Pathname.new(Gemojione.images_path).freeze
def git_adapter
defined?(Gollum::GIT_ADAPTER) ? Gollum::GIT_ADAPTER : DEFAULT_ADAPTER.match(/(.*)_adapter/)[1]
end
def join_page_name(name, ext)
"#{name}#{ext}"
end
+9
View File
@@ -4,6 +4,15 @@ require File.expand_path(File.join(File.dirname(__FILE__), "helper"))
context "Precious::Helpers" do
include Precious::Helpers
test "return git adapter" do
if defined?(Gollum::GIT_ADAPTER)
result = Gollum::GIT_ADAPTER
else
Gollum::GIT_ADAPTER = result = 'grit'
end
assert_equal result, git_adapter
end
test "extracting paths from URLs" do
assert_nil extract_path('Eye-Of-Sauron')
assert_equal 'Mordor', extract_path('Mordor/Sauron')