From 2dc08f3a496af8ddf8bdbb760b551494ffdefeb2 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 31 May 2011 14:16:04 +1200 Subject: tab -> tabs and requiring the file on to_prepare so that it actually loads. Fixed specs now that the form 'looks' different. --- features/authors.feature | 2 +- features/tags.feature | 2 +- lib/refinery/blog/tab.rb | 28 ---------------------------- lib/refinery/blog/tabs.rb | 28 ++++++++++++++++++++++++++++ lib/refinerycms-blog.rb | 8 ++++++-- 5 files changed, 36 insertions(+), 32 deletions(-) delete mode 100644 lib/refinery/blog/tab.rb create mode 100644 lib/refinery/blog/tabs.rb diff --git a/features/authors.feature b/features/authors.feature index 0e17e32..f3fd3ec 100644 --- a/features/authors.feature +++ b/features/authors.feature @@ -8,7 +8,7 @@ Feature: Blog Post Authors When I am on the new blog post form And I fill in "Title" with "This is my blog post" - And I fill in "Body" with "And I love it" + And I fill in "blog_post_body" with "And I love it" And I press "Save" Then there should be 1 blog post diff --git a/features/tags.feature b/features/tags.feature index 05d6028..24dff2a 100644 --- a/features/tags.feature +++ b/features/tags.feature @@ -12,7 +12,7 @@ Feature: Blog Post Tags Scenario: The blog post new/edit form saves tag_list When I am on the new blog post form And I fill in "Title" with "This is my blog post" - And I fill in "Body" with "And I love it" + And I fill in "blog_post_body" with "And I love it" And I fill in "Tags" with "chicago, bikes, beers, babes" And I press "Save" diff --git a/lib/refinery/blog/tab.rb b/lib/refinery/blog/tab.rb deleted file mode 100644 index 083d50b..0000000 --- a/lib/refinery/blog/tab.rb +++ /dev/null @@ -1,28 +0,0 @@ -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/refinery/blog/tabs.rb b/lib/refinery/blog/tabs.rb new file mode 100644 index 0000000..083d50b --- /dev/null +++ b/lib/refinery/blog/tabs.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 db9beda..407b840 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -3,8 +3,8 @@ 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__) - + autoload :Tab, File.expand_path("../refinery/blog/tabs", __FILE__) + class << self def version ::Refinery::Blog::Version.to_s @@ -16,6 +16,10 @@ module Refinery app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public" end + config.to_prepare do + require File.expand_path('../refinery/blog/tabs', __FILE__) + end + config.after_initialize do Refinery::Plugin.register do |plugin| plugin.name = "refinerycms_blog" -- cgit v1.2.3