Module: Shipyard::BoxHelper

Includes:
ActionView::Context, ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper
Included in:
Jekyll::Box
Defined in:
lib/shipyard-framework/helpers/box_helper.rb

Instance Method Summary collapse

Instance Method Details

#box(types = [], &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/shipyard-framework/helpers/box_helper.rb', line 7

def box(types=[], &block)
  types = [*types]

  # Gather the appropriate box classes into an array.
  class_list = types.include?(:secondary) ? [] : ['box']
  types.each do |type|
    class_list << "box-#{type}"
  end

  # Join the CSS Classes together.
  options ||= {}
  options[:class] = class_list.join(' ')

  # Return the HTML structure for the box.
   :div, capture(&block), options
end