noodall-core 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.5
1
+ 0.3.6
data/lib/noodall/node.rb CHANGED
@@ -258,7 +258,7 @@ module Noodall
258
258
  self.name = self.title if self.name.blank?
259
259
  end
260
260
 
261
- module ClassMethods
261
+ class << self
262
262
  @@slots = []
263
263
 
264
264
  # Set the names of the slots that will be avaiable to fill with components
@@ -304,13 +304,18 @@ module Noodall
304
304
  end
305
305
 
306
306
  def template_classes
307
- return @template_classes if @template_classes
307
+ return root_templates if self == Noodall::Node
308
+ @template_classes || []
309
+ end
310
+
311
+ def root_templates
312
+ return @root_templates if @root_templates
308
313
  classes = []
309
314
  ObjectSpace.each_object(Class) do |c|
310
315
  next unless c.ancestors.include?(Noodall::Node) and (c != Noodall::Node) and c.root_template?
311
316
  classes << c
312
317
  end
313
- @template_classes = classes
318
+ @root_templates = classes
314
319
  end
315
320
 
316
321
  def template_names
@@ -353,8 +358,6 @@ module Noodall
353
358
  Time.zone ? Time.zone.now : Time.now
354
359
  end
355
360
  end
356
- extend ClassMethods
357
-
358
361
 
359
362
  end
360
363
 
data/noodall-core.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{noodall-core}
8
- s.version = "0.3.5"
8
+ s.version = "0.3.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Steve England"]
12
- s.date = %q{2010-12-09}
12
+ s.date = %q{2010-12-13}
13
13
  s.description = %q{Core data objects for Noodall}
14
14
  s.email = %q{steve@wearebeef.co.uk}
15
15
  s.extra_rdoc_files = [
data/spec/node_spec.rb CHANGED
@@ -344,17 +344,29 @@ describe Noodall::Node do
344
344
  end
345
345
 
346
346
  it "should know who can be a parent" do
347
- class LandindPage < Noodall::Node
347
+ class LandingPage < Noodall::Node
348
348
  sub_templates Page
349
349
  end
350
350
  class ArticlesList < Noodall::Node
351
- sub_templates LandindPage
351
+ sub_templates LandingPage
352
352
  end
353
353
 
354
354
  Page.parent_classes.should include(LandingPage)
355
355
  Page.parent_classes.should_not include(ArticlesList)
356
356
  end
357
357
 
358
+ it "should know what sub templates are allowed" do
359
+ class LandingPage < Noodall::Node
360
+ root_template!
361
+ sub_templates Page, LandingPage
362
+ end
363
+ class Article < Noodall::Node
364
+ end
365
+
366
+ LandingPage.template_classes.should include(Page)
367
+ Article.template_classes.should have(0).things
368
+ end
369
+
358
370
  it "should fall back to title for link name if it is blank" do
359
371
  page = Factory(:page, :title => "My Long Title that is long")
360
372
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noodall-core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 5
10
- version: 0.3.5
9
+ - 6
10
+ version: 0.3.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Steve England
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-09 00:00:00 +00:00
18
+ date: 2010-12-13 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency