Commit Graph

38 Commits

Author SHA1 Message Date
Javi Martín
1e1d7996bb Simplify rendering document/image fields
We were adding <div> tags with the `images` or `documents` HTML class
prettly much every time we rendered a NestedComponent. We're now
including the HTML class inside the component, as we usually do.

We're also rendering the nested components directly, since it's been a
while since the partials were changed to simply render the components.
2023-10-23 15:49:01 +02:00
Javi Martín
091abfc944 Use Active Storage to render attachments
This way we fix a bug we mentioned in commit 930bb753c which caused
links to documents to be broken when editing their title because the
title was used to generate the URL of the document.

Note we're still using Paperclip to render cached attachments because
this is the only case where we store files with just Paperclip and not
Active Storage.

With Active Storage, we render attachments just like any other resource,
using `polymorphic_path`. Paperclip included the `url` method in the
model; since the model doesn't have access to the request parameters
(like the host), this was inconvenient because it wasn't possible to
generate absolute URLs with Paperclip.

In order to simplify the code and make it similar to the way we used
Paperclip, we're adding a `variant` method accepting the name of a
variant and returning the variant.
2022-02-23 18:21:38 +01:00
Javi Martín
a181052f0d Move nested images partial to a component 2021-07-13 16:58:13 +02:00
Javi Martín
629df5ab9b Simplify getting imageable/documentable in forms
The imageable/documentable object is always the object the form builder
is based on; since we're already passing the form builder, we don't have
to pass the object as well.

The only exception are the poll answers. In this case, we're passing a
new answer as the object. That's OK; the same hack that we're using to
send the data to the answer URL without displaying existing attachments
causes the form to keep working the same way.
2021-07-13 16:58:13 +02:00
Javi Martín
d58c2f8323 Move image fields partial to a component 2021-07-13 16:58:13 +02:00
Javi Martín
7db4a91d78 Remove duplicate nested image partial
It had almost exactly the same code as the standard nested image
partial, and its variations were insignificant.
2021-07-13 16:58:13 +02:00
decabeza
72a24128a6 Improve upload image and documents buttons 2021-03-24 15:48:24 +01:00
Javi Martín
71d9ddd849 Apply rule to end files with a newline character 2019-09-10 20:02:15 +02:00
Julian Herrero
f6489bc604 Use double quotes in app/views 2019-03-19 12:33:07 +01:00
Alberto
a709f846be Merge pull request #2046 from wairbut-m2c/aperez-removable-admin-answer-images
Removable answer's associated images
2018-05-03 17:24:48 +02:00
decabeza
725c282ba5 Adds unicode_normalize for alt and title on images 2018-04-27 18:24:17 +02:00
decabeza
acebb07ddd Adds link to image and docs on admin budget investment info 2018-03-14 15:14:47 +01:00
Angel Perez
10fac6d2d1 Admins can delete an answer's associated images (#1999) 2018-01-19 15:29:18 -04:00
decabeza
67df3947bf improves admin image partial 2017-12-15 18:48:24 +01:00
decabeza
8ff4303d20 changes image admin title label and improves image fields layout 2017-12-15 18:48:24 +01:00
Alberto García
806fd85246 Merge pull request #1990 from consul/polls-gallery
Polls Gallery
2017-10-05 21:44:38 +02:00
rgarcia
127ab222eb removes rendering of local variable 2017-10-05 19:37:44 +02:00
decabeza
25de95cdb4 removes blank space 2017-10-05 11:07:41 +02:00
rgarcia
06a1b96fcd clean up 2017-10-04 23:56:23 +02:00
iagirre
4035097c60 Specs added for branch polls-show in consul and thumbnail for poll images in admins views.
Cambios para hacer commit:
	modificado:    app/views/images/_admin_image.html.erb
	modificado:    spec/features/admin/poll/polls_spec.rb
	modificado:    spec/features/polls/polls_spec.rb
2017-10-04 16:43:35 +02:00
BertoCQ
3835821871 Merge branch 'master' into iagirre-admin-polls-section 2017-10-02 22:25:09 +02:00
iagirre
166caa3b4c Deleted code in views and concerns that lets polls have more images and documentes attached, like it was at first.
Added missing text for english and new texts in english and spanish.

 Cambios para hacer commit:
	modificado:    app/assets/stylesheets/participation.scss
	modificado:    app/models/concerns/imageable.rb
	modificado:    app/models/poll.rb
	modificado:    app/views/admin/poll/polls/_form.html.erb
	modificado:    app/views/images/_admin_image.html.erb
	modificado:    config/locales/en/images.yml
	modificado:    config/locales/es/admin.yml
	modificado:    config/locales/es/images.yml
	modificado:    spec/features/admin/poll/polls_spec.rb
2017-10-02 12:59:26 +02:00
iagirre
c67620fdef Table for links added (links to add images/documents).
Custom partial for admins upload image created, so that it can be reused in upload images and documents.
2017-09-29 14:51:49 +02:00
decabeza
fd78eb30cc shows hr tag on forms only when expanded 2017-09-28 15:20:47 +02:00
Senén Rodero Rodríguez
eef8ad1b73 Remove images single uploads 2017-09-27 10:41:48 +02:00
Senén Rodero Rodríguez
0a86727c6a Move method 'recover_image_from_cache' from imageable controllers to image. 2017-09-26 13:57:13 +02:00
Senén Rodero Rodríguez
d98d1312ca Add _destroy parameter to nested image 2017-09-26 13:57:13 +02:00
Senén Rodero Rodríguez
f8d78ec4ab Remove new_nested action from images controller. Use cocoon gem to manage new nested fields creation on images. 2017-09-26 13:57:13 +02:00
Senén Rodero Rodríguez
88a7a29d27 Remove new_nested action from documents controller. Use cocoon gem to manage new nested fields creation on documents. 2017-09-26 13:57:13 +02:00
Alessandro Cuoghi
3745e76c07 Solve conflicts. Refactor documentable and imageable styles. 2017-09-26 13:57:13 +02:00
Senén Rodero Rodríguez
95016a1bf3 Some renaming and cleaning 2017-09-26 13:56:06 +02:00
Senén Rodero Rodríguez
966ff4dc03 User new direct uploads controllers action on imageable. 2017-09-26 13:56:06 +02:00
Senén Rodero Rodríguez
824dd26d5a User new direct uploads controllers action on documentable. Skipped spec. 2017-09-26 13:55:51 +02:00
Senén Rodero Rodríguez
826385f659 Extract ajax upload and destroy_upload actions from images and documents controllers and place them at new controllers to manage direct uploads 2017-09-26 13:55:28 +02:00
Senén Rodero Rodríguez
314b7d73f7 Remove sleep from nested imageable shared feature specs. Use matchers able to wait new content to appear. 2017-09-26 13:55:03 +02:00
Senén Rodero Rodríguez
2a12b222ed Fix some tranlations on new image page. Add missing shared specs for imageable feature. 2017-09-26 13:55:03 +02:00
Senén Rodero Rodríguez
ceabd16d57 Refactor. Create index scope inside imageable shared examples to check index action of any imageable model. Add image to proposals index. 2017-09-26 13:55:03 +02:00
Senén Rodero Rodríguez
6f71da07ee Duplicate documentable code and rename for imageable 2017-09-26 13:55:03 +02:00