Commit Graph

40 Commits

Author SHA1 Message Date
Javi Martín
7bf4e4d611 Sanitize descriptions in the views
Sanitizing descriptions before saving a record has a few drawbacks:

1. It makes the application rely on data being safe in the database. If
somehow dangerous data enters the database, the application will be
vulnerable to XSS attacks
2. It makes the code complicated
3. It isn't backwards compatible; if we decide to disallow a certain
HTML tag in the future, we'd need to sanitize existing data.

On the other hand, sanitizing the data in the view means we don't need
to triple-check dangerous HTML has already been stripped when we see the
method `auto_link_already_sanitized_html`, since now every time we use
it we sanitize the text in the same line we call this method.

We could also sanitize the data twice, both when saving to the database
and when displaying values in the view. However, doing so wouldn't make
the application safer, since we sanitize text introduced through
textarea fields but we don't sanitize text introduced through input
fields.

Finally, we could also overwrite the `description` method so it
sanitizes the text. But we're already introducing Globalize which
overwrites that method, and overwriting it again is a bit too confusing
in my humble opinion. It can also lead to hard-to-debug behaviour.
2019-10-21 21:32:02 +02:00
Javi Martín
bbbd0820c1 Use active record translations in votation types
We need to build a votation type object in the form so translations are
applied automatically.
2019-10-07 01:56:24 +02:00
Javi Martín
6fa67b5e53 Use active record translations for labels
This way we can simplify the way we generate form fields. In some cases,
we also use the human attribute in table headers, which IMHO makes
sense.

I haven't moved all of them: for example, sometimes a label is
different depending on whether it's shown to administrators, valuators,
or users. And I haven't touched the ones related to devise, since I
wasn't sure about possible side effects.

Note I've also removed placeholders when they had the same text as their
labels, since they weren't helpful. On the contrary, the added redundant
text to the form, potentially distracting users.
2019-10-07 01:56:23 +02:00
lalo
23d36835d7 Add Admin changes to create Poll:Questions with votation type 2019-06-12 19:44:14 +02:00
Julian Herrero
e63a862882 Use double quotes in app/views/admin/poll 2019-03-19 12:16:50 +01:00
decabeza
6f324c6931 Unifies styles and views for admin polls 2018-07-31 12:48:01 +02:00
decabeza
bdc3538100 Merge branch 'master' into polls-admin-polish 2017-10-11 19:12:34 +02:00
iagirre
2b10b59e2a Order in the admin page using jquery-ui sortable widget. 2017-10-10 16:38:29 +02:00
decabeza
9dc8a0fb34 fixes questions table with long links on description 2017-10-09 19:44:12 +02:00
decabeza
36d39503e8 improves admin poll questions show 2017-10-09 19:42:53 +02:00
decabeza
9ec57f68c2 changes list of videos links on polls question admin 2017-10-07 14:49:36 +02:00
Raimond Garcia
23ef9ded1d Merge branch 'master' into aperez-edit-poll-question-answers 2017-10-06 18:47:04 +02:00
Raimond Garcia
8576f59af1 Merge branch 'master' into aperez-edit-poll-question-answers 2017-10-06 18:14:00 +02:00
Angel Perez
63eaa0bef6 Allow Poll::Question::Answer edit
As requested by #1992
2017-10-06 09:48:17 -04:00
decabeza
dd69401477 Merge branch 'master' into question-answer-documents 2017-10-06 15:18:42 +02:00
Raimond Garcia
108d4104e8 Merge pull request #1986 from wairbut-m2c/iagirre-remove-documents-questions
Iagirre remove documents questions
2017-10-06 14:07:21 +02:00
decabeza
de9b599578 Merge branch 'master' into question-answer-documents 2017-10-06 13:55:49 +02:00
decabeza
3ce98b6cdf fixes answer documents path on polls questions show 2017-10-06 02:09:01 +02:00
María Checa
284fdea2e6 Improved answer documents and question summary views 2017-10-06 01:23:41 +02:00
Raimond Garcia
c72f95c72b Merge branch 'master' into aperez-admin-question-videos 2017-10-06 01:12:22 +02:00
Raimond Garcia
3d100d1e93 Merge branch 'master' into iagirre-remove-documents-questions 2017-10-06 01:02:56 +02:00
Angel Perez
5862eea516 Add controllers/views for Poll::Question::Answer::Video 2017-10-05 12:34:20 -04:00
iagirre
75d841e2fe Fixed the correct specs and views to make the test pass. 2017-10-05 15:31:21 +02:00
decabeza
ea4b534ee9 improves layout for poll questions views 2017-10-05 11:06:00 +02:00
rgarcia
1cf9bc4ad1 adds images to anwers 2017-10-04 23:56:09 +02:00
Angel Perez
f4774894e7 Adapt Admin::Poll::Question 'show' action to new design
Changes required as per issues #1855 and #1951

Fixes PR #1977, note n° 2
2017-10-04 16:59:23 -04:00
rgarcia
1f2aa301d4 adds specs for answer's index and create 2017-10-04 16:33:52 +02:00
Raimond Garcia
44d0c04e38 Merge branch 'master' into aperez-admin-questions-section 2017-10-04 14:13:20 +02:00
Angel Perez
1cc0816dcd Create 'poll_question_answers' controller and views 2017-10-03 23:23:50 -04:00
María Checa
9871503c5e Restored views 2017-10-03 21:00:40 +02:00
Angel Perez
d9d03079e1 Adapt Poll::Question 'show' action to mockup 2017-10-03 13:29:07 -04:00
María Checa
355d68c7f8 Added video URL and document to poll question preview 2017-09-07 17:15:20 +02:00
decabeza
6c5513ab38 replaces back_link partial to back_link_to helper 2017-07-26 18:22:45 +02:00
kikito
bc763c34c2 Removes Poll::Question.summary from views 2017-01-30 18:41:24 +01:00
kikito
ab63c18d01 Moves geozones from questions to polls in admin show views 2017-01-24 18:08:48 +01:00
Alberto Garcia Cabeza
241ddcb163 polish styles for tables, assignments and searches on polls admin 2016-12-28 13:45:36 +01:00
Alberto Garcia Cabeza
71fa9afab8 adds edit button on questions show 2016-12-16 14:09:22 +01:00
Alberto Garcia Cabeza
596cf1dc38 adds styles to admin question show 2016-11-18 13:13:40 +01:00
rgarcia
626a8e9154 updates specs for admin poll questions 2016-11-17 21:31:51 +01:00
rgarcia
198b0018f7 adds admin poll question's show 2016-11-17 10:45:37 +01:00