Merge pull request #1363 from gollum/page_breadcrumb
Implements a breadcrumb for normal wiki pages. Resolves #629.
This commit is contained in:
@@ -34,6 +34,7 @@ a {
|
|||||||
margin: 1em 0 0;
|
margin: 1em 0 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
@include desktop-breakpoint {
|
@include desktop-breakpoint {
|
||||||
border-bottom: $border-standard;
|
border-bottom: $border-standard;
|
||||||
@@ -46,7 +47,7 @@ a {
|
|||||||
float: left;
|
float: left;
|
||||||
line-height: normal;
|
line-height: normal;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
margin-top: 2em;
|
margin-top: 3em;
|
||||||
padding: 0 0 0 0.667em;
|
padding: 0 0 0 0.667em;
|
||||||
|
|
||||||
@include desktop-breakpoint {
|
@include desktop-breakpoint {
|
||||||
@@ -54,6 +55,16 @@ a {
|
|||||||
padding: 2px 0 0 0;
|
padding: 2px 0 0 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.breadcrumb {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
position: absolute;
|
||||||
|
margin-top: 3.5em;
|
||||||
|
float: none;
|
||||||
|
overflow: auto;
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
ul.actions {
|
ul.actions {
|
||||||
clear: both;
|
clear: both;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Mousetrap.bind(['e'], function( e ) {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<div id="wiki-wrapper" class="page">
|
<div id="wiki-wrapper" class="page">
|
||||||
<div id="head">
|
<div id="head">
|
||||||
<h1>{{page_header}}</h1>
|
<h1>{{page_header}}</h1>
|
||||||
<ul class="actions">
|
<ul class="actions">
|
||||||
<li class="minibutton"><a href="{{base_url}}/"
|
<li class="minibutton"><a href="{{base_url}}/"
|
||||||
@@ -43,6 +43,7 @@ Mousetrap.bind(['e'], function( e ) {
|
|||||||
<li class="minibutton"><a href="{{latest_changes_path}}"
|
<li class="minibutton"><a href="{{latest_changes_path}}"
|
||||||
class="action-page-history">Latest Changes</a></li>
|
class="action-page-history">Latest Changes</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div class="breadcrumb">{{{breadcrumb}}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="wiki-content">
|
<div id="wiki-content">
|
||||||
<div class="{{#has_header}}has-header{{/has_header}}{{#has_footer}} has-footer{{/has_footer}}{{#has_sidebar}} has-sidebar has-{{bar_side}}bar{{/has_sidebar}}{{#has_toc}} has-toc{{/has_toc}}">
|
<div class="{{#has_header}}has-header{{/has_header}}{{#has_footer}} has-footer{{/has_footer}}{{#has_sidebar}} has-sidebar has-{{bar_side}}bar{{/has_sidebar}}{{#has_toc}} has-toc{{/has_toc}}">
|
||||||
|
|||||||
@@ -18,12 +18,23 @@ module Precious
|
|||||||
|
|
||||||
def title
|
def title
|
||||||
h1 = @h1_title ? page_header_from_content(@content) : false
|
h1 = @h1_title ? page_header_from_content(@content) : false
|
||||||
h1 || @page.url_path_title
|
h1 || @page.title
|
||||||
end
|
end
|
||||||
|
|
||||||
def page_header
|
def page_header
|
||||||
title
|
title
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def breadcrumb
|
||||||
|
path = Pathname.new(@page.url_path_title)
|
||||||
|
breadcrumb = []
|
||||||
|
path.descend do |crumb|
|
||||||
|
element = "#{crumb.basename}"
|
||||||
|
next if element == @page.title
|
||||||
|
breadcrumb << %{<a href="#{pages_path}/#{crumb}/">#{element}</a>}
|
||||||
|
end
|
||||||
|
breadcrumb.empty? ? "" : breadcrumb.join(" / ") << " /"
|
||||||
|
end
|
||||||
|
|
||||||
def content
|
def content
|
||||||
content_without_page_header(@content)
|
content_without_page_header(@content)
|
||||||
|
|||||||
Reference in New Issue
Block a user