Skip to content
Snippets Groups Projects
Commit 21c4b0dd authored by Arran Cudbard-Bell's avatar Arran Cudbard-Bell
Browse files

Allow the sidebar side to be specified

parent 2e2e6457
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -544,11 +544,7 @@ Gollum optionally takes a `--config file`. See [config.rb](https://github.com/gi
 
## CUSTOM CSS
 
The `--css` flag will inject `custom.css` from the root of your git repository into each page. `custom.css` must be commited to git or you will get a 302 redirect to the create page. Here's an example of floating the sidebar to the left.
```css
#wiki-rightbar { float: left !important; }
```
The `--css` flag will inject `custom.css` from the root of your git repository into each page. `custom.css` must be commited to git or you will get a 302 redirect to the create page.
 
## CONTRIBUTE
 
Loading
Loading
Loading
Loading
@@ -388,11 +388,15 @@ module Precious
if page = wiki.paged(name, path, exact = true)
@page = page
@name = name
@content = page.formatted_data
# Extensions and layout data
@editable = true
@content = page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
@mathjax = wiki.mathjax
@h1_title = wiki.h1_title
@bar_side = wiki.bar_side
mustache :page
elsif file = wiki.file(fullpath)
content_type file.mime_type
Loading
Loading
Loading
Loading
@@ -74,6 +74,12 @@ a:hover, a:visited {
}
 
/* @section body */
.has-leftbar #wiki-body {
float: right;
clear: right;
}
#wiki-body {
display: block;
float: left;
Loading
Loading
@@ -83,7 +89,7 @@ a:hover, a:visited {
width: 100%;
}
 
.has-rightbar #wiki-body {
.has-sidebar #wiki-body {
width: 68%;
}
 
Loading
Loading
@@ -93,7 +99,7 @@ a:hover, a:visited {
border: 1px solid #DDD;
font-size: 13px;
padding: 0px 5px;
float:left;
float: left;
margin-bottom: 20px;
min-width: 33%;
 
Loading
Loading
@@ -105,12 +111,19 @@ a:hover, a:visited {
border: none;
}
 
/* @section rightbar */
#wiki-rightbar {
/* @section sidebar */
.has-leftbar #wiki-sidebar {
float: left;
}
.has-rightbar #wiki-sidebar {
float: right;
}
#wiki-sidebar {
background-color: #f7f7f7;
border: 1px solid #ddd;
font-size: 13px;
float: right;
padding: 7px;
width: 25%;
color: #555;
Loading
Loading
@@ -120,15 +133,15 @@ a:hover, a:visited {
-webkit-border-radius: 0.5em;
}
 
#wiki-rightbar p {
#wiki-sidebar p {
margin: 13px 0 0;
}
 
#wiki-rightbar > p:first-child {
#wiki-sidebar > p:first-child {
margin-top: 10px;
}
 
#wiki-rightbar p.parent {
#wiki-sidebar p.parent {
border-bottom: 1px solid #bbb;
font-weight: bold;
margin: 0 0 0.5em 0;
Loading
Loading
@@ -137,7 +150,7 @@ a:hover, a:visited {
}
 
/* Back arrow */
#wiki-rightbar p.parent:before {
#wiki-sidebar p.parent:before {
color: #666;
content: "← ";
}
Loading
Loading
@@ -149,7 +162,7 @@ a:hover, a:visited {
margin: 2em 0 5em;
}
 
.has-rightbar #wiki-footer {
.has-sidebar #wiki-footer {
width: 70%;
}
 
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@
<h1>Create New Page</h1>
</div>
<div id="wiki-content" class="create edit">
<div class="has-rightbar">
<div class="has-sidebar">
{{>editor}}
</div>
</div>
Loading
Loading
Loading
Loading
@@ -31,14 +31,14 @@ Mousetrap.bind(['e'], function( e ) {
</ul>
</div>
<div id="wiki-content">
<div class="{{#has_header}}has-header{{/has_header}}{{#has_footer}} has-footer{{/has_footer}}{{#has_sidebar}} has-rightbar{{/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}}">
{{#has_toc}}
<div id="wiki-toc-main">
{{{toc_content}}}
</div>
{{/has_toc}}
{{#has_sidebar}}
<div id="wiki-rightbar" class="gollum-{{sidebar_format}}-content">
<div id="wiki-sidebar" class="gollum-{{sidebar_format}}-content">
<div id="sidebar-content" class="markdown-body">
{{{sidebar_content}}}
</div>
Loading
Loading
Loading
Loading
@@ -64,6 +64,10 @@ module Precious
def footer_format
has_footer && @footer.format.to_s
end
def bar_side
@bar_side.to_s
end
 
def has_sidebar
@sidebar = (@page.sidebar || false) if @sidebar.nil?
Loading
Loading
Loading
Loading
@@ -147,6 +147,9 @@ module Gollum
# Gets the custom index page for / and subdirs (e.g. foo/)
attr_reader :index_page
# Gets side on which the sidebar should be shown
attr_reader :bar_side
 
# Public: Initialize a new Gollum Repo.
#
Loading
Loading
@@ -176,6 +179,9 @@ module Gollum
# page title.
# :index_page - The default page to retrieve or create if the
# a directory is accessed.
# :bar_side - Where the sidebar should be displayed, may be:
# - :left
# - :right
#
# Returns a fresh Gollum::Repo.
def initialize(path, options = {})
Loading
Loading
@@ -212,6 +218,7 @@ module Gollum
@css = options.fetch :css, false
@h1_title = options.fetch :h1_title, false
@index_page = options.fetch :index_page, 'Home'
@bar_side = options.fetch :sidebar, :right
@user_icons = ['gravatar', 'identicon'].include?( options[:user_icons] ) ?
options[:user_icons] : 'none'
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment