Sha256: da819142ac3d84f6ceccc178f65747546ef19bcc5462e60944786a08bf80cc08

Contents?: true

Size: 744 Bytes

Versions: 1

Compression:

Stored size: 744 Bytes

Contents

module PufferPagesHelper

  def possible_layouts
    inherited_layout + (application_layouts + puffer_layouts).uniq.sort
  end

  def application_layouts
    application_layouts_path = view_paths.detect {|path| path.to_s.starts_with? Rails.root }
    Dir.glob("#{application_layouts_path}/layouts/[^_]*").flatten.map {|path| File.basename(path).gsub(/\..*$/, '')}.uniq
  end

  def puffer_layouts
    Layout.order(:name).all.map(&:name)
  end

  def inherited_layout
    record.inherited_layout_name && !record.root? ? [[t('puffer.inherited_layout', :name => record.inherited_layout_name), '']] : []
  end

  def possible_statuses
    Page.statuses
  end

  def tree_page record
    render :partial => 'tree_page', :object => record
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puffer_pages-0.0.14 app/helpers/puffer_pages_helper.rb