From d3594f6652384e5eadfe1378e81eb780b1cd0550 Mon Sep 17 00:00:00 2001 From: Tom Clark Date: Sat, 9 Apr 2011 14:09:36 -0700 Subject: [PATCH] Added 'All Pages' route and view --- lib/gollum/frontend/app.rb | 7 ++++ lib/gollum/frontend/templates/page.mustache | 2 ++ lib/gollum/frontend/templates/pages.mustache | 35 ++++++++++++++++++++ lib/gollum/frontend/views/pages.rb | 19 +++++++++++ 4 files changed, 63 insertions(+) create mode 100644 lib/gollum/frontend/templates/pages.mustache create mode 100644 lib/gollum/frontend/views/pages.rb diff --git a/lib/gollum/frontend/app.rb b/lib/gollum/frontend/app.rb index 49687403..f61ea6b5 100644 --- a/lib/gollum/frontend/app.rb +++ b/lib/gollum/frontend/app.rb @@ -169,6 +169,13 @@ module Precious mustache :search 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 show_page_or_file(params[:splat].first) end diff --git a/lib/gollum/frontend/templates/page.mustache b/lib/gollum/frontend/templates/page.mustache index b93dafd3..0cf7a24b 100755 --- a/lib/gollum/frontend/templates/page.mustache +++ b/lib/gollum/frontend/templates/page.mustache @@ -2,6 +2,8 @@ + diff --git a/lib/gollum/frontend/views/pages.rb b/lib/gollum/frontend/views/pages.rb new file mode 100644 index 00000000..c6d6068c --- /dev/null +++ b/lib/gollum/frontend/views/pages.rb @@ -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