Sha256: 50f61605edb6de60b38d16f94afde46002e813a1c31182f101f5e9f2b92dbcd3

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

#
# Installs hooks in ActionController::Layout to add layouts defined in MasterView templates
# to the list of layout template paths.
#
# Rails assumes everything is file-based and that there will be a file for each layout.
# MasterView template compilation of .html directly into the .rhtml erb cache
# introduces a separation betweeen the file name and the cache entry
# that does not fit the Rails viewpoint.
#

module ActionController #:nodoc:
  module Layout #:nodoc:
    module ClassMethods #:nodoc:

      # get list of layout template paths, original rails implementation assumes everything is file based
      # so this method is enhanced to pull layouts out of MasterView and concatenate them to the list
      # from rails
      alias :layout_list_pre_mv :layout_list #:nodoc:
      def layout_list #:nodoc:
        mv_layouts = []
        MasterView::IOMgr.erb.find do |mio|
         mv_layouts << "#{template_root}/"+mio.pathname.to_s if mio.pathname.to_s.starts_with?('layouts/')
        end
        layout_list_pre_mv.concat( mv_layouts )
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
masterview-0.3.0 lib/masterview/rails_ext/action_controller_erb_direct.rb
masterview-0.3.1 lib/masterview/rails_ext/action_controller_erb_direct.rb
masterview-0.3.2 lib/masterview/rails_ext/action_controller_erb_direct.rb
masterview-0.3.3 lib/masterview/rails_ext/action_controller_erb_direct.rb
masterview-0.3.4 lib/masterview/rails_ext/action_controller_erb_direct.rb