Sha256: 861ef0e718ab4da33bc32433ae22bcb8dfa6bbc9f623811ff5b8d5bd4709a642

Contents?: true

Size: 620 Bytes

Versions: 17

Compression:

Stored size: 620 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 content_tag(:aside, context.sidebar, class: "main-content-sidebar") unless context.sidebar.blank?
      end
    end

    class Context
      def initialize(template)
        @template = template
      end

      def sidebar(&block)
        @sidebar = @template.capture(&block) if block_given?
        @sidebar
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
trestle-0.9.5 app/helpers/trestle/container_helper.rb
trestle-0.9.4 app/helpers/trestle/container_helper.rb
trestle-0.9.3 app/helpers/trestle/container_helper.rb
trestle-0.9.2 app/helpers/trestle/container_helper.rb
trestle-0.9.1 app/helpers/trestle/container_helper.rb
trestle-0.9.0 app/helpers/trestle/container_helper.rb
trestle-0.8.13 app/helpers/trestle/container_helper.rb
trestle-0.8.12 app/helpers/trestle/container_helper.rb
trestle-0.8.11 app/helpers/trestle/container_helper.rb
trestle-0.8.10 app/helpers/trestle/container_helper.rb
trestle-0.8.9 app/helpers/trestle/container_helper.rb
trestle-0.8.8 app/helpers/trestle/container_helper.rb
trestle-0.8.7 app/helpers/trestle/container_helper.rb
trestle-0.8.6 app/helpers/trestle/container_helper.rb
trestle-0.8.5 app/helpers/trestle/container_helper.rb
trestle-0.8.4 app/helpers/trestle/container_helper.rb
trestle-0.8.3 app/helpers/trestle/container_helper.rb