app/helpers/admin/cms/partial_helper.rb
# Finds the CMS partial for the appropriate content type. This allows template inheritence between individual CMS-based
# controller and CMSController itself.
#
# === Expected parameters
#
# [partial]   _(string)_ the name of the partial
Finds the CMS partial for the appropriate content type. This allows template inheritence between individual CMS-based
controller and CMSController itself.

Expected parameters

[partial]   _(string)_ the name of the partial
Finds the CMS partial for the appropriate content type . This allows template inheritence between individual CMS - based controller and CMSController itself . Expected parameters [ partial ] _ ( string ) _ the name of the partial
def partial_for( partial, action_or_options = {} )
    options = action_or_options.is_a?( Hash ) ? action_or_options : { action: action_or_options }
    options[:action] ||= params[:action]
    options[:format] ||= '.html'
    options[:ignore_missing] ||= false
    candidates = lookup_context.prefixes.slice(0, lookup_context.prefixes.index('admin/cms') + 1).map{ |p| "#{p}/#{options[:action]}" }
    candidates.each do |path|
      return "#{path}/#{partial}" if partial_exists?( "#{partial}#{options[:format]}", path )
    end
    return if options[:ignore_missing]
    lookup_context.find( "#{partial}", candidates, true )
  end
def partial_for ( partial , action_or_options = { } ) options = action_or_options . is_a? ( Hash ) ? action_or_options : { action : action_or_options } options [ :action ] ||= params [ :action ] options [ :format ] ||= '.html' options [ :ignore_missing ] ||= false candidates = lookup_context . prefixes . slice ( 0 , lookup_context . prefixes . index ( 'admin/cms' ) + 1 ) . map { | p | "#{p}/#{options[:action]}" } candidates . each do | path | return "#{path}/#{partial}" if partial_exists? ( "#{partial}#{options[:format]}" , path ) end return if options [ :ignore_missing ] lookup_context . find ( "#{partial}" , candidates , true ) end
Finds the CMS partial for the appropriate content type.
Finds the CMS partial for the appropriate content type .
# sort out our options # default some options # work out a list of candidate paths (stop at admin/cms) # iterate through # bail, if we’re ignoring stuff # otherwise, make ActionViewer barf instead
partial
action_or_options