+16
-10
@@ -81,6 +81,11 @@ module Precious
|
||||
enable :logging, :raise_errors, :dump_errors
|
||||
end
|
||||
|
||||
before do
|
||||
@base_url = url('/')
|
||||
settings.wiki_options.merge!({ :base_path => @base_url }) unless settings.wiki_options.has_key? :base_path
|
||||
end
|
||||
|
||||
get '/' do
|
||||
show_page_or_file('Home')
|
||||
end
|
||||
@@ -107,7 +112,7 @@ module Precious
|
||||
if @path
|
||||
live_preview_url << '&path=' + encodeURIComponent(@path)
|
||||
end
|
||||
redirect live_preview_url
|
||||
redirect to(live_preview_url)
|
||||
else
|
||||
@page = page
|
||||
@page.version = wiki.repo.log(wiki.ref, @page.path).first
|
||||
@@ -116,7 +121,7 @@ module Precious
|
||||
mustache :edit
|
||||
end
|
||||
else
|
||||
redirect "/create/#{CGI.escape(@name)}"
|
||||
redirect to("/create/#{CGI.escape(@name)}")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -138,7 +143,7 @@ module Precious
|
||||
|
||||
page = wiki.page(rename) if rename
|
||||
|
||||
redirect "/#{page.escaped_url_path}"
|
||||
redirect to("/#{page.escaped_url_path}")
|
||||
end
|
||||
|
||||
get '/delete/*' do
|
||||
@@ -149,7 +154,7 @@ module Precious
|
||||
@page = wiki.page(@name)
|
||||
wiki.delete_page(@page, { :message => "Destroyed #{@name} (#{@page.format})" })
|
||||
|
||||
redirect '/'
|
||||
redirect to('/')
|
||||
end
|
||||
|
||||
get '/create/*' do
|
||||
@@ -160,7 +165,7 @@ module Precious
|
||||
|
||||
page = wiki.page(@name)
|
||||
if page
|
||||
redirect "/#{page.escaped_url_path}"
|
||||
redirect to("/#{page.escaped_url_path}")
|
||||
else
|
||||
mustache :create
|
||||
end
|
||||
@@ -177,7 +182,7 @@ module Precious
|
||||
begin
|
||||
wiki.write_page(name, format, params[:content], commit_message)
|
||||
page = wiki.page(name)
|
||||
redirect "/#{page.escaped_url_path}"
|
||||
redirect to("/#{page.escaped_url_path}")
|
||||
rescue Gollum::DuplicatePageError => e
|
||||
@message = "Duplicate page: #{e.message}"
|
||||
mustache :error
|
||||
@@ -195,7 +200,7 @@ module Precious
|
||||
sha2 = shas.shift
|
||||
|
||||
if wiki.revert_page(@page, sha1, sha2, commit_message)
|
||||
redirect "/#{@page.escaped_url_path}"
|
||||
redirect to("/#{@page.escaped_url_path}")
|
||||
else
|
||||
sha2, sha1 = sha1, "#{sha1}^" if !sha2
|
||||
@versions = [sha1, sha2]
|
||||
@@ -232,12 +237,13 @@ module Precious
|
||||
@file = params[:splat].first
|
||||
@versions = params[:versions] || []
|
||||
if @versions.size < 2
|
||||
redirect "/history/#{@file}"
|
||||
redirect to("/history/#{@file}")
|
||||
else
|
||||
redirect "/compare/%s/%s...%s" % [
|
||||
redirect to("/compare/%s/%s...%s" % [
|
||||
@file,
|
||||
@versions.last,
|
||||
@versions.first]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -340,7 +346,7 @@ module Precious
|
||||
file.raw_data
|
||||
else
|
||||
page_path = [path, name].compact.join('/')
|
||||
redirect "/create/#{CGI.escape(page_path).gsub('%2F','/')}"
|
||||
redirect to("/create/#{CGI.escape(page_path).gsub('%2F','/')}")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -59,9 +59,9 @@ ol.tree
|
||||
padding: 0 0 0 30px;
|
||||
width: 300px;
|
||||
}
|
||||
li
|
||||
{
|
||||
position: relative;
|
||||
li
|
||||
{
|
||||
position: relative;
|
||||
margin-left: -15px;
|
||||
list-style: none;
|
||||
}
|
||||
@@ -72,16 +72,16 @@ ol.tree
|
||||
}
|
||||
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;
|
||||
padding-left: 21px;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
}
|
||||
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 $= '.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 *= '.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 $= '.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 input
|
||||
{
|
||||
position: absolute;
|
||||
@@ -96,14 +96,14 @@ ol.tree
|
||||
}
|
||||
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 */
|
||||
height: 1.5em;
|
||||
}
|
||||
li input + ol > li { display: none; margin-left: -14px !important; padding-left: 1px; }
|
||||
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;
|
||||
display: block;
|
||||
padding-left: 37px;
|
||||
@@ -111,10 +111,11 @@ ol.tree
|
||||
|
||||
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 */
|
||||
padding: 1.563em 0 0 80px;
|
||||
height: auto;
|
||||
}
|
||||
li input:checked + ol > li { display: block; margin: 0 0 0.125em; /* 2px */}
|
||||
li input:checked + ol > li:last-child { margin: 0 0 0.063em; /* 1px */ }
|
||||
|
||||
|
||||
@@ -662,7 +662,7 @@ ul.actions {
|
||||
}
|
||||
|
||||
#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-repeat: no-repeat;
|
||||
display: block;
|
||||
|
||||
@@ -77,7 +77,7 @@ a.absent {
|
||||
.markdown-body h4:hover a.anchor,
|
||||
.markdown-body h5: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;
|
||||
}
|
||||
.markdown-body h1 tt,
|
||||
@@ -133,7 +133,7 @@ a.absent {
|
||||
margin: 15px 0;
|
||||
}
|
||||
.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;
|
||||
color: #ccc;
|
||||
height: 4px;
|
||||
|
||||
@@ -277,7 +277,7 @@
|
||||
}
|
||||
|
||||
// attempt to load the definition for this language
|
||||
var script_uri = '/javascript/editor/langs/' + markup_name + '.js';
|
||||
var script_uri = baseUrl + '/javascript/editor/langs/' + markup_name + '.js';
|
||||
$.ajax({
|
||||
url: script_uri,
|
||||
dataType: 'script',
|
||||
|
||||
@@ -140,11 +140,11 @@ $(document).ready(function() {
|
||||
var msg = 'Renamed ' + oldName + ' to ' + name;
|
||||
jQuery.ajax( {
|
||||
type: 'POST',
|
||||
url: '/edit/' + oldName,
|
||||
url: baseUrl + '/edit/' + oldName,
|
||||
// omit path: pathName until https://github.com/github/gollum/issues/446 is fixed.
|
||||
data: { rename: name, page: oldName, message: msg },
|
||||
success: function() {
|
||||
window.location = '/' + encodeURIComponent(name);
|
||||
window.location = baseUrl + '/' + encodeURIComponent(name);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -177,7 +177,7 @@ $(document).ready(function() {
|
||||
if ( res['name'] ) {
|
||||
name = res['name'];
|
||||
}
|
||||
window.location = '/' + encodeURIComponent(name);
|
||||
window.location = baseUrl + '/' + encodeURIComponent(name);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -58,6 +58,9 @@ var commentEditorContainer = commentEditor.container;
|
||||
|
||||
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
|
||||
$.key = function( key ) {
|
||||
var value = new RegExp( '[\\?&]' + key + '=([^&#]*)' ).exec( location.href );
|
||||
@@ -94,19 +97,19 @@ $.save = function( commitMessage ) {
|
||||
var markdown = 'markdown';
|
||||
var txt = editorSession.getValue();
|
||||
var msg = defaultCommitMessage();
|
||||
var newLocation = location.protocol + '//' + location.host;
|
||||
var newLocation = location.protocol + '//' + location.host + baseUrl;
|
||||
|
||||
if (pathName) {
|
||||
newLocation += '/' + pathName;
|
||||
}
|
||||
|
||||
|
||||
newLocation += '/' + pageName;
|
||||
|
||||
// if &create=true then handle create instead of edit.
|
||||
if ( create ) {
|
||||
jQuery.ajax( {
|
||||
type: POST,
|
||||
url: '/create',
|
||||
url: baseUrl + '/create',
|
||||
data: { path: pathName, page: pageName, format: markdown, content: txt, message: commitMessage || msg },
|
||||
success: function() {
|
||||
win.location = newLocation;
|
||||
@@ -115,7 +118,7 @@ $.save = function( commitMessage ) {
|
||||
} else {
|
||||
jQuery.ajax( {
|
||||
type: POST,
|
||||
url: '/edit/' + pageName,
|
||||
url: baseUrl + '/edit/' + pageName,
|
||||
data: { path: pathName, page: pageName, format: markdown, content: txt, message: commitMessage || msg },
|
||||
success: function() {
|
||||
win.location = newLocation;
|
||||
@@ -331,7 +334,7 @@ var applyTimeout = function () {
|
||||
if ( !~location.host.indexOf('github.com') ) {
|
||||
jQuery.ajax( {
|
||||
type: 'GET',
|
||||
url: '/data/' + $.key( 'page' ),
|
||||
url: baseUrl + '/data/' + $.key( 'page' ),
|
||||
success: function( data ) {
|
||||
editorSession.setValue( data );
|
||||
}
|
||||
@@ -390,10 +393,10 @@ var applyTimeout = function () {
|
||||
var widthFourth = widthHalf / 2;
|
||||
var height = $( win ).height();
|
||||
var heightHalf = height / 2;
|
||||
|
||||
|
||||
// height minus 50 so the end of document text doesn't flow off the page.
|
||||
var editorContainerStyle = 'width:' + widthHalf + 'px;' +
|
||||
'height:' + (height - 50) + 'px;' +
|
||||
'height:' + (height - 50) + 'px;' +
|
||||
'left:' + (leftRight === false ? widthHalf + 'px;' : '0px;') +
|
||||
'top:' + '40px;'; // use 40px for tool menu
|
||||
cssSet( editorContainer, editorContainerStyle );
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<li class="minibutton">
|
||||
{{>searchbar}}
|
||||
</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>
|
||||
<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>
|
||||
<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>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -23,10 +23,10 @@
|
||||
|
||||
{{#show_revert}}
|
||||
<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>
|
||||
<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>
|
||||
</form>
|
||||
</li>
|
||||
@@ -49,7 +49,7 @@
|
||||
</div>
|
||||
<div id="footer">
|
||||
<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>
|
||||
{{#show_revert}}
|
||||
<li class="minibutton">
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<div id="head">
|
||||
<h1>Editing <strong>{{title}}</strong></h1>
|
||||
<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>
|
||||
<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>
|
||||
</ul>
|
||||
</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}}">
|
||||
{{#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_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}}
|
||||
<fieldset id="gollum-editor-fields">
|
||||
{{#is_create_page}}
|
||||
@@ -126,7 +126,7 @@
|
||||
|
||||
<span class="jaws"><br></span>
|
||||
<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>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
<head>
|
||||
<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="/css/template.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="/css/_styles.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}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="{{base_url}}css/_styles.css" media="all">
|
||||
<title>{{title}}</title>
|
||||
</head>
|
||||
<body>
|
||||
@@ -12,7 +12,7 @@
|
||||
<div id="home_button">
|
||||
<ul class="actions">
|
||||
<li class="minibutton">
|
||||
<a href="/" class="action-edit-page">Home</a>
|
||||
<a href="{{base_url}}" class="action-edit-page">Home</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
<li class="minibutton">
|
||||
{{>searchbar}}
|
||||
</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>
|
||||
<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>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -19,7 +19,7 @@
|
||||
</ul>
|
||||
|
||||
<form name="compare-versions" id="version-form" method="post"
|
||||
action="/compare/{{escaped_url_path}}">
|
||||
action="{{base_url}}compare/{{escaped_url_path}}">
|
||||
<fieldset>
|
||||
<table>
|
||||
<tbody>
|
||||
@@ -39,7 +39,7 @@
|
||||
<td class="commit-name">
|
||||
<span class="time-elapsed">{{date}}:</span>
|
||||
{{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>
|
||||
</tr>
|
||||
{{/versions}}
|
||||
|
||||
@@ -2,28 +2,29 @@
|
||||
<html>
|
||||
<head>
|
||||
<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="/css/editor.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="/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/gollum.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}css/editor.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}css/dialog.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="{{base_url}}css/template.css" media="all">
|
||||
|
||||
<!--[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]-->
|
||||
|
||||
<script type="text/javascript" src="/javascript/jquery-1.7.2.min.js"></script>
|
||||
<script type="text/javascript" src="/javascript/mousetrap.min.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>
|
||||
<script>var baseUrl = '{{base_url}}'</script>
|
||||
<script type="text/javascript" src="{{base_url}}javascript/jquery-1.7.2.min.js"></script>
|
||||
<script type="text/javascript" src="{{base_url}}javascript/mousetrap.min.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="{{base_url}}javascript/editor/gollum.editor.js"></script>
|
||||
{{#mathjax}}<script>(function(d,j){
|
||||
j = d.createElement('script');
|
||||
j.src = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
|
||||
(d.head || d.getElementsByTagName('head')[0]).appendChild(j);
|
||||
}(document));
|
||||
</script>{{/mathjax}}
|
||||
|
||||
<title>{{title}}</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -5,19 +5,19 @@
|
||||
<li class="minibutton">
|
||||
{{>searchbar}}
|
||||
</li>
|
||||
<li class="minibutton"><a href="/pages"
|
||||
<li class="minibutton"><a href="{{base_url}}pages"
|
||||
class="action-all-pages">All</a></li>
|
||||
<li class="minibutton"><a href="/fileview"
|
||||
<li class="minibutton"><a href="{{base_url}}fileview"
|
||||
class="action-all-pages">Files</a></li>
|
||||
<li class="minibutton" class="jaws">
|
||||
<a href="#" id="minibutton-new-page">New</a></li>
|
||||
<li class="minibutton" class="jaws">
|
||||
<a href="#" id="minibutton-rename-page">Rename</a></li>
|
||||
{{#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</a></li>
|
||||
{{/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">History</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -60,7 +60,7 @@
|
||||
<div id="footer">
|
||||
<p id="last-edit">Last edited by <b>{{author}}</b>, {{date}}</p>
|
||||
<p>
|
||||
<a id="delete-link" href="{{escaped_url_path}}" data-confirm="Are you sure you want to delete this page?"><span>Delete this Page</span></a>
|
||||
<a id="delete-link" href="{{base_url}}/{{escaped_url_path}}" data-confirm="Are you sure you want to delete this page?"><span>Delete this Page</span></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<li class="minibutton">
|
||||
{{>searchbar}}
|
||||
</li>
|
||||
<li class="minibutton"><a href="/"
|
||||
<li class="minibutton"><a href="{{base_url}}"
|
||||
class="action-edit-page">Home</a></li>
|
||||
<li class="minibutton" class="jaws">
|
||||
<a href="#" id="minibutton-new-page"{{{new_page_data_variables}}}>New Page</a>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<li class="minibutton">
|
||||
{{>searchbar}}
|
||||
</li>
|
||||
<li class="minibutton"><a href="/"
|
||||
<li class="minibutton"><a href="{{base_url}}"
|
||||
class="action-edit-page">Home</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -15,7 +15,7 @@
|
||||
<ul>
|
||||
{{#results}}
|
||||
<li>
|
||||
<a href="/{{name}}">{{name}}</a>
|
||||
<a href="{{base_url}}{{name}}">{{name}}</a>
|
||||
<span class="count">({{count}} matches)</span>
|
||||
</li>
|
||||
{{/results}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<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">
|
||||
<input type="text" name="q" id="search-query" value="Search…" autocomplete="off">
|
||||
<a href="#" id="search-submit" title="Search this wiki">
|
||||
|
||||
@@ -29,14 +29,16 @@ module Precious
|
||||
if @page_num == 1
|
||||
%(<span class="disabled">#{label}</span>)
|
||||
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
|
||||
|
||||
def next_link
|
||||
label = "Next »"
|
||||
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
|
||||
%(<span class="disabled">#{label}</span>)
|
||||
end
|
||||
|
||||
@@ -19,6 +19,10 @@ module Precious
|
||||
def has_path
|
||||
!@path.nil?
|
||||
end
|
||||
|
||||
def base_url
|
||||
@base_url
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,14 +16,14 @@ module Precious
|
||||
def breadcrumb
|
||||
if @path
|
||||
path = Pathname.new(@path)
|
||||
breadcrumb = [%{<a href="/pages/">Home</a>}]
|
||||
breadcrumb = [%{<a href="#{@base_url}pages/">Home</a>}]
|
||||
path.descend do |crumb|
|
||||
title = crumb.basename
|
||||
|
||||
if title == path.basename
|
||||
breadcrumb << title
|
||||
else
|
||||
breadcrumb << %{<a href="/pages/#{crumb}/">#{title}</a>}
|
||||
breadcrumb << %{<a href="#{@base_url}pages/#{crumb}/">#{title}</a>}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,7 +43,7 @@ module Precious
|
||||
if page_path.include?('/')
|
||||
folder = page_path.split('/').first
|
||||
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)
|
||||
folder_links << folder_link
|
||||
@@ -51,7 +51,7 @@ module Precious
|
||||
folder_link
|
||||
end
|
||||
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
|
||||
}.compact.join("\n")
|
||||
else
|
||||
|
||||
@@ -19,6 +19,7 @@ context "Precious::Views::Pages" do
|
||||
|
||||
test "breadcrumb" do
|
||||
@page.instance_variable_set("@path", "Mordor/Eye-Of-Sauron/Saruman")
|
||||
@page.instance_variable_set("@base_url", "/")
|
||||
assert_equal '<a href="/pages/">Home</a> / <a href="/pages/Mordor/">Mordor</a> / <a href="/pages/Mordor/Eye-Of-Sauron/">Eye-Of-Sauron</a> / Saruman', @page.breadcrumb
|
||||
end
|
||||
|
||||
@@ -28,6 +29,7 @@ context "Precious::Views::Pages" do
|
||||
|
||||
test "files_folders" do
|
||||
@page.instance_variable_set("@path", "Mordor")
|
||||
@page.instance_variable_set("@base_url", "/")
|
||||
results = [FakeResult.new("Mordor/Eye-Of-Sauron.md"), FakeResult.new("Mordor/Orc/Saruman.md"), FakeResult.new("Mordor/.gitkeep")]
|
||||
@page.instance_variable_set("@results", results)
|
||||
assert_equal %{<li><a href="/Mordor/Eye-Of-Sauron" class="file">Eye Of Sauron</a></li>\n<li><a href="/pages/Mordor/Orc/" class="folder">Orc</a></li>}, @page.files_folders
|
||||
|
||||
Reference in New Issue
Block a user