Sha256: b103c1e2f39ae7a2019707eb0010f5e2ae09e9a50b6cd8f9c40310a912245f88

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 Bytes

Contents

module Ckpages
  module ApplicationHelper

    def ckpart title, options = {}, locals = {}, &block
      @part = Ckpages::Part.find_by!(title: title)
      options = options.merge(partial: 'ckpart')
      render options, locals, &block
    end

    def dt_dd(page, attr, lmbd=nil)
      if page.send("#{attr}?")
        content_tag(:dt) do
          Page.human_attribute_name(attr)
        end +
        content_tag(:dd) do
          val = page.send("#{attr}")
          if lmbd.nil?
            val.to_s
          else
            lmbd.call(val)
          end
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ckpages-0.1.1 app/helpers/ckpages/application_helper.rb