Sha256: 5062d937b055538547b80d33d2b242566c0def407a50f800b6b860e19f398d02
Contents?: true
Size: 779 Bytes
Versions: 6
Compression:
Stored size: 779 Bytes
Contents
module Trestle module ContainerHelper def container(&block) context = Context.new(self) content = capture(context, &block) content_tag(:div, class: "main-content-container") do concat content_tag(:div, content, class: "main-content") concat context.sidebar if context.sidebar end end class Context def initialize(template) @template = template end def sidebar(options={}, &block) if block_given? @sidebar = @template.content_tag(:aside, default_sidebar_options.merge(options), &block) nil else @sidebar end end def default_sidebar_options Trestle::Options.new(class: ["main-content-sidebar"]) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems