Module: RailsAdmin::ApplicationHelper

Includes:
I18nSupport
Defined in:
app/helpers/rails_admin/application_helper.rb

Defined Under Namespace

Classes: ViewType

Constant Summary collapse

VIEW_TYPES =
{
  :delete         => ViewType.new(:show,      :object, :delete),
  :for_object     => ViewType.new(:show,      :object, nil,            :history_object),
  :edit           => ViewType.new(:show,      :object, :edit),
  :show           => ViewType.new(:index,     :object, nil),
  :export         => ViewType.new(:index,     :model,  :export),
  :new            => ViewType.new(:index,     :model,  :new),
  :for_model      => ViewType.new(:index,     :model,  nil,            :history_model),
  :index          => ViewType.new(:dashboard, :model,  :index),
  :dashboard      => ViewType.new
}

Instance Method Summary collapse

Methods included from I18nSupport

#abbr_day_names, #abbr_month_names, #date_format, #day_names, #month_names

Instance Method Details

#authorized?(*args) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'app/helpers/rails_admin/application_helper.rb', line 8

def authorized?(*args)
  @authorization_adapter.nil? || @authorization_adapter.authorized?(*args)
end


26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/helpers/rails_admin/application_helper.rb', line 26

def breadcrumbs_for view, abstract_model, object
  return unless VIEW_TYPES[view]
  views = []
  parent = view
  begin
    views << parent
  end while parent = VIEW_TYPES[parent].parent
  breadcrumbs = views.reverse.map do |v|
    breadcrumb_for v, abstract_model, object, (v==view)
  end
  (:ul, :class => "breadcrumb") do
    breadcrumbs.join('<span class="divider">/</span>').html_safe
  end
end