Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ensure that Archive may not be an Archive child, and remove index typ…

…es from the list
  • Loading branch information...
commit 8a99e78309f030cb9dcec0e72abb9d23da810fcc 1 parent f5ac93b
@saturnflyer saturnflyer authored
View
9 app/models/archive_menu_renderer.rb
@@ -1,10 +1,13 @@
module ArchiveMenuRenderer
def excluded_class_names
excluded_from_this = Array(ArchiveMenuRenderer.instance_variable_get(:@excluded_class_names))
- if defined?(super)
- return super + excluded_from_this
+ excluded_from_this << 'ArchivePage'
+ result = if defined?(super)
+ super + excluded_from_this
+ else
+ excluded_from_this
end
- excluded_from_this
+ excluded_from_this - ['ArchiveDayIndexPage', 'ArchiveMonthIndexPage', 'ArchiveYearIndexPage']
end
end
View
2  lib/radiant-archive-extension/version.rb
@@ -1,3 +1,3 @@
module RadiantArchiveExtension
- VERSION = '1.0.5'
+ VERSION = '1.0.6'
end
View
21 spec/models/archive_menu_renderer_spec.rb
@@ -5,6 +5,11 @@ def excluded_class_names
['AnotherPage']
end
end
+module ArchiveExcludingMenuRenderer
+ def excluded_class_names
+ ['ArchiveDayIndexPage','ArchiveMonthIndexPage','ArchiveYearIndexPage']
+ end
+end
describe ArchiveMenuRenderer do
context 'excluding classes from child list' do
@@ -22,6 +27,22 @@ def excluded_class_names
page.excluded_class_names.should include('AnotherPage')
end
end
+ context 'excluded_class_names' do
+ before{
+ ArchiveMenuRenderer.instance_variable_set(:@excluded_class_names, ['SkippedPage'])
+ }
+ let(:page){
+ page = Object.new
+ page.extend ArchiveExcludingMenuRenderer
+ page.extend ArchiveMenuRenderer
+ page
+ }
+ subject{ page }
+ its(:excluded_class_names){ should_not include('ArchiveDayIndexPage') }
+ its(:excluded_class_names){ should_not include('ArchiveMonthIndexPage') }
+ its(:excluded_class_names){ should_not include('ArchiveYearIndexPage') }
+ its(:excluded_class_names){ should include('ArchivePage') }
+ end
end
describe ArchiveDayIndexMenuRenderer do
Please sign in to comment.
Something went wrong with that request. Please try again.