Sha256: 76a1bc11173bcf9be2e712a954b09c00ff9d01cedca324f706a1f40307c5e93a

Contents?: true

Size: 918 Bytes

Versions: 1

Compression:

Stored size: 918 Bytes

Contents

class Trestle::ApplicationController < ActionController::Base
  protect_from_forgery

  layout :choose_layout

  # Global helpers
  self.helpers_path += Rails.application.helpers_paths
  helper Trestle.config.helper_module
  helper *Trestle.config.helpers

  # Global callbacks
  Trestle.config.before_actions.each do |action|
    before_action(action.options, &action.block)
  end

  Trestle.config.after_actions.each do |action|
    after_action(action.options, &action.block)
  end

  Trestle.config.around_actions.each do |action|
    around_action(action.options, &action.block)
  end

protected
  def breadcrumbs
    @breadcrumbs ||= Trestle::Breadcrumb::Trail.new(Trestle.config.root_breadcrumbs)
  end
  helper_method :breadcrumbs

  def breadcrumb(label, path=nil)
    breadcrumbs.append(label, path)
  end
  helper_method :breadcrumb

  def choose_layout
    request.xhr? ? false : "trestle/admin"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trestle-0.8.6 app/controllers/trestle/application_controller.rb