add ability to change footer and sidebar of page

This commit is contained in:
rick
2010-12-09 16:49:03 -08:00
parent 6edd327ff0
commit 79a1fb860d
3 changed files with 37 additions and 8 deletions
+6 -4
View File
@@ -58,8 +58,11 @@ module Precious
wiki = Gollum::Wiki.new(settings.gollum_path)
page = wiki.page(params[:splat].first)
name = params[:rename] || page.name
update_wiki_page(wiki, page, params[:content], commit_message,
name, params[:format])
msg = commit_message
update_wiki_page(wiki, page, params[:content], msg, name,
params[:format])
update_wiki_page(wiki, page.footer, params[:footer], msg) if params[:footer]
update_wiki_page(wiki, page.sidebar, params[:sidebar], msg) if params[:sidebar]
redirect "/#{CGI.escape(Gollum::Page.cname(name))}"
end
@@ -160,8 +163,7 @@ module Precious
end
def update_wiki_page(wiki, page, content, commit_message, name = nil, format = nil)
return if !page
return if page.raw_data == content
return if !page || !content || page.raw_data == content
name ||= page.name
format = (format || page.format).to_sym
wiki.update_page(page, name, format, content, commit_message)
+5 -4
View File
@@ -538,18 +538,19 @@ module Gollum
def commit_index(options = {})
normalize_commit(options)
options[:parent] ||= [@repo.commit('master')]
options[:parent].compact!
parents = [options[:parent] || @repo.commit('master')]
parents.flatten!
parents.compact!
index = self.repo.index
if tree = options[:tree]
index.read_tree(tree)
elsif parent = options[:parent][0]
elsif parent = parents[0]
index.read_tree(parent.tree.id)
end
yield index if block_given?
actor = Grit::Actor.new(options[:name], options[:email])
index.commit(options[:message], options[:parent], actor)
index.commit(options[:message], parents, actor)
end
def full_reverse_diff_for(page, sha1, sha2 = nil)