Commit Graph

1693 Commits

Author SHA1 Message Date
Javi Martín
f475f4ff3f Remove reference to site customization page locale
We don't use that attribute since we added translations for this model.
2018-11-05 18:20:50 +01:00
Javi Martín
44f71b24db Fix rubocop line too long warning 2018-11-05 18:20:50 +01:00
Javi Martín
b024363fae Fix removing an option for legislation questions
We were allowing the `_destroy` field for translations, but not for the
options themselves.
2018-11-05 18:20:50 +01:00
Javi Martín
3165b9b9f4 Fix legislation options not being updated
We broke this behaviour by introducing translations and not allowing the
`id` parameter anymore.
2018-11-05 18:20:50 +01:00
Javi Martín
87484015da Update information texts translatable fields
This part used the code we deleted in order to make it easier to
refactor the rest of the translatable models. Now we add the code back.
2018-11-05 18:20:50 +01:00
Angel Perez
ae9cad3c5b Avoid ternary operator usage when appending/creating I18n keys
When using the OR operator, if the left side of the expression evaluates
to false, its right side is taken into consideration. Since in Ruby nil
is false, we can avoid using conditionals for this particular scenario
2018-11-05 18:20:50 +01:00
Angel Perez
64dbf55d55 Fix Rubocop warnings [ci skip] 2018-11-05 18:20:50 +01:00
Raúl Fuentes
ff6e8c9bcb Move flat_hash to I18nContent model
also add unit tests for this function and a description
into the model of the behaviour of the function
2018-11-05 18:20:50 +01:00
Javi Martín
981b13ac9b Update widget cards translatable fields 2018-11-05 18:20:50 +01:00
Javi Martín
e400cb8eae Update site customization pages translatable fields 2018-11-05 18:20:50 +01:00
Javi Martín
e9a5f03089 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-11-05 18:20:50 +01:00
Javi Martín
292609e7ac 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-11-05 18:20:25 +01:00
Javi Martín
6478bb70c2 Update polls translatable fields
The `:name` attribute is still allowed in the controller because some
forks use it when creating a poll from a budget.
2018-11-05 18:20:25 +01:00
Javi Martín
7cd06bd51d Update legislation questions translatable fields 2018-11-05 18:20:25 +01:00
Javi Martín
9c5a7c58a7 Update legislation process translatable fields 2018-11-05 18:20:25 +01:00
Javi Martín
968a5b11d3 Update legislation drafts translatable fields
Updating it required reorganizing the form so translatable fields are
together.

We also needed to add a `hint` option to the form label and input
methods so the hint wouldn't show up for every language.

Finally, the markdown editor needed to use the same globalize attributes
as inputs, labels and hints, which adds a bit of duplication.
2018-11-05 18:20:25 +01:00
Javi Martín
d5bd481f7f Update milestones translatable fields
Note the title field was hidden since commit 01b9aa8, even though it was
required and translatable. I've removed the required validation rule,
since it doesn't seem to make much sense and made the translatable
tests harder to write.

Also note the method `I18n.localize`, which is used to set the
milestone's title, uses `I18n.locale` even if it's inside a
`Globalize.with_locale` block, and so the same format is generated for
every locale.
2018-11-05 18:19:50 +01:00
Javi Martín
d40cd3995d Update admin notifications translatable fields
The same way we did for banners.

We needed to add new translation keys so the labels are displayed in the
correct language. I've kept the original `title` and `body` attributes
so they can be used in other places.

While backporting, we also added the original translations because they
hadn't been backported yet.
2018-11-05 18:19:50 +01:00
Javi Martín
009cea29bf Validate translations in banners
This change forces us to use nested attributes for translations, instead
of using the more convenient `:"title_#{locale}"` methods.

