Commit Graph

28 Commits

Author SHA1 Message Date
taitus
cb2958e1b0 Add load_and_authorize_resource to answers controller 2022-09-14 14:45:34 +02:00
taitus
405b37f605 Load answer through question in answers controller
We are simplifying the load answer and we can remove the ambiguous
hidden field from answer form.
2022-09-14 14:45:33 +02:00
taitus
01005b50cb Load question from load_and_authorize_resource in answers controller 2022-09-14 14:45:33 +02:00
Javi Martín
11832cc07d Make it easier to customize allowed parameters
When customizing CONSUL, one of the most common actions is adding a new
field to a form.

This requires modifying the permitted/allowed parameters. However, in
most cases, the method returning these parameters returned an instance
of `ActionController::Parameters`, so adding more parameters to it
wasn't easy.

So customizing the code required copying the method returning those
parameters and adding the new ones. For example:

```
def something_params
  params.require(:something).permit(
    :one_consul_attribute,
    :another_consul_attribute,
    :my_custom_attribute
  )
end
```

This meant that, if the `something_params` method changed in CONSUL, the
customization of this method had to be updated as well.

So we're extracting the logic returning the parameters to a method which
returns an array. Now this code can be customized without copying the
original method:

```
alias_method :consul_allowed_params, :allowed_params

def allowed_params
  consul_allowed_params + [:my_custom_attribute]
end
```
2022-04-07 19:35:40 +02:00
taitus
ac144d172d Move document attributes to concern 2021-04-09 16:21:00 +02:00
Javi Martín
37361a6f3d Replace render :nothing with head :ok
Using `render :nothing` was deprecated, but we never noticed it because
we didn't have a test for the action using it. In Rails 5.1, it raises
an exception.

Using `head :ok` and adding a test for this scenario solves the issue.
2020-04-24 15:43:54 +02:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Senén Rodero Rodríguez
9d9ad5003b Add given_order to related poll question answers forms
Since given order is no longer being generated automatically we need
to add it to related forms and to strong parameters methods
2019-03-21 14:51:17 +01:00
Julian Herrero
d24376f6ad Use double quotes in controllers/ 2019-03-13 22:19:49 +01:00
Javi Martín
01315f2695 Fix rubocop line too long warning 2018-10-22 16:36:17 +02:00
Javi Martín
e0b9c1bfdd Update poll question answers translatable fields
We needed to bring back support for CKEditor in our translatable form,
which we had temporarily remove.

And now we support CKEditor in our translatable specs, and so we can
remove the duplicated specs for poll question answers.
2018-10-22 16:13:48 +02:00
Julian Herrero
673ec075eb Make answers translatable 2018-09-20 17:13:40 +02:00
Bertocq
62d75af892 Fix line lenght offenses at multiple controllers 2018-02-19 11:09:19 +01:00
iagirre
644d09ebd2 PR comments applied and poll_question_answer default name changed in factory. 2017-10-11 09:42:52 +02:00
iagirre
44474e7686 Deleted a forgotten comment 2017-10-10 16:39:19 +02:00
iagirre
943c1f23af Spects added to test the order of answers. Default order for question_answers set. 2017-10-10 16:38:55 +02:00
iagirre
2b10b59e2a Order in the admin page using jquery-ui sortable widget. 2017-10-10 16:38:29 +02:00
María Checa
65237db099 Fixed poll answer document upload redirect 2017-10-07 17:50:42 +02:00
rgarcia
777237421f fixes specs 2017-10-07 14:55:08 +02:00
rgarcia
38f100d183 fixes loading of poll question 2017-10-07 14:40:26 +02:00
rgarcia
cf3a62b126 fixes specs 2017-10-06 20:32:06 +02:00
Raimond Garcia
23ef9ded1d Merge branch 'master' into aperez-edit-poll-question-answers 2017-10-06 18:47:04 +02:00
Angel Perez
63eaa0bef6 Allow Poll::Question::Answer edit
As requested by #1992
2017-10-06 09:48:17 -04:00
María Checa
c5c1ea7251 Fixed answer documents form 2017-10-06 12:02:24 +02:00
decabeza
7856915203 removes @question on questions answers 2017-10-06 02:38:43 +02:00
María Checa
590344a576 Added view to upload documents to poll answers 2017-10-06 01:18:53 +02:00
rgarcia
3ae539e8ab fixes relation between questions and answers 2017-10-04 20:10:31 +02:00
rgarcia
461410a79d adds consistency to answer's namespace 2017-10-04 17:06:29 +02:00