Commit Graph

424 Commits

Author SHA1 Message Date
rgarcia
11437a1d40 add budget investment stats 2019-05-16 13:41:49 +02:00
rgarcia
94a3e7e61a does not exclude ahoy events 2019-05-16 13:37:47 +02:00
decabeza
cb22e6cbfb Merge branch 'master' into proposal-dashboard 2019-04-23 17:12:47 +02:00
Javi Martín
4adf712c26 Prepend custom assets to CONSUL assets
Rails 5 changed the initialization order, and now our initializers were
running before the `append_assets_path` initializer for each engine,
which prepended application assets to the custom assets we prepended in
the initializer.

Moving the code to the `config.after_initialize` code didn't work
either, since the paths added there were ignored by the application.

Adding another initializer to the Rails Engine is a hack, but solves the
problem.
2019-04-17 17:40:57 +02:00
Julian Herrero
6e88031537 Fix several rubocop warnings
Metrics/LineLength: Line is too long.
RSpec/InstanceVariable: Use let instead of an instance variable.
Layout/TrailingBlankLines: Final newline missing.
Style/StringLiterals: Prefer double-quoted strings.
2019-04-17 17:40:56 +02:00
Julian Herrero
f668317cc1 Use #data_source_exists? instead of #table_exists?
DEPRECATION WARNING: #table_exists? currently checks both tables and
views. This behavior is deprecated and will be changed with Rails 5.1
to only check tables. Use #data_source_exists? instead.
2019-04-17 17:40:55 +02:00
alejandro
935b41154f removes configurations and settings for devise-async 2019-04-16 17:28:07 +02:00
alejandro
84338592da removes devise-async for delayed devise emails
Custom overwrite of the devise implementation following
https://github.com/plataformatec/devise#activejob-integration
2019-04-16 17:28:07 +02:00
rgarcia
23fcd78e6c removes uniq deprecation warning 2019-04-16 17:28:07 +02:00
Juanjo Bazán
eb36b7e2e5 updates config files 2019-04-16 17:28:06 +02:00
decabeza
2af154d539 Merge branch 'master' into proposal-dashboard 2019-03-28 01:26:04 +01:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Javi Martín
4c35df4812 Use double quotes inside string interpolation 2019-03-25 14:58:54 +01:00
Javi Martín
2b4e1cf358 Add missing double quotes
We overlooked a few single quotes while we changed thousands of them.
2019-03-25 13:22:35 +01:00
Julian Herrero
a8d8d2cdf9 Use double quotes in config/initializers 2019-03-15 10:29:03 +01:00
Julian Herrero
366505f886 Return a String in I18n method 'pluralize'
If a translation was missing returning a Fixnum was raising an
exception 'undefined method X for Fixnum'.
2019-02-15 11:59:57 +01:00
Julian Nicolas Herrero
4a12425987 Merge pull request #3296 from consul/make_budgets_translatable
[Backport] Make budgets translatable
2019-02-13 19:01:13 +01:00
Julian Herrero
922600252c Make budget headings translatable 2019-02-13 13:35:07 +01:00
Julian Herrero
1c35ec99c1 Make budget groups translatable 2019-02-13 12:30:37 +01:00
Julian Herrero
90d0a6e416 Make budget phases translatable 2019-02-13 11:44:56 +01:00
voodoorai2000
f4b8099703 Simplify sql query 2019-02-12 17:18:38 +01:00
Julian Herrero
c9e172049c Add prefix to staging emails subject 2019-01-31 11:13:23 +01:00
Ziyan Junaideen
73b49adcc4 Secret yml update + checking for presence of recipients 2019-01-31 10:50:59 +01:00
Ziyan Junaideen
7dc999f437 Recipient interceptor initializer 2019-01-31 10:50:59 +01:00
Javi Martín
4f25581636 Add progress bar polymorphic views 2019-01-18 14:17:29 +01:00
Javi Martín
2c2831beb0 Use polymorphic paths for milestones 2018-12-05 12:23:52 +01:00
Marko Lovic
c0f6fa182f Make Milestones general, and not specific to Budget Investments
Generalize the Budget::Investment::Milestone model to a
polymorphic Milestone model so it can be used for entities
other than Budget::Investment.
2018-11-30 14:15:21 +01:00
voodoorai2000
42d4fd880f Increase delayed jobs max run time 2018-10-30 17:11:13 +01:00
Javi Martín
2e6644d513 Fix crash with no translation for default locale
When we were visiting a page showing the content of a record which uses
globalize and our locale was the default one and there was no
translation for the default locale, the application was crashing in some
places because there are no fallbacks for the default locale.

For example, when visiting a legislation process, the line with
`CGI.escape(title)` was crashing because `title` was `nil` for the
default locale.

We've decided to solve this issue by using any available translations as
globalize fallbacks instead of showing a 404 error or a translation
missing error because these solutions would (we thinkg) either require
modifying many places in the application or making the translatable
logic even more complex.

Initially we tried to add this solution to an initializer, but it must
be called after initializing the application so I18n.fallbacks[locale]
gets the value defined in config.i18n.fallbacks.

