Move method 'recover_image_from_cache' from imageable controllers to image.

This commit is contained in:
Senén Rodero Rodríguez
2017-09-23 23:09:31 +02:00
parent c22637c349
commit 0a86727c6a
8 changed files with 8 additions and 14 deletions

View File

@@ -38,7 +38,7 @@ module DocumentsHelper
def render_attachment(builder, document)
klass = document.errors[:attachment].any? ? "error" : ""
klass = document.persisted? ? " hide" : ""
klass = document.persisted? || document.cached_attachment.present? ? " hide" : ""
html = builder.label :attachment,
t("documents.upload_document"),
class: "button hollow #{klass}"

View File

@@ -52,7 +52,7 @@ module ImagesHelper
def render_image_attachment(builder, imageable, image)
klass = image.errors[:attachment].any? ? "error" : ""
klass = image.persisted? ? " hide" : ""
klass = image.persisted? || image.cached_attachment.present? ? " hide" : ""
html = builder.label :attachment,
t("images.form.attachment_label"),
class: "button hollow #{klass}"