Compare commits

..

3 Commits

+26 -2
View File
@@ -368,6 +368,7 @@ module Precious
get '/create/*' do
forbid unless @allow_editing
forbid unless @user_authed
wikip = wiki_page(params[:splat].first)
@name = wikip.name
@ext = wikip.ext
@@ -625,6 +626,26 @@ module Precious
def show_page_or_file(fullpath)
wiki = wiki_new
# check if folders exists
contents = wiki.tree_list
print contents
entry = contents.detect do |entry|
Gollum::File::path_match(fullpath, entry)
end
print entry
#if path
# @path = Pathname.new(path).cleanpath.to_s
# check_path = wiki.page_file_dir ? ::File.join(wiki.page_file_dir, @path, '/') : "#{@path}/"
# @results.select! {|result| result.path.start_with?(check_path) }
#end
#@results.sort_by! {|result| result.name.downcase}
#elsif fullpath[-1] == '/' ? Gollum::Page.valid_page_name?(fullpath) : false
if page = fullpath[-1] != '/' ? wiki.page("#{fullpath}/#{wiki.index_page}") : false
@page = page
@name = page.filename_stripped
@@ -639,8 +660,6 @@ module Precious
@allow_uploads = wiki.allow_uploads
@navbar = true
mustache :page
#redirect_path = "#{fullpath}/#{wiki.index_page}"
#redirect to("#{encodeURIComponent(redirect_path)}")
elsif page = wiki.page(fullpath)
@page = page
@name = page.filename_stripped
@@ -659,6 +678,11 @@ module Precious
show_file(file)
elsif @redirects_enabled && redirect_path = wiki.redirects[fullpath]
redirect to("#{encodeURIComponent(redirect_path)}?redirected_from=#{encodeURIComponent(fullpath)}")
elsif entry
# check if the folder fullpath exists
# if so, redirect to overview
#
redirect to("/gollum/overview/#{clean_url(encodeURIComponent(fullpath))}")
else
if @allow_editing && @user_authed
path = fullpath[-1] == '/' ? "#{fullpath}#{wiki.index_page}" : fullpath # Append default index page if no page name is supplied