From 601f2b9c185110e060d968fd95f89c67a6f02081 Mon Sep 17 00:00:00 2001 From: Jankees van Woezik Date: Fri, 1 Feb 2013 08:12:05 +0100 Subject: [PATCH 1/2] Show error to tell developer they added a styleguide block for an undefined section. --- app/helpers/kss/application_helper.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/helpers/kss/application_helper.rb b/app/helpers/kss/application_helper.rb index 361a95e..20ecfed 100644 --- a/app/helpers/kss/application_helper.rb +++ b/app/helpers/kss/application_helper.rb @@ -7,6 +7,9 @@ def styleguide_block(section, &block) raise ArgumentError, "Missing block" unless block_given? @section = styleguide.section(section) + + raise "KSS styleguide section is nil, is section: '#{section}' defined in your css?" unless @section.raw + content = capture(&block) render 'kss/shared/styleguide_block', :section => @section, :example_html => content end From 0c3852e380c4a7155a7a4b3c767b4863e172c8e5 Mon Sep 17 00:00:00 2001 From: Jankees van Woezik Date: Thu, 14 Feb 2013 21:34:56 +0100 Subject: [PATCH 2/2] Changed unless conditional to if statement --- app/helpers/kss/application_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/helpers/kss/application_helper.rb b/app/helpers/kss/application_helper.rb index 20ecfed..a5752bd 100644 --- a/app/helpers/kss/application_helper.rb +++ b/app/helpers/kss/application_helper.rb @@ -8,7 +8,9 @@ def styleguide_block(section, &block) @section = styleguide.section(section) - raise "KSS styleguide section is nil, is section: '#{section}' defined in your css?" unless @section.raw + if !@section.raw + raise "KSS styleguide section is nil, is section '#{section}' defined in your css?" + end content = capture(&block) render 'kss/shared/styleguide_block', :section => @section, :example_html => content