Sha256: be8c8dcd647dd21ddba8d1e2fd344a6e8528c6569f23605b81dbeae89ff0dbf0

Contents?: true

Size: 926 Bytes

Versions: 7

Compression:

Stored size: 926 Bytes

Contents

require 'ecm/cms/database_resolver'

module Ecm
  module Cms
    class PageResolver < ::ActionView::Resolver
      require 'singleton'
      include Singleton

      # add shared behaviour for database backed templates
      include Ecm::Cms::DatabaseResolver

      def build_source(record)
        if record.body.nil?
          source = '' 
        else
          source = record.body
        end
        content_for_title = "<% content_for :title do %>#{Ecm::Cms::Configuration.site_title} - #{record.title}<% end %>"
        content_for_meta_description = "<% content_for :meta_description do %>#{record.meta_description}<% end %>"
        source << content_for_title << content_for_meta_description
      end

      def normalize_basename(basename)
        basename
      end

      def resolve(partial_flag)
        !partial_flag
      end

      def template_class
        'Ecm::Cms::Page'
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ecm_cms-0.0.7.pre lib/ecm/cms/resolvers/ecm/cms/page_resolver.rb
ecm_cms-0.0.6.pre lib/ecm/cms/resolvers/ecm/cms/page_resolver.rb
ecm_cms-0.0.5.pre lib/ecm/cms/resolvers/ecm/cms/page_resolver.rb
ecm_cms-0.0.4.pre lib/ecm/cms/resolvers/ecm/cms/page_resolver.rb
ecm_cms-0.0.3.pre lib/ecm/cms/resolvers/ecm/cms/page_resolver.rb
ecm_cms-0.0.2.pre lib/ecm/cms/resolvers/ecm/cms/page_resolver.rb
ecm_cms-0.0.1.pre lib/ecm/cms/resolvers/ecm/cms/page_resolver.rb