Commit Graph

16 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
Julian Herrero
245594f32b Don't allow to modify answer's images for started polls
Note that the `create` action doesn't create an image but updates an
answer instead. We're removing the references to `:create` in the
abilities since it isn't used.

In the future we might change the form to add an image to an answer
because it's been broken for ages since it shows all the attached
images.
2022-09-20 17:50:49 +02:00
taitus
83e0d4c6b7 Add load_and_authorize_resource to images controller 2022-09-14 14:45:37 +02:00
Javi Martín
e637bce3d8 Fix error messages for question answer images
Since we were creating a new answer in the form, we weren't getting the
errors associated to the answer the administrator was trying to create,
and so we were skipping the test.

Using the answer which contains the information about validation errors
fixes the issue and so we don't have to skip the tests.
2022-04-07 15:34:10 +02:00
rhian-cs
b27a05cbfd Make confirmation alert message inform the triggering action 2021-12-22 12:32:45 +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
Senén Rodero Rodríguez
b499c0dcdd Solve bindmethod deprecation warning
As mentioned at the jQuery 3.0 upgrade guide [1] the `bind` method is deprecated. Replace with `on` method.

[1] https://jquery.com/upgrade-guide/3.0/#deprecated-bind-and-delegate
2020-08-28 16:10:31 +02:00
Javi Martín
ee8426c5b5 Indent with spaces instead of tabs 2019-09-10 20:02:15 +02:00
Julian Herrero
e63a862882 Use double quotes in app/views/admin/poll 2019-03-19 12:16:50 +01:00
Angel Perez
10fac6d2d1 Admins can delete an answer's associated images (#1999) 2018-01-19 15:29:18 -04:00
rgarcia
6327bcb343 adds specs for answer's gallery 2017-10-05 19:15:17 +02:00
decabeza
acea19dca3 improves layout for poll questions answers views 2017-10-05 11:07:26 +02:00
rgarcia
06a1b96fcd clean up 2017-10-04 23:56:23 +02:00
rgarcia
30a2db635d displays upload link for second image
To infinity and beyond
2017-10-04 23:56:23 +02:00
rgarcia
1cf9bc4ad1 adds images to anwers 2017-10-04 23:56:09 +02:00