lib/elegant/header.rb in elegant-1.1.0 vs lib/elegant/header.rb in elegant-1.2.0

- old
+ new

@@ -14,11 +14,11 @@ # configuration), a horizontal line, a title and an image for the content. def render repeat(:all) do render_watermark stroke_horizontal_rule - render_logo if @logo + render_logo render_heading end end # Sets the right padding for title based on whether the page has a logo @@ -42,20 +42,26 @@ # Renders an image in the top-right corner of each page. The image must be # provided when initializing the document. def render_logo float do render_logo_frame - render_logo_image + render_logo_image if @logo[:url] end if @logo end # Renders a frame around the logo in the top-right corner. def render_logo_frame(options = {}) width = @logo_width + line_width height = @logo_height + line_width left = bounds.right - width - 0.5 * line_width top = bounds.top + 0.5 * height - bounding_box([left, top], width: width, height: height) {stroke_bounds} + bounding_box([left, top], width: width, height: height) do + old_color = self.fill_color + fill_color 'FFFFFF' + fill_rectangle [0, height], width, height + fill_color old_color + stroke_bounds + end end # Renders the actual image as the logo in the top-right corner. def render_logo_image left = bounds.right - @logo_width - line_width