app/helpers/crud_helper.rb in templus_models-2.0.3 vs app/helpers/crud_helper.rb in templus_models-2.0.4
- old
+ new
@@ -173,11 +173,11 @@
!(video?(file) || imagem?(file))
end
def render_field_file(field)
if imagem?(field) && field.respond_to?(:thumb)
- if is_active_action("printing")
+ if is_active_action("printing") || is_active_action("listing")
pdf_image_tag(field, width: '100px')
else
image_tag(field.url(:thumb), width: '100px')
end
elsif video?(field)
@@ -222,9 +222,15 @@
def should_listing_excel?(crud_helper, model)
return false unless can?(:read, model)
return true if crud_helper.condition_listing_excel.nil?
crud_helper.condition_listing_excel.call(model)
+ end
+
+ def should_listing_pdf?(crud_helper, model)
+ return false unless can?(:read, model)
+ return true if crud_helper.condition_listing_pdf.nil?
+ crud_helper.condition_listing_pdf.call(model)
end
def can_print_pdf?(crud_helper, record)
return false unless can?(:read, record)
return true if crud_helper.condition_printing_action.nil?