From 60fc7839f8b6227951eed454442b69836840df01 Mon Sep 17 00:00:00 2001 From: Michael Gall Date: Tue, 31 May 2011 11:38:28 +1000 Subject: Add page-like tab functionality --- lib/refinery/blog/tab.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib/refinery/blog/tab.rb (limited to 'lib/refinery') diff --git a/lib/refinery/blog/tab.rb b/lib/refinery/blog/tab.rb new file mode 100644 index 0000000..083d50b --- /dev/null +++ b/lib/refinery/blog/tab.rb @@ -0,0 +1,28 @@ +module Refinery + module Blog + attr_accessor :tabs + + def self.tabs + @tabs ||= [] + end + + class Tab + attr_accessor :name, :partial + + def self.register(&block) + tab = self.new + + yield tab + + raise "A tab MUST have a name!: #{tab.inspect}" if tab.name.blank? + raise "A tab MUST have a partial!: #{tab.inspect}" if tab.partial.blank? + end + + protected + + def initialize + ::Refinery::Blog.tabs << self # add me to the collection of registered page tabs + end + end + end +end \ No newline at end of file -- cgit v1.2.3