Commit Graph

1709 Commits

Author SHA1 Message Date
Javi Martín
2ab49a1832 Refactor globalize models code using a concern
I've chosen the name "Globalizable" because "Translatable" already
existed.
2018-10-22 16:28:53 +02:00
Javi Martín
139cf769c6 Update widget cards translatable fields 2018-10-22 16:28:49 +02:00
Javi Martín
3c170f47d2 Update site customization pages translatable fields 2018-10-22 16:13:48 +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
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
Javi Martín
759de935ee 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-10-22 15:52:58 +02:00
Javi Martín
85701bd754 Update legislation questions translatable fields 2018-10-22 15:46:24 +02:00
Javi Martín
5bfc7ca2e3 Update legislation process translatable fields 2018-10-22 15:46:16 +02:00
Javi Martín
6278175f57 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-10-22 15:44:14 +02:00
Javi Martín
01a254545f 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-10-22 15:44:14 +02:00
Javi Martín
a326bcb0a1 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-10-22 15:43:56 +02:00
Javi Martín
71601bd3f8 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-10-22 15:43:28 +02:00
kreopelle
14a1eeb44f Change spelling for constant to TITLE_LENGTH_RANGE, instead of TITLE_LEGHT_RANGE 2018-10-10 21:02:55 -04: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
dc9cf5da55 Order by supports in descending order
Just as we do with confidence score, and as admins expect when they
order by received supports: the ones with more supports appear first.
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
María Checa
6d5e1a075e Allow admins to access Legislation::Proposal #show and Legislation::Process #proposals 2018-10-03 16:01:18 +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
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
46030c72e8 remove unnecessary parameter 2018-09-21 20:53:20 +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
Julian Herrero
9495208518 Make polls translatable 2018-09-20 17:07:43 +02:00
Javi Martín
3fb98b1752 Fix typos 2018-09-19 14:54:52 +02:00
Javi Martín
a0f1a9ec1b Be consistent checking changes in draft versions
There's no reason to only convert Markdown to HTML in translations when
their body changes but to always convert it when the "main" body field
changes.

Whether we should always use the condition or never use it is something
we can debate about, though.
2018-09-19 14:54:24 +02:00
Marko Lovic
64d72ca8e7 Enable JS in shared translatable test
Due to its markdown editor, the admin draft version page
requires JS to correctly render the draft version form.
2018-09-19 14:54:24 +02:00
Marko Lovic
05bfa193cd Make Legislation Draft Versions translatable 2018-09-19 14:54:24 +02:00
Marko Lovic
06347062dd Make Legislation Questions translatable 2018-09-19 14:54:24 +02:00
Marko Lovic
d78aea1fd3 Make Legistlation Processes translatable 2018-09-19 14:54:24 +02:00
Marko Lovic
f6749049c9 Make Admin Notifications translatable 2018-09-19 12:15:26 +02:00
Raimond Garcia
ea72cd058b Merge pull request #2876 from javierm/ckeditor4_update
Ckeditor4 update
2018-09-17 23:02:50 +02:00
Javi Martín
531750cf6f Restore commented lines
Not sure if they were supposed to be removed. For now I'll assume they
were commented accidentally.
2018-09-12 12:35:28 +02:00
Javi Martín
471061f475 Allow only admins to attach CKEditor images
Right now allowing regular users to attach images would make us
vulnerable to CSRF attacks.
2018-09-12 12:35:28 +02:00
Raúl Fuentes
d574657b77 Fixes for the review made by @javierm
this commit will be merged with the others when the chages
are accepted
2018-09-12 12:35:28 +02:00
Raúl Fuentes
8e68f4bbd0 Update abilities for ckeditor4 images
Add the image controller to use the obsolete load_and_authorize_resource
and authorize_resource methods in the gem
2018-09-12 12:35:28 +02:00
Raúl Fuentes
424535c1ae Add models needed to include images on ckeditor4 2018-09-12 12:35:28 +02:00
Marko Lovic
c7fcdd9b0e Use standard locale names for Globalize
It turns out it is not necessary to downcase and underscore
locale names to use the globalize-accessor gem. The gem
will automatically underscore the locale name when defining and
calling the accessor methods.
2018-09-11 18:48:14 +02:00
Marko Lovic
3f277c5cdf Avoid duplicating list of locales 2018-09-11 18:46:58 +02:00
Raimond Garcia
4f2ed27f8c Merge pull request #2865 from consul/backport_1585-make_banners_translatable
[Backport] Make banners translatable
2018-09-10 16:41:33 +02:00
Raimond Garcia
7014686b15 Merge pull request #2813 from javierv/2812-fix_admin_menu_not_showing
Fix admin menu not showing for high IDs
2018-09-07 15:52:02 +02:00
Alberto
21f36e6be5 Merge branch 'master' into feature/1-nav-content-blocks 2018-09-05 12:41:07 +02:00
Marko Lovic
0fa4b60f39 Make Banners translatable 2018-08-30 16:29:29 +02:00
decabeza
c15769ba48 Updates logo header sizes and images for specs 2018-07-30 19:55:43 +02:00
Javier Martín
3b82057178 Fix admin menu not showing for some admins
There was a bug when finding the manager login, since we were only using
the last digit of their user ID.
2018-07-28 22:06:11 +02:00
Javier Martín
157cd001d5 Add spec to expose a bug finding manager logged in
I've moved the method to the User model in order to make it easier to
test. I'm not sure where it belongs, though.

There was already a failing spec in `spec/features/management_spec.rb`,
but it passed if run standalone because it only failed if previous tests
had already created nine users or more.
2018-07-28 22:03:33 +02:00