Hi Sergio !
Where I can exactly orrveride ? I didn't manage to do what.
module ActiveScaffold
module Bridges
class ActiveStorage
module ActiveStorageBridgeHelpers
mattr_accessor :thumbnail_variant
self.thumbnail_variant = {resize_to_limit: [nil, 30]} to {resize_to_limit: [
nil, 350]}
Le mercredi 18 mars 2020 à 13:25:34 UTC+1, [email protected] a écrit :
> I think you can override that helper in your controller helper, or
> ApplicationHelper. I think it should work as dragonfly does, there should
> be a thumbnail_variant setting in
> ActiveScaffold::Bridges::ActiveStorage::ActiveStorageBridgeHelpers, default
> to something like {resize_to_limit: [nil, 30]} to use same values as
> dragonfly bridge.
>
>
>
> I have added this to master branch. However, I have checked docs for
> activestorage in rails 5.2 and I don't see resize_to_limit option, did it
> changed in 6.0?
>
>
>
> I'm not sure what you want about the other question. Do you want to keep
> uploaded file so user doesn't need to upload it again? Or do you want to
> have input file prefilled so user doesn't have to browse file to upload
> again? The former, I don't know, does it rails save attachment into
> active_storage_blobs table? It could be orphaned if form is not submitted
> again. The latter, I think it isn't possible, I think browser doesn't allow
> to set value attribute for input file tag.
>
>
>
> El martes, 17 de marzo de 2020 18:18:50 (CET) Gloufy escribió:
>
> something like that image_tag user.avatar.variant(resize_to_limit: [100,
> 100])
>
>
> Where can I override the helper link_for_attachment(attachment) ?
>
>
> and for the other question do you have a clue how to do it ? (
> How to persist file upload fields after a rails validation error
> <https://stackoverflow.com/questions/15680484/how-to-persist-file-upload-fields-after-a-rails-validation-error>
> with
> activestorage and activescaffold ? )
>
>
> Le mardi 17 mars 2020 12:47:06 UTC+1, Sergio Cambra a écrit :
>
> ActiveStorage bridge was a contribution, I didn't write it, I haven't
> tried ActiveStorage yet. However, I can see form_ui is calling helper for
> list and show actions to display content, as other bridges related to file
> upload do.
>
>
>
> Form_ui has this line:
>
>
>
> content = active_scaffold_column_active_storage_has_one(record, column) if
> active_storage.attached?
>
>
>
> That line display content with same helper as list and show. And that
> helper, active_scaffold_column_active_storage_has_one method has this line:
>
>
>
> attachment.attached? ? link_for_attachment(attachment) : nil
>
>
>
> But link_for_attachment doesn't display thumbnail:
>
>
>
> def link_for_attachment(attachment)
>
> link_to(attachment.filename, rails_blob_url(attachment, disposition:
> 'attachment'), target: '_blank')
>
> end
>
>
>
>
>
> I think that helper method must be changed to display thumbnail, as other
> bridges do. Carrierwave bridge display thumbnail, and thumbnail style name
> can be changed in bridge config. Paperclip do it in same way. Dragonfly do
> it in same way too, but it allows to set :thumb option in column's options.
> What is code to display thumbnail with ActiveStorage?
>
>
>
> El martes, 17 de marzo de 2020 0:23:32 (CET) Gloufy escribió:
>
> Hi Sergio,
>
>
> I'm using active storage plugin bridge in active scaffold.
>
> But I don't have the thumbnail in form "mode" juste the name of the file.
> With dragonfly I have the thumbnail, do you know why ?
>
>
> How to persist file upload fields after a rails validation error
> <https://stackoverflow.com/questions/15680484/how-to-persist-file-upload-fields-after-a-rails-validation-error>
> with
> activestorage and activescaffold ?
> https://stackoverflow.com/questions/15680484/how-to-persist-file-upload-fields-after-a-rails-validation-error
>
>
>
> Thank you for your help
>
>
> Gloufy
>
> --
> You received this message because you are subscribed to the Google Groups
> "ActiveScaffold : Ruby on Rails Gem" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
>
>
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/activescaffold/3bf5a081-ede1-4402-bf52-1f518063b4af%40googlegroups.com
>
> <https://groups.google.com/d/msgid/activescaffold/3bf5a081-ede1-4402-bf52-1f518063b4af%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "ActiveScaffold : Ruby on Rails Gem" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/activescaffold/cc2b370b-1a3a-4ae1-91bf-ff91e0ae92a2%40googlegroups.com
>
> <https://groups.google.com/d/msgid/activescaffold/cc2b370b-1a3a-4ae1-91bf-ff91e0ae92a2%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/activescaffold/83f86fd3-1b36-4d40-a504-cc5022698e1dn%40googlegroups.com.