+16
-10
@@ -81,6 +81,11 @@ module Precious
|
|||||||
enable :logging, :raise_errors, :dump_errors
|
enable :logging, :raise_errors, :dump_errors
|
||||||
end
|
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
|
get '/' do
|
||||||
show_page_or_file('Home')
|
show_page_or_file('Home')
|
||||||
end
|
end
|
||||||
@@ -107,7 +112,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
|
||||||
@@ -116,7 +121,7 @@ module Precious
|
|||||||
mustache :edit
|
mustache :edit
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
redirect "/create/#{CGI.escape(@name)}"
|
redirect to("/create/#{CGI.escape(@name)}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -138,7 +143,7 @@ module Precious
|
|||||||
|
|
||||||
page = wiki.page(rename) if rename
|
page = wiki.page(rename) if rename
|
||||||
|
|
||||||
redirect "/#{page.escaped_url_path}"
|
redirect to("/#{page.escaped_url_path}")
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/delete/*' do
|
get '/delete/*' do
|
||||||
@@ -149,7 +154,7 @@ module Precious
|
|||||||
@page = wiki.page(@name)
|
@page = wiki.page(@name)
|
||||||
wiki.delete_page(@page, { :message => "Destroyed #{@name} (#{@page.format})" })
|
wiki.delete_page(@page, { :message => "Destroyed #{@name} (#{@page.format})" })
|
||||||
|
|
||||||
redirect '/'
|
redirect to('/')
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/create/*' do
|
get '/create/*' do
|
||||||
@@ -160,7 +165,7 @@ module Precious
|
|||||||
|
|
||||||
page = wiki.page(@name)
|
page = wiki.page(@name)
|
||||||
if page
|
if page
|
||||||
redirect "/#{page.escaped_url_path}"
|
redirect to("/#{page.escaped_url_path}")
|
||||||
else
|
else
|
||||||
mustache :create
|
mustache :create
|
||||||
end
|
end
|
||||||
@@ -177,7 +182,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
|
||||||
@@ -195,7 +200,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]
|
||||||
@@ -232,12 +237,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
|
||||||
|
|
||||||
@@ -340,7 +346,7 @@ module Precious
|
|||||||
file.raw_data
|
file.raw_data
|
||||||
else
|
else
|
||||||
page_path = [path, name].compact.join('/')
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ ol.tree
|
|||||||
padding: 0 0 0 30px;
|
padding: 0 0 0 30px;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
li
|
li
|
||||||
{
|
{
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-left: -15px;
|
margin-left: -15px;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
@@ -72,16 +72,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;
|
||||||
@@ -96,14 +96,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;
|
||||||
@@ -111,10 +111,11 @@ 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;
|
||||||
}
|
}
|
||||||
li input:checked + ol > li { display: block; margin: 0 0 0.125em; /* 2px */}
|
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 */ }
|
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 {
|
#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;
|
||||||
|
|||||||
@@ -277,7 +277,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// attempt to load the definition for this language
|
// 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({
|
$.ajax({
|
||||||
url: script_uri,
|
url: script_uri,
|
||||||
dataType: 'script',
|
dataType: 'script',
|
||||||
|
|||||||
@@ -140,11 +140,11 @@ $(document).ready(function() {
|
|||||||
var msg = 'Renamed ' + oldName + ' to ' + name;
|
var msg = 'Renamed ' + oldName + ' to ' + name;
|
||||||
jQuery.ajax( {
|
jQuery.ajax( {
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/edit/' + oldName,
|
url: baseUrl + '/edit/' + oldName,
|
||||||
// omit path: pathName until https://github.com/github/gollum/issues/446 is fixed.
|
// omit path: pathName until https://github.com/github/gollum/issues/446 is fixed.
|
||||||
data: { rename: name, page: oldName, message: msg },
|
data: { rename: name, page: oldName, message: msg },
|
||||||
success: function() {
|
success: function() {
|
||||||
window.location = '/' + encodeURIComponent(name);
|
window.location = baseUrl + '/' + encodeURIComponent(name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -177,7 +177,7 @@ $(document).ready(function() {
|
|||||||
if ( res['name'] ) {
|
if ( res['name'] ) {
|
||||||
name = 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 );
|
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,19 +97,19 @@ $.save = function( commitMessage ) {
|
|||||||
var markdown = 'markdown';
|
var markdown = 'markdown';
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
newLocation += '/' + pageName;
|
newLocation += '/' + pageName;
|
||||||
|
|
||||||
// if &create=true then handle create instead of edit.
|
// if &create=true then handle create instead of edit.
|
||||||
if ( create ) {
|
if ( create ) {
|
||||||
jQuery.ajax( {
|
jQuery.ajax( {
|
||||||
type: POST,
|
type: POST,
|
||||||
url: '/create',
|
url: baseUrl + '/create',
|
||||||
data: { path: pathName, page: pageName, format: markdown, content: txt, message: commitMessage || msg },
|
data: { path: pathName, page: pageName, format: markdown, content: txt, message: commitMessage || msg },
|
||||||
success: function() {
|
success: function() {
|
||||||
win.location = newLocation;
|
win.location = newLocation;
|
||||||
@@ -115,7 +118,7 @@ $.save = function( commitMessage ) {
|
|||||||
} else {
|
} else {
|
||||||
jQuery.ajax( {
|
jQuery.ajax( {
|
||||||
type: POST,
|
type: POST,
|
||||||
url: '/edit/' + pageName,
|
url: baseUrl + '/edit/' + pageName,
|
||||||
data: { path: pathName, page: pageName, format: markdown, content: txt, message: commitMessage || msg },
|
data: { path: pathName, page: pageName, format: markdown, content: txt, message: commitMessage || msg },
|
||||||
success: function() {
|
success: function() {
|
||||||
win.location = newLocation;
|
win.location = newLocation;
|
||||||
@@ -331,7 +334,7 @@ var applyTimeout = function () {
|
|||||||
if ( !~location.host.indexOf('github.com') ) {
|
if ( !~location.host.indexOf('github.com') ) {
|
||||||
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 );
|
||||||
}
|
}
|
||||||
@@ -390,10 +393,10 @@ var applyTimeout = function () {
|
|||||||
var widthFourth = widthHalf / 2;
|
var widthFourth = widthHalf / 2;
|
||||||
var height = $( win ).height();
|
var height = $( win ).height();
|
||||||
var heightHalf = height / 2;
|
var heightHalf = height / 2;
|
||||||
|
|
||||||
// height minus 50 so the end of document text doesn't flow off the page.
|
// height minus 50 so the end of document text doesn't flow off the page.
|
||||||
var editorContainerStyle = 'width:' + widthHalf + 'px;' +
|
var editorContainerStyle = 'width:' + widthHalf + 'px;' +
|
||||||
'height:' + (height - 50) + 'px;' +
|
'height:' + (height - 50) + 'px;' +
|
||||||
'left:' + (leftRight === false ? widthHalf + 'px;' : '0px;') +
|
'left:' + (leftRight === false ? widthHalf + 'px;' : '0px;') +
|
||||||
'top:' + '40px;'; // use 40px for tool menu
|
'top:' + '40px;'; // use 40px for tool menu
|
||||||
cssSet( editorContainer, editorContainerStyle );
|
cssSet( editorContainer, editorContainerStyle );
|
||||||
|
|||||||
@@ -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,9 +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">
|
||||||
<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/template.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/_styles.css" media="all">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}css/_styles.css" media="all">
|
||||||
<title>{{title}}</title>
|
<title>{{title}}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -12,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>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -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,28 +2,29 @@
|
|||||||
<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 type="text/javascript" src="/javascript/jquery-1.7.2.min.js"></script>
|
<script>var baseUrl = '{{base_url}}'</script>
|
||||||
<script type="text/javascript" src="/javascript/mousetrap.min.js"></script>
|
<script type="text/javascript" src="{{base_url}}javascript/jquery-1.7.2.min.js"></script>
|
||||||
<script type="text/javascript" src="/javascript/gollum.js"></script>
|
<script type="text/javascript" src="{{base_url}}javascript/mousetrap.min.js"></script>
|
||||||
<script type="text/javascript" src="/javascript/gollum.dialog.js"></script>
|
<script type="text/javascript" src="{{base_url}}javascript/gollum.js"></script>
|
||||||
<script type="text/javascript" src="/javascript/gollum.placeholder.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/editor/gollum.editor.js"></script>
|
<script type="text/javascript" src="{{base_url}}javascript/editor/gollum.editor.js"></script>
|
||||||
{{#mathjax}}<script>(function(d,j){
|
{{#mathjax}}<script>(function(d,j){
|
||||||
j = d.createElement('script');
|
j = d.createElement('script');
|
||||||
j.src = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
|
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);
|
(d.head || d.getElementsByTagName('head')[0]).appendChild(j);
|
||||||
}(document));
|
}(document));
|
||||||
</script>{{/mathjax}}
|
</script>{{/mathjax}}
|
||||||
|
|
||||||
<title>{{title}}</title>
|
<title>{{title}}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -5,19 +5,19 @@
|
|||||||
<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</a></li>
|
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>
|
class="action-all-pages">Files</a></li>
|
||||||
<li class="minibutton" class="jaws">
|
<li class="minibutton" class="jaws">
|
||||||
<a href="#" id="minibutton-new-page">New</a></li>
|
<a href="#" id="minibutton-new-page">New</a></li>
|
||||||
<li class="minibutton" class="jaws">
|
<li class="minibutton" class="jaws">
|
||||||
<a href="#" id="minibutton-rename-page">Rename</a></li>
|
<a href="#" id="minibutton-rename-page">Rename</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</a></li>
|
class="action-edit-page">Edit</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">History</a></li>
|
class="action-page-history">History</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
<div id="footer">
|
<div id="footer">
|
||||||
<p id="last-edit">Last edited by <b>{{author}}</b>, {{date}}</p>
|
<p id="last-edit">Last edited by <b>{{author}}</b>, {{date}}</p>
|
||||||
<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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</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
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ module Precious
|
|||||||
def has_path
|
def has_path
|
||||||
!@path.nil?
|
!@path.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def base_url
|
||||||
|
@base_url
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
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
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ context "Precious::Views::Pages" do
|
|||||||
|
|
||||||
test "breadcrumb" do
|
test "breadcrumb" do
|
||||||
@page.instance_variable_set("@path", "Mordor/Eye-Of-Sauron/Saruman")
|
@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
|
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
|
end
|
||||||
|
|
||||||
@@ -28,6 +29,7 @@ context "Precious::Views::Pages" do
|
|||||||
|
|
||||||
test "files_folders" do
|
test "files_folders" do
|
||||||
@page.instance_variable_set("@path", "Mordor")
|
@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")]
|
results = [FakeResult.new("Mordor/Eye-Of-Sauron.md"), FakeResult.new("Mordor/Orc/Saruman.md"), FakeResult.new("Mordor/.gitkeep")]
|
||||||
@page.instance_variable_set("@results", results)
|
@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
|
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