Sha256: 1b4b93c84dd73020ef9f3beef94c287cda02af478ddbcab250ceaa8cbfdb538e
Contents?: true
Size: 800 Bytes
Versions: 28
Compression:
Stored size: 800 Bytes
Contents
module Releaf::ActionController::Breadcrumbs extend ActiveSupport::Concern included do before_action :build_breadcrumbs end def build_breadcrumbs @breadcrumbs = [controller_breadcrumb].compact end def controller_breadcrumb {name: definition.localized_name, url: definition.path} if definition end def add_resource_breadcrumb(resource, url = nil) if resource.new_record? name= I18n.t('New record', scope: 'admin.breadcrumbs') url = url_for(action: :new, only_path: true) if url.nil? else url_action = feature_available?(:show) ? :show : :edit name = Releaf::ResourceBase.title(resource) url = url_for(action: url_action, id: resource.id, only_path: true) if url.nil? end @breadcrumbs << { name: name, url: url } end end
Version data entries
28 entries across 28 versions & 1 rubygems