diff options
author | Michael Gall <michael@wakeless.net> | 2011-05-31 11:38:28 +1000 |
---|---|---|
committer | Philip Arndt <parndt@gmail.com> | 2011-05-31 13:53:56 +1200 |
commit | 60fc7839f8b6227951eed454442b69836840df01 (patch) | |
tree | b34f4b00c7d8616635480befeb5200b68dfacca7 /lib | |
parent | 7bb8b056f5b181cfdc88afa60799f3a669d9913f (diff) | |
download | refinerycms-blog-60fc7839f8b6227951eed454442b69836840df01.tar.gz refinerycms-blog-60fc7839f8b6227951eed454442b69836840df01.tar.bz2 refinerycms-blog-60fc7839f8b6227951eed454442b69836840df01.zip |
Add page-like tab functionality
Diffstat (limited to 'lib')
-rw-r--r-- | lib/refinery/blog/tab.rb | 28 | ||||
-rw-r--r-- | lib/refinerycms-blog.rb | 3 |
2 files changed, 30 insertions, 1 deletions
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 diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 901535d..db9beda 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -2,8 +2,9 @@ require 'filters_spam' module Refinery module Blog - autoload :Version, File.expand_path('../refinery/blog/version', __FILE__) + autoload :Tab, File.expand_path("../refinery/blog/tab", __FILE__) + class << self def version ::Refinery::Blog::Version.to_s |