From dbe007e7c87790ade92406ddfb32819738026427 Mon Sep 17 00:00:00 2001 From: Lars Henrik Mai Date: Sat, 12 Apr 2014 13:13:59 +0200 Subject: added recent wiki changes section to frontpage --- helpers/wiki_helpers.rb | 26 ++++++++++++++++++++++++++ source/_wiki_changes.html.erb | 15 +++++++++++++++ source/index.html.erb | 37 +++++++++++++++++++++++-------------- 3 files changed, 64 insertions(+), 14 deletions(-) create mode 100644 helpers/wiki_helpers.rb create mode 100644 source/_wiki_changes.html.erb diff --git a/helpers/wiki_helpers.rb b/helpers/wiki_helpers.rb new file mode 100644 index 0000000..95e8268 --- /dev/null +++ b/helpers/wiki_helpers.rb @@ -0,0 +1,26 @@ +require 'date' +require 'addressable/template' + +module WikiHelpers + + RecentChangesItem = Struct.new(:username, :page, :datetime, :changelog) + + WikiPageUrl = Addressable::Template.new("http://sublab.org/wiki/ikiwiki.cgi{?page}&do=goto") + + def wiki_changes(count=3) + # mockup for now + + [ + RecentChangesItem.new("Woruman", "techniksprechstunde", DateTime.parse("2014-04-11 21:25:54")), + RecentChangesItem.new("drnerd", "techniksprechstunde", DateTime.parse("2014-04-10 20:09:44")), + RecentChangesItem.new("jackrandom", "coreboot-x201", DateTime.parse("2014-04-08 12:52:15"), "USB Boot patch now obsolete") + ] + + end + + def link_to_wiki(name) + url = WikiPageUrl.expand({page: name}).to_s + link_to escape_html(name), url + end + +end diff --git a/source/_wiki_changes.html.erb b/source/_wiki_changes.html.erb new file mode 100644 index 0000000..a691bfb --- /dev/null +++ b/source/_wiki_changes.html.erb @@ -0,0 +1,15 @@ +