Added 'All Pages' route and view
This commit is contained in:
@@ -169,6 +169,13 @@ module Precious
|
|||||||
mustache :search
|
mustache :search
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get '/pages' do
|
||||||
|
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||||
|
@results = wiki.pages
|
||||||
|
@ref = wiki.ref
|
||||||
|
mustache :pages
|
||||||
|
end
|
||||||
|
|
||||||
get '/*' do
|
get '/*' do
|
||||||
show_page_or_file(params[:splat].first)
|
show_page_or_file(params[:splat].first)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
<div id="head">
|
<div id="head">
|
||||||
<h1>{{title}}</h1>
|
<h1>{{title}}</h1>
|
||||||
<ul class="actions">
|
<ul class="actions">
|
||||||
|
<li class="minibutton"><a href="/pages"
|
||||||
|
class="action-all-pages">All Pages</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>
|
||||||
<li class="minibutton"><a href="/edit/{{escaped_name}}"
|
<li class="minibutton"><a href="/edit/{{escaped_name}}"
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<div id="wiki-wrapper" class="results">
|
||||||
|
<div id="head">
|
||||||
|
<h1>{{title}}</h1>
|
||||||
|
<ul class="actions">
|
||||||
|
<li class="minibutton"><a href="/"
|
||||||
|
class="action-edit-page">Home</a></li>
|
||||||
|
</ul>
|
||||||
|
{{>searchbar}}
|
||||||
|
</div>
|
||||||
|
<div id="results">
|
||||||
|
|
||||||
|
{{#has_results}}
|
||||||
|
<ul>
|
||||||
|
{{#results}}
|
||||||
|
<li>
|
||||||
|
<a href="/{{name}}">{{name}}</a>
|
||||||
|
</li>
|
||||||
|
{{/results}}
|
||||||
|
</ul>
|
||||||
|
{{/has_results}}
|
||||||
|
|
||||||
|
{{#no_results}}
|
||||||
|
<p id="no-results">
|
||||||
|
There are no pages in <strong>{{ref}}</strong>.
|
||||||
|
</p>
|
||||||
|
{{/no_results}}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="footer">
|
||||||
|
<ul class="actions">
|
||||||
|
<li class="minibutton"><a href="#">Back to Top</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
module Precious
|
||||||
|
module Views
|
||||||
|
class Pages < Layout
|
||||||
|
attr_reader :results, :ref
|
||||||
|
|
||||||
|
def title
|
||||||
|
"All pages in #{@ref}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def has_results
|
||||||
|
!@results.empty?
|
||||||
|
end
|
||||||
|
|
||||||
|
def no_results
|
||||||
|
@results.empty?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user