On the other hand, we can use Rails' native `_destroy` attribute to
remove existing translations, so we don't have to use our custom
`delete_translations`, which was a bit buggy since it didn't consider
failed updates.
2018-11-05 18:19:50 +01:00
Javi Martín
8cd6253426 Ease customization in processes controller
By extracting a method just for the allowed parameters, forks can
customize this method by reopening the class.
2018-11-05 18:19:50 +01:00
decabeza
c80e436614 Removes guide feature 2018-11-05 18:19:50 +01:00
Javi Martín
9c13f08c8e Show selected legislation proposals by default 2018-10-04 16:31:00 +02:00
Javi Martín
8976280493 Order selected proposals by confidence score
The same way we order budget results.
2018-10-04 16:31:00 +02:00
Javi Martín
d9410a132a Always show filters for legislation proposals
As done in the rest of the application: we show the filters even if
there isn't any data to display.
2018-10-04 16:31:00 +02:00
Javi Martín
2fb5fb5fb2 Add missing newline characters 2018-10-04 16:31:00 +02:00
Javi Martín
ec2b4fe7ff Use %w[] instead of %w{}
As agreed when discussing our rubocop rules.
2018-10-04 16:30:59 +02:00
Javi Martín
d6ff7e0f3f Simplify code 2018-10-04 16:29:01 +02:00
Javi Martín
75d1ab1e52 Use AJAX requests to select legislation proposals
Now the interface is more similar to the one in budget investments.
2018-10-04 16:29:01 +02:00
Javi Martín
667c2c82b5 Use toggle_select action for legislation proposals
The `update` action is usually expected to behave the same way it does
everywhere else, which is updating a record using the `params` hash.

The name `toggle_select` comes from the name we use in a similar
situation for budget investments.
2018-10-04 16:29:01 +02:00
Raúl Fuentes
05340e423c Add select to Legislation::Proposals
Add admin interface for mark any proposal as selected
Add filter to public interface for selected proposals
2018-10-04 16:28:56 +02:00
voodoorai2000
422f3a5f47 Add tag filtering for legislation proposals 2018-10-04 15:43:41 +02:00
Javi Martín
ec18743251 Authorize resource after authenticating user
Just like it's done everywhere else in the application. Not doing so
means users who aren't logged in receive a "you aren't authorized"
message when they try to create a new legislation proposal instead of
being redirected to the login page.
2018-10-03 22:06:20 +02:00
María Checa
d73be15296 Added tests 2018-10-03 16:02:41 +02:00
María Checa
056086e81e Allow admins to see legislation debates and proposals index 2018-10-03 16:02:12 +02:00
Bertocq
df3df71a54 Force postgresql setseed value in correct range
This commit partially backports commit AyuntamientoMadrid@f038399 by
taking only the parts affecting code already in CONSUL's main
repository.
2018-10-03 13:46:32 +02:00
Bertocq
c04b0ceda4 Add pagination to legislation process proposals list 2018-10-03 13:46:32 +02:00
Bertocq
349abffb20 Add random order based on seed to legislation process proposals list 2018-10-03 13:40:59 +02:00
Bertocq
599ddf8f41 Create @proposal variable con process controller for proposals list that use random seed 2018-10-03 13:40:59 +02:00
Bertocq
4ab9b8b767 Move onto proposals method the random seed call 2018-10-03 13:40:59 +02:00
Bertocq
0cabede68c Add random seed on Legislation Proposal controller for index 2018-10-03 13:40:59 +02:00
Javier Martín
132fea9c94 Merge pull request #2913 from papayalabs/2741-updates-translatable-custom-pages-reloaded
Updates translatable custom pages
2018-10-03 13:23:13 +02:00
Javier Martín
2775ae2b50 Merge pull request #2924 from consul/backport-1588-make-homepage-content-translatable
Make homepage content translatable
2018-10-03 13:20:49 +02:00
Alberto
857f747ab8 Merge pull request #2922 from consul/legislation-proposals-imageable
Legislation proposals imageable
2018-10-02 11:22:19 +02:00
decabeza
7c194f6042 Adds imageable to legislation proposals 2018-10-01 16:48:46 +02:00
decabeza
dd11a040a6 Adds setting to enable or disable help page 2018-09-28 18:59:28 +02:00
Papaya Labs
914bfa645e Updates translatable custom pages 2018-09-27 13:46:17 +02:00
Javi Martín
5bb5cfa7fb Make Widget::Card translatable 2018-09-26 16:09:09 +02:00
Raimond Garcia
4086220ebf Merge pull request #2914 from microweb10/make_polls_translatable
Make polls translatable
2018-09-26 13:19:17 +02:00
Julian Herrero
673ec075eb Make answers translatable 2018-09-20 17:13:40 +02:00
Julian Herrero
5e6248d2ac Make questions translatable 2018-09-20 17:11:53 +02:00