Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprivatize useful picture view methods #1936

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/models/alchemy/essence_picture_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,19 @@ def render
end
end

private

def caption
return unless show_caption?

@_caption ||= content_tag(:figcaption, essence.caption)
end

def img_tag_src
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to call this method src or url

essence.picture_url(options.except(*DEFAULT_OPTIONS.keys))
end

def img_tag
@_img_tag ||= image_tag(
essence.picture_url(options.except(*DEFAULT_OPTIONS.keys)), {
img_tag_src, {
alt: essence.alt_tag.presence,
title: essence.title.presence,
class: caption ? nil : essence.css_class.presence,
Expand Down