app/presenters/page_header_presenter.rb in woople-theme-0.0.6 vs app/presenters/page_header_presenter.rb in woople-theme-0.1.0
- old
+ new
@@ -1,6 +1,32 @@
require 'delegate'
require_relative 'content_image'
class PageHeaderPresenter < SimpleDelegator
include ContentImage
+
+ def title
+ name || header.title
+ end
+
+ def image_class
+ 'page-header-with-image' if has_image?
+ end
+
+ private
+
+ def has_image?
+ header.respond_to?(:image)
+ end
+
+ def name
+ if header.respond_to?(:name)
+ header.name
+ else
+ nil
+ end
+ end
+
+ def header
+ __getobj__
+ end
end