Module: Kss::ApplicationHelper

Defined in:
app/helpers/kss/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#styleguide_block(section, &block) ⇒ Object

Generates a styleguide block. A little bit evil with @_out_buf, but if you’re using something like Rails, you can write a much cleaner helper very easily.

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/kss/application_helper.rb', line 6

def styleguide_block(section, &block)
  raise ArgumentError, "Missing block" unless block_given?
  
  @section = styleguide.section(section)

  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
end