Also note the line:

fallbacks[locale] = I18n.fallbacks[locale] + I18n.available_locales

Doesn't mention `I18n.default_locale` because the method
`I18n.fallbacks[locale]` automatically adds the default locale.
2018-10-22 16:36:18 +02:00
Javi Martín
3b5a12b0ab Don't force translations for the current locale
Globalize creates a translation for the current locale, and the only way
I've found to change this behaviour is to monkey-patch it.

The original code uses `translation.locale` instead of
`Globalize.locale`. Since `translation.locale` loads the translation
with empty attributes. It both makes the record invalid if there are
validations and it makes it almost impossible to create a record with
translations which don't include the current locale.

See also the following convertations:

https://github.com/globalize/globalize/pull/328
https://github.com/globalize/globalize/issues/468
https://github.com/globalize/globalize/pull/578
https://github.com/shioyama/mobility/wiki/Migrating-from-Globalize#blank-translations
2018-10-22 16:28:53 +02:00
decabeza
546105d989 Merge branch 'master' into dashboard-master 2018-10-19 01:48:37 +02:00
decabeza
e0c5a79fae Removes dashboard mailer css 2018-10-13 12:59:05 +02:00
Raimond Garcia
f68dc2e1a9 Merge pull request #2936 from consul/i18n-pluralize
Avoid InvalidPluralizationData exception when missing translations
2018-10-05 12:57:48 +02:00
voodoorai2000
be80973e44 Avoid InvalidPluralizationData exception when missing translations
We work with many languages using Crowdin[1]

Sometimes translators forget to fill in all the necessary plural forms of a translation (zero, one, other) and in those cases we were seing the exception InvalidPluralizationData being raised

There are a number of approches to fix this... from being more strict when approving translations, to automatically extrapolating what those plural forms should be

For now, we've gone for a simple approach to display the actual count(0,1,2,3,4, etc) instead of the whole translation

So, if the plural form of "1 comment" is missing, just a "1" will be displayed and no exceptions raised

Note: The first two specs, test what is really Rails' functionalities. However as we are monkey patching the pluralize method, I thought it was appropriate to doble check it

[1]https://crowdin.com/project/consul
2018-10-05 12:26:07 +02:00
decabeza
62490c4640 Adds custom javascripts folder 2018-09-26 12:34:16 +02:00
Javier Martín
ef0192c3ff Merge pull request #2912 from consul/backport-make-collaborative-legislation-translatable
Make collaborative legislation translatable
2018-09-24 17:45:59 +02:00
decabeza
a94591fe78 Loads custom fonts before default ones
Also includes a .keep file inside fonts/custom folder to track the directory by git
2018-09-21 13:46:50 +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
Raimond Garcia
71a537b4db Merge pull request #2903 from consul/backport-refactor-translatable-specs
[Backport] Refactor translatable specs
2018-09-17 23:05:06 +02:00
Javi Martín
726110c91e Share Globalize JavaScript interface specs 2018-09-17 20:34:20 +02:00
Javi Martín
a64a290392 Extract commentable_path to an initializer
By doing so and including it in ActionDispatch::Routing::UrlFor, we make
it available in controllers, helpers and specs, and so we can remove the
duplication we had there with methods dealing with the same problem.

Even if monkey-patching is ugly, using a different module and executing
ActionDispatch::Routing::UrlFor.send(:include, MyModule) wouldn't make
the method available in the controller.
2018-09-17 20:28:55 +02:00
Javi Martín
43e83889ff Simplify CKEditor authorization
We can use the `config.authorize_with` option, so we don't need to copy
the controller in order to load and authorize resource.

Besides, only administrators can upload images, so we don't need to
track the image's user id.
2018-09-12 12:35:28 +02:00
Javi Martín
71ce7acc10 Restore deleted CKEditor config
Just so we can navigate throught git history faster:

* Introduced in 345e34d to avoid precompiling all CKEditor assets.
* Modified in 54c82a5 to avoid compiling assets during tests.
* Overwritten by `rails g ckeditor:install` in c0d6c0b.
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
88f0f14eab Modify the configuration of ckeditor 4
add links, headers and images
2018-09-12 12:35:28 +02:00
Pierre
88d857f50c Fix a misleading comment 2018-08-13 11:27:49 +02:00
Juan Salvador Pérez García
6cc1ddb9af Fixes #231
Implements a poster feature for the proposals dashboard
2018-07-31 12:50:25 +02:00
rgarcia
4c8b174274 Display only translations for the current language
After creating a translation in spanish, it was also displaying it when selecting
the english locale.

This was due to the code picking the first translation available

With this commit, we are checking for an existing translation in the current locale
and displaying it if it exists
2018-07-26 21:55:07 -04:00
Angel Perez
113981c573 Avoid unnecessary DB call on I18nTranslation initializer 2018-07-26 19:09:36 -04:00
Angel Perez
7255c6cb9b Fallback to default I18n value if translation is not available 2018-07-26 19:07:47 -04:00