Sinatra base url to allow subdirectories
This commit is contained in:
@@ -67,6 +67,10 @@ module Precious
|
|||||||
enable :logging, :raise_errors, :dump_errors
|
enable :logging, :raise_errors, :dump_errors
|
||||||
end
|
end
|
||||||
|
|
||||||
|
before do
|
||||||
|
@base_url = url('/')
|
||||||
|
end
|
||||||
|
|
||||||
get '/' do
|
get '/' do
|
||||||
show_page_or_file('Home')
|
show_page_or_file('Home')
|
||||||
end
|
end
|
||||||
@@ -93,7 +97,7 @@ module Precious
|
|||||||
if @path
|
if @path
|
||||||
live_preview_url << '&path=' + encodeURIComponent(@path)
|
live_preview_url << '&path=' + encodeURIComponent(@path)
|
||||||
end
|
end
|
||||||
redirect live_preview_url
|
redirect to(live_preview_url)
|
||||||
else
|
else
|
||||||
@page = page
|
@page = page
|
||||||
@page.version = wiki.repo.log(wiki.ref, @page.path).first
|
@page.version = wiki.repo.log(wiki.ref, @page.path).first
|
||||||
@@ -122,7 +126,7 @@ module Precious
|
|||||||
|
|
||||||
page = wiki.page(params[:rename]) if params[:rename]
|
page = wiki.page(params[:rename]) if params[:rename]
|
||||||
|
|
||||||
redirect "/#{page.escaped_url_path}"
|
redirect to("/#{page.escaped_url_path}")
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/create/*' do
|
get '/create/*' do
|
||||||
@@ -146,7 +150,7 @@ module Precious
|
|||||||
begin
|
begin
|
||||||
wiki.write_page(name, format, params[:content], commit_message)
|
wiki.write_page(name, format, params[:content], commit_message)
|
||||||
page = wiki.page(name)
|
page = wiki.page(name)
|
||||||
redirect "/#{page.escaped_url_path}"
|
redirect to("/#{page.escaped_url_path}")
|
||||||
rescue Gollum::DuplicatePageError => e
|
rescue Gollum::DuplicatePageError => e
|
||||||
@message = "Duplicate page: #{e.message}"
|
@message = "Duplicate page: #{e.message}"
|
||||||
mustache :error
|
mustache :error
|
||||||
@@ -164,7 +168,7 @@ module Precious
|
|||||||
sha2 = shas.shift
|
sha2 = shas.shift
|
||||||
|
|
||||||
if wiki.revert_page(@page, sha1, sha2, commit_message)
|
if wiki.revert_page(@page, sha1, sha2, commit_message)
|
||||||
redirect "/#{@page.escaped_url_path}"
|
redirect to("/#{@page.escaped_url_path}")
|
||||||
else
|
else
|
||||||
sha2, sha1 = sha1, "#{sha1}^" if !sha2
|
sha2, sha1 = sha1, "#{sha1}^" if !sha2
|
||||||
@versions = [sha1, sha2]
|
@versions = [sha1, sha2]
|
||||||
@@ -201,12 +205,13 @@ module Precious
|
|||||||
@file = params[:splat].first
|
@file = params[:splat].first
|
||||||
@versions = params[:versions] || []
|
@versions = params[:versions] || []
|
||||||
if @versions.size < 2
|
if @versions.size < 2
|
||||||
redirect "/history/#{@file}"
|
redirect to("/history/#{@file}")
|
||||||
else
|
else
|
||||||
redirect "/compare/%s/%s...%s" % [
|
redirect to("/compare/%s/%s...%s" % [
|
||||||
@file,
|
@file,
|
||||||
@versions.last,
|
@versions.last,
|
||||||
@versions.first]
|
@versions.first]
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -62,16 +62,16 @@ ol.tree
|
|||||||
}
|
}
|
||||||
li.file a
|
li.file a
|
||||||
{
|
{
|
||||||
background: url(/images/fileview/document.png) 0 0 no-repeat;
|
background: url(../images/fileview/document.png) 0 0 no-repeat;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding-left: 21px;
|
padding-left: 21px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
li.file a[href *= '.pdf'] { background: url(/images/fileview/document.png) 0 0 no-repeat; }
|
li.file a[href *= '.pdf'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
||||||
li.file a[href *= '.html'] { background: url(/images/fileview/document.png) 0 0 no-repeat; }
|
li.file a[href *= '.html'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
||||||
li.file a[href $= '.css'] { background: url(/images/fileview/document.png) 0 0 no-repeat; }
|
li.file a[href $= '.css'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
||||||
li.file a[href $= '.js'] { background: url(/images/fileview/document.png) 0 0 no-repeat; }
|
li.file a[href $= '.js'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
||||||
li input
|
li input
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -86,14 +86,14 @@ ol.tree
|
|||||||
}
|
}
|
||||||
li input + ol
|
li input + ol
|
||||||
{
|
{
|
||||||
background: url(/images/fileview/toggle-small-expand.png) 40px 0 no-repeat;
|
background: url(../images/fileview/toggle-small-expand.png) 40px 0 no-repeat;
|
||||||
margin: -1.188em 0 0 -44px; /* 15px */
|
margin: -1.188em 0 0 -44px; /* 15px */
|
||||||
height: 1.5em;
|
height: 1.5em;
|
||||||
}
|
}
|
||||||
li input + ol > li { display: none; margin-left: -14px !important; padding-left: 1px; }
|
li input + ol > li { display: none; margin-left: -14px !important; padding-left: 1px; }
|
||||||
li label
|
li label
|
||||||
{
|
{
|
||||||
background: url(/images/fileview/folder-horizontal.png) 15px 1px no-repeat;
|
background: url(../images/fileview/folder-horizontal.png) 15px 1px no-repeat;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: block;
|
display: block;
|
||||||
padding-left: 37px;
|
padding-left: 37px;
|
||||||
@@ -101,7 +101,7 @@ ol.tree
|
|||||||
|
|
||||||
li input:checked + ol
|
li input:checked + ol
|
||||||
{
|
{
|
||||||
background: url(/images/fileview/toggle-small.png) 40px 5px no-repeat;
|
background: url(../images/fileview/toggle-small.png) 40px 5px no-repeat;
|
||||||
margin: -1.5em 0 0 -44px; /* 20px */
|
margin: -1.5em 0 0 -44px; /* 20px */
|
||||||
padding: 1.563em 0 0 80px;
|
padding: 1.563em 0 0 80px;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
|||||||
@@ -662,7 +662,7 @@ ul.actions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#head #searchbar #searchbar-fauxtext #search-submit span {
|
#head #searchbar #searchbar-fauxtext #search-submit span {
|
||||||
background-image: url(/images/icon-sprite.png);
|
background-image: url(../images/icon-sprite.png);
|
||||||
background-position: -431px -1px;
|
background-position: -431px -1px;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ a.absent {
|
|||||||
.markdown-body h4:hover a.anchor,
|
.markdown-body h4:hover a.anchor,
|
||||||
.markdown-body h5:hover a.anchor,
|
.markdown-body h5:hover a.anchor,
|
||||||
.markdown-body h6:hover a.anchor {
|
.markdown-body h6:hover a.anchor {
|
||||||
background: url('/images/pin-20.png') no-repeat left center;
|
background: url(../images/pin-20.png) no-repeat left center;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
.markdown-body h1 tt,
|
.markdown-body h1 tt,
|
||||||
@@ -133,7 +133,7 @@ a.absent {
|
|||||||
margin: 15px 0;
|
margin: 15px 0;
|
||||||
}
|
}
|
||||||
.markdown-body hr {
|
.markdown-body hr {
|
||||||
background: transparent url('/images/dirty-shade.png') repeat-x 0 0;
|
background: transparent url(../images/dirty-shade.png) repeat-x 0 0;
|
||||||
border: 0 none;
|
border: 0 none;
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
height: 4px;
|
height: 4px;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ $(document).ready(function() {
|
|||||||
var name = res['name'];
|
var name = res['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = '';
|
var url = baseUrl;
|
||||||
var path = $('#minibutton-new-page').data('path');
|
var path = $('#minibutton-new-page').data('path');
|
||||||
if (path) {
|
if (path) {
|
||||||
url += '/' + encodeURIComponent(path)
|
url += '/' + encodeURIComponent(path)
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ var commentEditorContainer = commentEditor.container;
|
|||||||
|
|
||||||
initAce( commentEditor, commentEditorSession );
|
initAce( commentEditor, commentEditorSession );
|
||||||
|
|
||||||
|
// Find the app's base url, knowing we are in /livepreview/index.html
|
||||||
|
var baseUrl = location.pathname.split('/').slice(0,-2).join('/');
|
||||||
|
|
||||||
// RegExp from http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript
|
// RegExp from http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript
|
||||||
$.key = function( key ) {
|
$.key = function( key ) {
|
||||||
var value = new RegExp( '[\\?&]' + key + '=([^&#]*)' ).exec( location.href );
|
var value = new RegExp( '[\\?&]' + key + '=([^&#]*)' ).exec( location.href );
|
||||||
@@ -94,7 +97,7 @@ $.save = function( commitMessage ) {
|
|||||||
var txt = editorSession.getValue();
|
var txt = editorSession.getValue();
|
||||||
var msg = defaultCommitMessage();
|
var msg = defaultCommitMessage();
|
||||||
|
|
||||||
var newLocation = location.protocol + '//' + location.host;
|
var newLocation = location.protocol + '//' + location.host + baseUrl;
|
||||||
if (pathName) {
|
if (pathName) {
|
||||||
newLocation += '/' + pathName;
|
newLocation += '/' + pathName;
|
||||||
}
|
}
|
||||||
@@ -330,7 +333,7 @@ var applyTimeout = function () {
|
|||||||
/* Load markdown from /data/page into the ace editor. */
|
/* Load markdown from /data/page into the ace editor. */
|
||||||
jQuery.ajax( {
|
jQuery.ajax( {
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: '/data/' + $.key( 'page' ),
|
url: baseUrl + '/data/' + $.key( 'page' ),
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
editorSession.setValue( data );
|
editorSession.setValue( data );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
<li class="minibutton">
|
<li class="minibutton">
|
||||||
{{>searchbar}}
|
{{>searchbar}}
|
||||||
</li>
|
</li>
|
||||||
<li class="minibutton"><a href="/{{escaped_url_path}}"
|
<li class="minibutton"><a href="{{base_url}}{{escaped_url_path}}"
|
||||||
class="action-view-page">View Page</a></li>
|
class="action-view-page">View Page</a></li>
|
||||||
<li class="minibutton"><a href="/edit/{{escaped_url_path}}"
|
<li class="minibutton"><a href="{{base_url}}edit/{{escaped_url_path}}"
|
||||||
class="action-edit-page">Edit Page</a></li>
|
class="action-edit-page">Edit Page</a></li>
|
||||||
<li class="minibutton"><a href="/history/{{escaped_url_path}}"
|
<li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
|
||||||
class="action-page-history">Page History</a></li>
|
class="action-page-history">Page History</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -23,10 +23,10 @@
|
|||||||
|
|
||||||
{{#show_revert}}
|
{{#show_revert}}
|
||||||
<ul class="actions">
|
<ul class="actions">
|
||||||
<li class="minibutton"><a href="/history/{{escaped_url_path}}"
|
<li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
|
||||||
class="action-page-history">Back to Page History</a></li>
|
class="action-page-history">Back to Page History</a></li>
|
||||||
<li class="minibutton">
|
<li class="minibutton">
|
||||||
<form name="gollum-revert" action="/revert/{{escaped_url_path}}/{{before}}/{{after}}" method="post" id="gollum-revert-form">
|
<form name="gollum-revert" action="{{base_url}}revert/{{escaped_url_path}}/{{before}}/{{after}}" method="post" id="gollum-revert-form">
|
||||||
<a href="#" class="gollum-revert-button">Revert Changes</a>
|
<a href="#" class="gollum-revert-button">Revert Changes</a>
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<ul class="actions">
|
<ul class="actions">
|
||||||
<li class="minibutton"><a href="/history/{{escaped_url_path}}"
|
<li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
|
||||||
class="action-page-history">Back to Page History</a></li>
|
class="action-page-history">Back to Page History</a></li>
|
||||||
{{#show_revert}}
|
{{#show_revert}}
|
||||||
<li class="minibutton">
|
<li class="minibutton">
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
<div id="head">
|
<div id="head">
|
||||||
<h1>Editing <strong>{{title}}</strong></h1>
|
<h1>Editing <strong>{{title}}</strong></h1>
|
||||||
<ul class="actions">
|
<ul class="actions">
|
||||||
<li class="minibutton"><a href="/{{escaped_url_path}}"
|
<li class="minibutton"><a href="{{base_url}}{{escaped_url_path}}"
|
||||||
class="action-view-page">View Page</a></li>
|
class="action-view-page">View Page</a></li>
|
||||||
<li class="minibutton"><a href="/history/{{escaped_url_path}}"
|
<li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
|
||||||
class="action-page-history">Page History</a></li>
|
class="action-page-history">Page History</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<div id="gollum-editor" data-escaped-name="{{escaped_name}}" class="{{#is_create_page}}create{{/is_create_page}}{{#is_edit_page}}edit{{/is_edit_page}}">
|
<div id="gollum-editor" data-escaped-name="{{escaped_name}}" class="{{#is_create_page}}create{{/is_create_page}}{{#is_edit_page}}edit{{/is_edit_page}}">
|
||||||
{{#is_create_page}}
|
{{#is_create_page}}
|
||||||
<form name="gollum-editor" action="/create" method="post">
|
<form name="gollum-editor" action="{{base_url}}create" method="post">
|
||||||
{{/is_create_page}}
|
{{/is_create_page}}
|
||||||
{{#is_edit_page}}
|
{{#is_edit_page}}
|
||||||
<form name="gollum-editor" action="/edit/{{escaped_name}}" method="post">
|
<form name="gollum-editor" action="{{base_url}}edit/{{escaped_name}}" method="post">
|
||||||
{{/is_edit_page}}
|
{{/is_edit_page}}
|
||||||
<fieldset id="gollum-editor-fields">
|
<fieldset id="gollum-editor-fields">
|
||||||
{{#is_create_page}}
|
{{#is_create_page}}
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
|
|
||||||
<span class="jaws"><br></span>
|
<span class="jaws"><br></span>
|
||||||
<input type="submit" id="gollum-editor-submit" value="Save" title="Save current changes">
|
<input type="submit" id="gollum-editor-submit" value="Save" title="Save current changes">
|
||||||
<a href="/preview" id="gollum-editor-preview" class="minibutton" title="Preview this Page">Preview</a>
|
<a href="{{base_url}}preview" id="gollum-editor-preview" class="minibutton" title="Preview this Page">Preview</a>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-type" content="text/html;charset=utf-8">
|
<meta http-equiv="Content-type" content="text/html;charset=utf-8">
|
||||||
<meta http-equiv="Content-type" content="text/html;charset=utf-8">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}css/gollum.css" media="all">
|
||||||
<link rel="stylesheet" type="text/css" href="/css/gollum.css" media="all">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}css/template.css" media="all">
|
||||||
<link rel="stylesheet" type="text/css" href="/css/template.css" media="all">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}css/_styles.css" media="all">
|
||||||
<link rel="stylesheet" type="text/css" href="/css/_styles.css" media="all">
|
|
||||||
<title>{{title}}</title>
|
<title>{{title}}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -13,7 +12,7 @@
|
|||||||
<div id="home_button">
|
<div id="home_button">
|
||||||
<ul class="actions">
|
<ul class="actions">
|
||||||
<li class="minibutton">
|
<li class="minibutton">
|
||||||
<a href="/" class="action-edit-page">Home</a>
|
<a href="{{base_url}}" class="action-edit-page">Home</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="minibutton" class="jaws">
|
<li class="minibutton" class="jaws">
|
||||||
<a href="#" id="minibutton-new-page">New Page</a>
|
<a href="#" id="minibutton-new-page">New Page</a>
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
<li class="minibutton">
|
<li class="minibutton">
|
||||||
{{>searchbar}}
|
{{>searchbar}}
|
||||||
</li>
|
</li>
|
||||||
<li class="minibutton"><a href="/{{escaped_url_path}}"
|
<li class="minibutton"><a href="{{base_url}}{{escaped_url_path}}"
|
||||||
class="action-view-page">View Page</a></li>
|
class="action-view-page">View Page</a></li>
|
||||||
<li class="minibutton"><a href="/edit/{{escaped_url_path}}"
|
<li class="minibutton"><a href="{{base_url}}edit/{{escaped_url_path}}"
|
||||||
class="action-edit-page">Edit Page</a></li>
|
class="action-edit-page">Edit Page</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<form name="compare-versions" id="version-form" method="post"
|
<form name="compare-versions" id="version-form" method="post"
|
||||||
action="/compare/{{escaped_url_path}}">
|
action="{{base_url}}compare/{{escaped_url_path}}">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
<td class="commit-name">
|
<td class="commit-name">
|
||||||
<span class="time-elapsed">{{date}}:</span>
|
<span class="time-elapsed">{{date}}:</span>
|
||||||
{{message}}
|
{{message}}
|
||||||
[<a href="/{{escaped_url_path}}/{{id}}" title="View commit">{{id7}}</a>]
|
[<a href="{{base_url}}{{escaped_url_path}}/{{id}}" title="View commit">{{id7}}</a>]
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/versions}}
|
{{/versions}}
|
||||||
|
|||||||
@@ -2,21 +2,22 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-type" content="text/html;charset=utf-8">
|
<meta http-equiv="Content-type" content="text/html;charset=utf-8">
|
||||||
<link rel="stylesheet" type="text/css" href="/css/gollum.css" media="all">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}css/gollum.css" media="all">
|
||||||
<link rel="stylesheet" type="text/css" href="/css/editor.css" media="all">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}css/editor.css" media="all">
|
||||||
<link rel="stylesheet" type="text/css" href="/css/dialog.css" media="all">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}css/dialog.css" media="all">
|
||||||
<link rel="stylesheet" type="text/css" href="/css/template.css" media="all">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}css/template.css" media="all">
|
||||||
|
|
||||||
<!--[if IE 7]>
|
<!--[if IE 7]>
|
||||||
<link rel="stylesheet" type="text/css" href="/css/ie7.css" media="all">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}css/ie7.css" media="all">
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
||||||
|
<script>var baseUrl = '{{base_url}}'</script>
|
||||||
|
<script type="text/javascript" src="{{base_url}}javascript/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="{{base_url}}javascript/gollum.js"></script>
|
||||||
|
<script type="text/javascript" src="{{base_url}}javascript/gollum.dialog.js"></script>
|
||||||
|
<script type="text/javascript" src="{{base_url}}javascript/gollum.placeholder.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="/javascript/jquery.js"></script>
|
<script type="text/javascript" src="{{base_url}}javascript/editor/gollum.editor.js"></script>
|
||||||
<script type="text/javascript" src="/javascript/gollum.js"></script>
|
|
||||||
<script type="text/javascript" src="/javascript/gollum.dialog.js"></script>
|
|
||||||
<script type="text/javascript" src="/javascript/gollum.placeholder.js"></script>
|
|
||||||
|
|
||||||
<script type="text/javascript" src="/javascript/editor/gollum.editor.js"></script>
|
|
||||||
{{#mathjax}}<script type="text/javascript" src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>{{/mathjax}}
|
{{#mathjax}}<script type="text/javascript" src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>{{/mathjax}}
|
||||||
<title>{{title}}</title>
|
<title>{{title}}</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -5,17 +5,17 @@
|
|||||||
<li class="minibutton">
|
<li class="minibutton">
|
||||||
{{>searchbar}}
|
{{>searchbar}}
|
||||||
</li>
|
</li>
|
||||||
<li class="minibutton"><a href="/pages"
|
<li class="minibutton"><a href="{{base_url}}pages"
|
||||||
class="action-all-pages">All Pages</a></li>
|
class="action-all-pages">All Pages</a></li>
|
||||||
<li class="minibutton"><a href="/fileview"
|
<li class="minibutton"><a href="{{base_url}}fileview"
|
||||||
class="action-all-pages">File View</a></li>
|
class="action-all-pages">File View</a></li>
|
||||||
<li class="minibutton" class="jaws">
|
<li class="minibutton" class="jaws">
|
||||||
<a href="#" id="minibutton-new-page">New Page</a></li>
|
<a href="#" id="minibutton-new-page">New Page</a></li>
|
||||||
{{#editable}}
|
{{#editable}}
|
||||||
<li class="minibutton"><a href="/edit/{{escaped_url_path}}"
|
<li class="minibutton"><a href="{{base_url}}edit/{{escaped_url_path}}"
|
||||||
class="action-edit-page">Edit Page</a></li>
|
class="action-edit-page">Edit Page</a></li>
|
||||||
{{/editable}}
|
{{/editable}}
|
||||||
<li class="minibutton"><a href="/history/{{escaped_url_path}}"
|
<li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
|
||||||
class="action-page-history">Page History</a></li>
|
class="action-page-history">Page History</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<li class="minibutton">
|
<li class="minibutton">
|
||||||
{{>searchbar}}
|
{{>searchbar}}
|
||||||
</li>
|
</li>
|
||||||
<li class="minibutton"><a href="/"
|
<li class="minibutton"><a href="{{base_url}}"
|
||||||
class="action-edit-page">Home</a></li>
|
class="action-edit-page">Home</a></li>
|
||||||
<li class="minibutton" class="jaws">
|
<li class="minibutton" class="jaws">
|
||||||
<a href="#" id="minibutton-new-page"{{{new_page_data_variables}}}>New Page</a>
|
<a href="#" id="minibutton-new-page"{{{new_page_data_variables}}}>New Page</a>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<li class="minibutton">
|
<li class="minibutton">
|
||||||
{{>searchbar}}
|
{{>searchbar}}
|
||||||
</li>
|
</li>
|
||||||
<li class="minibutton"><a href="/"
|
<li class="minibutton"><a href="{{base_url}}"
|
||||||
class="action-edit-page">Home</a></li>
|
class="action-edit-page">Home</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
{{#results}}
|
{{#results}}
|
||||||
<li>
|
<li>
|
||||||
<a href="/{{name}}">{{name}}</a>
|
<a href="{{base_url}}{{name}}">{{name}}</a>
|
||||||
<span class="count">({{count}} matches)</span>
|
<span class="count">({{count}} matches)</span>
|
||||||
</li>
|
</li>
|
||||||
{{/results}}
|
{{/results}}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<div id="searchbar">
|
<div id="searchbar">
|
||||||
<form action="/search" method="get" id="search-form">
|
<form action="{{base_url}}search" method="get" id="search-form">
|
||||||
<div id="searchbar-fauxtext">
|
<div id="searchbar-fauxtext">
|
||||||
<input type="text" name="q" id="search-query" value="Search…" autocomplete="off">
|
<input type="text" name="q" id="search-query" value="Search…" autocomplete="off">
|
||||||
<a href="#" id="search-submit" title="Search this wiki">
|
<a href="#" id="search-submit" title="Search this wiki">
|
||||||
|
|||||||
@@ -29,14 +29,16 @@ module Precious
|
|||||||
if @page_num == 1
|
if @page_num == 1
|
||||||
%(<span class="disabled">#{label}</span>)
|
%(<span class="disabled">#{label}</span>)
|
||||||
else
|
else
|
||||||
%(<a href="/history/#{@page.name}?page=#{@page_num-1}" hotkey="h">#{label}</a>)
|
link = url("/history/#{@page.name}?page=#{@page_num-1}")
|
||||||
|
%(<a href="#{link}" hotkey="h">#{label}</a>)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def next_link
|
def next_link
|
||||||
label = "Next »"
|
label = "Next »"
|
||||||
if @versions.size == Gollum::Page.per_page
|
if @versions.size == Gollum::Page.per_page
|
||||||
%(<a href="/history/#{@page.name}?page=#{@page_num+1}" hotkey="l">#{label}</a>)
|
link = "/history/#{@page.name}?page=#{@page_num+1}"
|
||||||
|
%(<a href="#{link}" hotkey="l">#{label}</a>)
|
||||||
else
|
else
|
||||||
%(<span class="disabled">#{label}</span>)
|
%(<span class="disabled">#{label}</span>)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ module Precious
|
|||||||
def breadcrumb
|
def breadcrumb
|
||||||
if @path
|
if @path
|
||||||
path = Pathname.new(@path)
|
path = Pathname.new(@path)
|
||||||
breadcrumb = [%{<a href="/pages/">Home</a>}]
|
breadcrumb = [%{<a href="#{@base_url}pages/">Home</a>}]
|
||||||
path.descend do |crumb|
|
path.descend do |crumb|
|
||||||
title = crumb.basename
|
title = crumb.basename
|
||||||
|
|
||||||
if title == path.basename
|
if title == path.basename
|
||||||
breadcrumb << title
|
breadcrumb << title
|
||||||
else
|
else
|
||||||
breadcrumb << %{<a href="/pages/#{crumb}/">#{title}</a>}
|
breadcrumb << %{<a href="#{@base_url}pages/#{crumb}/">#{title}</a>}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ module Precious
|
|||||||
if page_path.include?('/')
|
if page_path.include?('/')
|
||||||
folder = page_path.split('/').first
|
folder = page_path.split('/').first
|
||||||
folder_path = @path ? "#{@path}/#{folder}" : folder
|
folder_path = @path ? "#{@path}/#{folder}" : folder
|
||||||
folder_link = %{<li><a href="/pages/#{folder_path}/" class="folder">#{folder}</a></li>}
|
folder_link = %{<li><a href="#{@base_url}pages/#{folder_path}/" class="folder">#{folder}</a></li>}
|
||||||
|
|
||||||
unless folder_links.include?(folder_link)
|
unless folder_links.include?(folder_link)
|
||||||
folder_links << folder_link
|
folder_links << folder_link
|
||||||
@@ -51,7 +51,7 @@ module Precious
|
|||||||
folder_link
|
folder_link
|
||||||
end
|
end
|
||||||
elsif page_path != ".gitkeep"
|
elsif page_path != ".gitkeep"
|
||||||
%{<li><a href="/#{page.escaped_url_path}" class="file">#{page.name}</a></li>}
|
%{<li><a href="#{@base_url}#{page.escaped_url_path}" class="file">#{page.name}</a></li>}
|
||||||
end
|
end
|
||||||
}.compact.join("\n")
|
}.compact.join("\n")
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user