Commit Graph

34 Commits

Author SHA1 Message Date
decabeza
815a526d78 Add VotationType fields to admin poll question form 2022-10-18 10:38:59 +02:00
Julian Herrero
8a26954bc5 Don't allow to modify questions for started polls
Adding, modifiying, and/or deleting questions for an already started
poll is far away from being democratic and can lead to unwanted side
effects like missing votes in the results or stats.

So, from now on, only modifiying questions will be possible only if
the poll has not started yet.
2022-09-20 17:50:35 +02:00
Javi Martín
4c8be42ea1 Simplify new question form
In this form, the only case where `poll` might be present without
`question.poll` being present to is going to be the `new` action. We can
assign the poll in the `new` action and get rid of the `poll` variable
in the form.
2022-09-20 17:29:04 +02:00
taitus
3d1a9501aa Remove unused resource controller methods
These methods aren't necessary since commit 71601bd3f.
2022-09-14 14:45:35 +02:00
taitus
8b4cd13675 Unify with the rest of application destroy method in questions controller
We also add a missing translation.
2022-09-14 11:37:21 +02:00
taitus
ad9362399e After destroy question redirect to his poll show page
After removing a question from a poll it makes more sense to redirect to
your own poll show page in order to manage their questions.

Currently it is redirecting to the questions index page where all the
questions from all the polls are displayed and takes you completely out
of the context of the poll you are in.

In the future we will remove this index question page.
2022-09-14 11:37:20 +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
Javi Martín
e33794e45e Reuse admin search component in other sections
There are some sections where we are not reusing it:

* The budget investments search is completely different, so this
  component isn't appropriate there
* Booth assignment and officers are slightly different, and I'm not
  entirely sure it's safe to refactor these cases
2020-12-04 19:57:05 +01:00
Javi Martín
af7c37634d Remove poll votation types
Unfortunately this feature wasn't properly reviewed and tested, and it
had many bugs, some of them critical and hard to fix, like validations
being skipped in concurrent requests.

So we're removing it before releasing version 1.1. We might add it back
in the future if we manage to solve the critical issues.

This commit reverts commit 836f9ba7.
2019-10-30 18:48:55 +01:00
Javi Martín
9fe8c47528 Apply Rails/SafeNavigation rubocop rule 2019-09-10 21:43:39 +02:00
lalo
23d36835d7 Add Admin changes to create Poll:Questions with votation type 2019-06-12 19:44:14 +02:00
rgarcia
7dd314c699 Do not display polls associated to a budget in admin poll questions
This section is used to select to which poll a question belongs to.

Budget polls are not meant to include questions that come from Citizen
Proposals or Government Questions, thus we do not display them
2019-04-03 22:20:01 +02:00
Julian Herrero
d24376f6ad Use double quotes in controllers/ 2019-03-13 22:19:49 +01:00
Javi Martín
d1249d0b4f Update poll questions translatable fields
We need to replace ".title=" by ".title_#{locale}=" in one place because
for some reason globalize builds a new translation record when using the
latter but it doesn't build one when using the former.
2018-10-22 16:13:30 +02:00
Julian Herrero
5e6248d2ac Make questions translatable 2018-09-20 17:11:53 +02:00
Angel Perez
4c0deb0eca Remove video_url attr from Admin::Poll::Question form 2018-05-23 07:27:12 -04:00
Bertocq
e9294f2a22 Switch from valid_answers to question_answers usage for Poll Questions 2017-10-18 01:32:15 +02:00
iagirre
b31abb64d7 Removed the methods not used from nested_documentable specs (the ones that were deleted in the questions specs) and removed also the document params from questions_params (not used anymore). 2017-10-05 17:28:24 +02:00
María Checa
348e4e54f3 Removed question description 2017-10-03 19:11:54 +02:00
Senén Rodero Rodríguez
f6fba64012 Remove uneeded document and image initializations 2017-09-26 13:57:14 +02:00
Senén Rodero Rodríguez
c22637c349 Move method 'recover_documents_from_cache' from documentable controllers to document. 2017-09-26 13:57:13 +02:00
Senén Rodero Rodríguez
ce29185b76 Fix documentable on admin poll questions. Adapt nested documentable shared specs to admin fetaure specs and include at admin poll questions specs. 2017-09-26 13:57:13 +02:00
Senén Rodero Rodríguez
77f63a4c44 Add _destroy parameter to nested documents 2017-09-26 13:57:13 +02:00
Angel Perez
0b708397df Add base controller for Admin:Poll controller
Fixes #1848

On branch aperez-fix-for-issue-1848
  Changes to be committed:
    new file:   app/controllers/admin/poll/base_controller.rb
    modified:   app/controllers/admin/poll/booth_assignments_controller.rb
    modified:   app/controllers/admin/poll/booths_controller.rb
    modified:   app/controllers/admin/poll/officer_assignments_controller.rb
    modified:   app/controllers/admin/poll/officers_controller.rb
    modified:   app/controllers/admin/poll/polls_controller.rb
    modified:   app/controllers/admin/poll/questions_controller.rb
    modified:   app/controllers/admin/poll/recounts_controller.rb
    modified:   app/controllers/admin/poll/results_controller.rb
    modified:   app/controllers/admin/poll/shifts_controller.rb
2017-09-13 12:22:57 -04:00
María Checa
4af44a45a1 Documents upload for questions working 2017-09-06 12:00:46 +02:00
kikito
d72dc20987 Removes summary from poll questions controller 2017-01-30 18:41:24 +01:00
kikito
2be88cb316 Adds missing validation to poll::question. Fixes specs 2017-01-25 10:46:57 +01:00
kikito
65b0d27995 Moves geozones from questions to polls in admin controllers 2017-01-24 18:06:41 +01:00
Alberto Garcia Cabeza
082c483269 removes unnecessary method on questions controller 2016-12-23 18:31:45 +01:00
Alberto Garcia Cabeza
c0c76b67c2 adds successful proposals list on admin questions index 2016-12-23 14:16:29 +01:00
rgarcia
20cb044015 adds search and filter for poll questions 2016-11-29 11:46:30 +01:00
rgarcia
004ed296bc fixes missing translations 2016-11-18 20:29:32 +01:00
rgarcia
198b0018f7 adds admin poll question's show 2016-11-17 10:45:37 +01:00
rgarcia
d9ad658758 adds admin interface for poll questions 2016-11-17 09:30:42 +01:00