Merge remote-tracking branch 'bootstraponline/gollum2'
/cc @kristi is the css behaving on this? we had minor markup conflicts Conflicts: lib/gollum/frontend/templates/page.mustache
This commit is contained in:
@@ -106,6 +106,13 @@ are named `_Sidebar.ext` where the extension is one of the supported formats.
|
|||||||
Sidebars affect all pages in their directory and any subdirectories that do not
|
Sidebars affect all pages in their directory and any subdirectories that do not
|
||||||
have a sidebar file of their own.
|
have a sidebar file of their own.
|
||||||
|
|
||||||
|
## HEADER FILES
|
||||||
|
|
||||||
|
Header files allow you to add a simple header to your wiki. Header files must
|
||||||
|
be named `_Header.ext` where the extension is one of the supported formats.
|
||||||
|
Like sidebars, headers affect all pages in their directory and any
|
||||||
|
subdirectories that do not have a header file of their own.
|
||||||
|
|
||||||
## FOOTER FILES
|
## FOOTER FILES
|
||||||
|
|
||||||
Footer files allow you to add a simple footer to your wiki. Footer files must
|
Footer files allow you to add a simple footer to your wiki. Footer files must
|
||||||
@@ -113,7 +120,6 @@ be named `_Footer.ext` where the extension is one of the supported formats.
|
|||||||
Like sidebars, footers affect all pages in their directory and any
|
Like sidebars, footers affect all pages in their directory and any
|
||||||
subdirectories that do not have a footer file of their own.
|
subdirectories that do not have a footer file of their own.
|
||||||
|
|
||||||
|
|
||||||
## HTML SANITIZATION
|
## HTML SANITIZATION
|
||||||
|
|
||||||
For security and compatibility reasons Gollum wikis may not contain custom CSS
|
For security and compatibility reasons Gollum wikis may not contain custom CSS
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ module Precious
|
|||||||
|
|
||||||
update_wiki_page(wiki, page, params[:content], commit, name,
|
update_wiki_page(wiki, page, params[:content], commit, name,
|
||||||
params[:format])
|
params[:format])
|
||||||
|
update_wiki_page(wiki, page.header, params[:header], commit) if params[:header]
|
||||||
update_wiki_page(wiki, page.footer, params[:footer], commit) if params[:footer]
|
update_wiki_page(wiki, page.footer, params[:footer], commit) if params[:footer]
|
||||||
update_wiki_page(wiki, page.sidebar, params[:sidebar], commit) if params[:sidebar]
|
update_wiki_page(wiki, page.sidebar, params[:sidebar], commit) if params[:sidebar]
|
||||||
committer.commit
|
committer.commit
|
||||||
|
|||||||
@@ -20,6 +20,13 @@
|
|||||||
<div id="wiki-content">
|
<div id="wiki-content">
|
||||||
<div class="wrap {{#has_footer}} has-footer {{/has_footer}} {{#has_sidebar}} has-rightbar{{/has_sidebar}}">
|
<div class="wrap {{#has_footer}} has-footer {{/has_footer}} {{#has_sidebar}} has-rightbar{{/has_sidebar}}">
|
||||||
<div id="wiki-body" class="gollum-{{format}}-content">
|
<div id="wiki-body" class="gollum-{{format}}-content">
|
||||||
|
{{#has_header}}
|
||||||
|
<div id="wiki-header" class="gollum-{{header_format}}-content">
|
||||||
|
<div id="header-content">
|
||||||
|
{{{header_content}}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/has_header}}
|
||||||
<div class="markdown-body">
|
<div class="markdown-body">
|
||||||
{{{content}}}
|
{{{content}}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ module Precious
|
|||||||
!!@footer
|
!!@footer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_header
|
||||||
|
@header = (@page.header || false) if @header.nil? && @page
|
||||||
|
!!@header
|
||||||
|
end
|
||||||
|
|
||||||
def has_sidebar
|
def has_sidebar
|
||||||
@sidebar = (@page.sidebar || false) if @sidebar.nil? && @page
|
@sidebar = (@page.sidebar || false) if @sidebar.nil? && @page
|
||||||
!!@sidebar
|
!!@sidebar
|
||||||
|
|||||||
@@ -13,6 +13,17 @@ module Precious
|
|||||||
@name.gsub('-', ' ')
|
@name.gsub('-', ' ')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def header
|
||||||
|
if @header.nil?
|
||||||
|
if page = @page.header
|
||||||
|
@header = page.raw_data
|
||||||
|
else
|
||||||
|
@header = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@header
|
||||||
|
end
|
||||||
|
|
||||||
def footer
|
def footer
|
||||||
if @footer.nil?
|
if @footer.nil?
|
||||||
if page = @page.footer
|
if page = @page.footer
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
module Precious
|
module Precious
|
||||||
module Views
|
module Views
|
||||||
class Page < Layout
|
class Page < Layout
|
||||||
attr_reader :content, :page, :footer
|
attr_reader :content, :page, :header, :footer
|
||||||
DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
|
DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
|
||||||
DEFAULT_AUTHOR = 'you'
|
DEFAULT_AUTHOR = 'you'
|
||||||
|
|
||||||
@@ -27,6 +27,19 @@ module Precious
|
|||||||
@editable
|
@editable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_header
|
||||||
|
@header = (@page.header || false) if @header.nil?
|
||||||
|
!!@header
|
||||||
|
end
|
||||||
|
|
||||||
|
def header_content
|
||||||
|
has_header && @header.formatted_data
|
||||||
|
end
|
||||||
|
|
||||||
|
def header_format
|
||||||
|
has_header && @header.format.to_s
|
||||||
|
end
|
||||||
|
|
||||||
def has_footer
|
def has_footer
|
||||||
@footer = (@page.footer || false) if @footer.nil?
|
@footer = (@page.footer || false) if @footer.nil?
|
||||||
!!@footer
|
!!@footer
|
||||||
|
|||||||
+8
-1
@@ -99,7 +99,7 @@ module Gollum
|
|||||||
# Returns a newly initialized Gollum::Page.
|
# Returns a newly initialized Gollum::Page.
|
||||||
def initialize(wiki)
|
def initialize(wiki)
|
||||||
@wiki = wiki
|
@wiki = wiki
|
||||||
@blob = @footer = @sidebar = nil
|
@blob = @header = @footer = @sidebar = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Public: The on-disk filename of the page including extension.
|
# Public: The on-disk filename of the page including extension.
|
||||||
@@ -209,6 +209,13 @@ module Gollum
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Public: The header Page.
|
||||||
|
#
|
||||||
|
# Returns the header Page or nil if none exists.
|
||||||
|
def header
|
||||||
|
@header ||= find_sub_page(:header)
|
||||||
|
end
|
||||||
|
|
||||||
# Public: The footer Page.
|
# Public: The footer Page.
|
||||||
#
|
#
|
||||||
# Returns the footer Page or nil if none exists.
|
# Returns the footer Page or nil if none exists.
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
add footer and sidebar
|
Add header.
|
||||||
|
|||||||
Binary file not shown.
@@ -1,2 +1,3 @@
|
|||||||
0000000000000000000000000000000000000000 7c45b5f16ff3bae2a0063191ef832701214d4df5 rick <technoweenie@gmail.com> 1291942707 -0800 clone: from /Users/rick/p/gollum/test/examples/revert.git
|
0000000000000000000000000000000000000000 7c45b5f16ff3bae2a0063191ef832701214d4df5 rick <technoweenie@gmail.com> 1291942707 -0800 clone: from /Users/rick/p/gollum/test/examples/revert.git
|
||||||
7c45b5f16ff3bae2a0063191ef832701214d4df5 f403b791119f8232b7cb0ba455c624ac6435f433 rick <technoweenie@gmail.com> 1291942743 -0800 commit: add footer and sidebar
|
7c45b5f16ff3bae2a0063191ef832701214d4df5 f403b791119f8232b7cb0ba455c624ac6435f433 rick <technoweenie@gmail.com> 1291942743 -0800 commit: add footer and sidebar
|
||||||
|
f403b791119f8232b7cb0ba455c624ac6435f433 ed6c9f63b98acf73c25b5ffbb38da557d3682023 bootstraponline <cafe@bootstraponline.com> 1336421777 -0600 commit: Add header.
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
0000000000000000000000000000000000000000 7c45b5f16ff3bae2a0063191ef832701214d4df5 rick <technoweenie@gmail.com> 1291942707 -0800 clone: from /Users/rick/p/gollum/test/examples/revert.git
|
0000000000000000000000000000000000000000 7c45b5f16ff3bae2a0063191ef832701214d4df5 rick <technoweenie@gmail.com> 1291942707 -0800 clone: from /Users/rick/p/gollum/test/examples/revert.git
|
||||||
7c45b5f16ff3bae2a0063191ef832701214d4df5 f403b791119f8232b7cb0ba455c624ac6435f433 rick <technoweenie@gmail.com> 1291942743 -0800 commit: add footer and sidebar
|
7c45b5f16ff3bae2a0063191ef832701214d4df5 f403b791119f8232b7cb0ba455c624ac6435f433 rick <technoweenie@gmail.com> 1291942743 -0800 commit: add footer and sidebar
|
||||||
|
f403b791119f8232b7cb0ba455c624ac6435f433 ed6c9f63b98acf73c25b5ffbb38da557d3682023 bootstraponline <cafe@bootstraponline.com> 1336421777 -0600 commit: Add header.
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
|
|||||||
|
x¥ŽK @]s
|
||||||
|
.`3ç‰1z”†´‰-
âýíÚoù//·m[‡6D—ÑE4‚ñÑe2€±F0Î…
|
||||||
|
®$XéÄJ,œ9©ƒ»ìCW›ÂŒˆs�Æšr‚Ää\ö†8{²®’µŠ?ci]§ÖÆ{t>ÚþZwÑ·ÌU?vÊm»k´Ö“Á‚¾‚P§=_‡üWQÏRô"\¤OêziN¹
|
||||||
@@ -1 +1 @@
|
|||||||
f403b791119f8232b7cb0ba455c624ac6435f433
|
ed6c9f63b98acf73c25b5ffbb38da557d3682023
|
||||||
|
|||||||
+6
-2
@@ -29,13 +29,14 @@ context "Frontend" do
|
|||||||
assert_not_equal page_1.version.sha, page_2.version.sha
|
assert_not_equal page_1.version.sha, page_2.version.sha
|
||||||
end
|
end
|
||||||
|
|
||||||
test "edits page footer and sidebar" do
|
test "edits page header footer and sidebar" do
|
||||||
commits = @wiki.repo.commits('master').size
|
commits = @wiki.repo.commits('master').size
|
||||||
page_1 = @wiki.page('A')
|
page_1 = @wiki.page('A')
|
||||||
|
header_1 = page_1.header
|
||||||
foot_1 = page_1.footer
|
foot_1 = page_1.footer
|
||||||
side_1 = page_1.sidebar
|
side_1 = page_1.sidebar
|
||||||
|
|
||||||
post "/edit/A",
|
post "/edit/A", :header => 'header',
|
||||||
:footer => 'footer', :page => "A", :sidebar => 'sidebar', :message => 'def'
|
:footer => 'footer', :page => "A", :sidebar => 'sidebar', :message => 'def'
|
||||||
follow_redirect!
|
follow_redirect!
|
||||||
assert_equal "/A", last_request.fullpath
|
assert_equal "/A", last_request.fullpath
|
||||||
@@ -43,13 +44,16 @@ context "Frontend" do
|
|||||||
|
|
||||||
@wiki.clear_cache
|
@wiki.clear_cache
|
||||||
page_2 = @wiki.page(page_1.name)
|
page_2 = @wiki.page(page_1.name)
|
||||||
|
header_2 = page_2.header
|
||||||
foot_2 = page_2.footer
|
foot_2 = page_2.footer
|
||||||
side_2 = page_2.sidebar
|
side_2 = page_2.sidebar
|
||||||
assert_equal page_1.raw_data, page_2.raw_data
|
assert_equal page_1.raw_data, page_2.raw_data
|
||||||
|
|
||||||
|
assert_equal 'header', header_2.raw_data
|
||||||
assert_equal 'footer', foot_2.raw_data
|
assert_equal 'footer', foot_2.raw_data
|
||||||
assert_equal 'def', foot_2.version.message
|
assert_equal 'def', foot_2.version.message
|
||||||
assert_not_equal foot_1.version.sha, foot_2.version.sha
|
assert_not_equal foot_1.version.sha, foot_2.version.sha
|
||||||
|
assert_not_equal header_1.version.sha, header_2.version.sha
|
||||||
|
|
||||||
assert_equal 'sidebar', side_2.raw_data
|
assert_equal 'sidebar', side_2.raw_data
|
||||||
assert_equal 'def', side_2.version.message
|
assert_equal 'def', side_2.version.message
|
||||||
|
|||||||
Reference in New Issue
Block a user