Commit Graph

797 Commits

Author SHA1 Message Date
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
96b3a37222 Disable removed translations
After removing a translation while editing another one with invalid data
and sending the form, we were displaying the removed translation to the
user.

We now remove that translation from the form, but we don't remove it
from the database until the form has been sent without errors.
2018-10-22 15:43:28 +02:00
Javi Martín
7deb857357 Don't disable new invalid translations
After adding a new translation with invalid data and sending the form,
we were disabling the new translation when displaying the form again to
the user, which was confusing.
2018-10-22 15:43:28 +02:00
Javi Martín
1d2979cd57 Keep invalid translation params through requests
We were reloading the values from the database and ignoring the
parameters sent by the browser.
2018-10-22 15:43:28 +02:00
Javi Martín
5cdda12902 Simplify passing the locale to translatable fields
Creating a new form builder might be too much. My idea was so the view
uses more or less the same syntax it would use with Rails' default
builder, and so we can use `text_field` instead of
`translatable_text_field`.
2018-10-22 15:43:28 +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
decabeza
546105d989 Merge branch 'master' into dashboard-master 2018-10-19 01:48:37 +02:00
decabeza
4db54092e6 Removes unrelated dashboard changes 2018-10-18 01:26:07 +02:00
decabeza
dbf41421ed Removes guide feature 2018-10-17 14:58:29 +02:00
Raimond Garcia
710e5ae965 Merge pull request #2949 from consul/i18n-language-names
Display language name or language key
2018-10-10 11:45:04 +02:00
voodoorai2000
0a0261900c Display language name or language key
There where two issues with the current implementation:

- There was a possible duplication between looking up the language name in key "locale" and in key "i18n.language.name"

- The "default" option was not being picked up, as the fallback always returned the default locale's translation, "English"

With this implementation there is only a single place to put the language name: i18n.language.name. I think this place is easier to find and understand for Crowdin translators than a "locale" key hidden in general.yml

If the translation is not found we display the language key, instead of English, which makes more sense to me too 😌

Solution based on recent comments[1] on a related I18n issue

[1] https://github.com/svenfuchs/i18n/issues/365#issuecomment-419263847
2018-10-05 18:08:41 +02:00
decabeza
57b9f54647 Adds styles to dashboard menu 2018-10-05 17:55:42 +02:00
Javi Martín
4c84a3a854 Move logic from view to helper 2018-10-04 16:31:00 +02:00
Javi Martín
f93281fd02 Extract link text to a helper
This way we can use the same code in custom views which won't use the
same text.
2018-10-03 22:06:20 +02:00
Juan Salvador Pérez García
488e7e081f Merge branch 'dashboard' into rebase_consul_master 2018-09-27 09:18:27 +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
4344165bce change translatable form helper for cktext_area 2018-09-24 19:40:51 +02:00
Julian Herrero
e6762d6bca handle non-underscored locale names for cktext_area 2018-09-21 20:50:23 +02:00
Javi Martín
b787e33883 Use the same system to freeze time in all specs
This required changing the `voted_before_sign_in` slightly in order to
change what the method returns if the user signed in and voted at the
exact same microsecond.

It doesn't affect production code because it would be impossible for the
user to do both things at the same time.

As a side effect, the method now returns what the method name suggests.
Before this change, the correct method name would have been
`voted_before_or_at_the_same_time_of_sign_in`.

As a less desirable side effect, in the tests now we need to make sure
at least one second passes between the moment a user votes and the
moment a user signs in again. One microsecond wouldn't work because
the method `travel_to` automatically sets microseconds to zero in order
to avoid rounding issues.
2018-09-19 14:11:50 +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
Juan Salvador Pérez García
6412f95e56 Added comments
Added comment to clarify obscure method
2018-09-17 09:10:31 +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
6fe7dc22bc Fix translatable field labels to not include locale
Label for field :title should be "Title", not "Title en"
2018-09-11 18:48:09 +02:00
Marko Lovic
ca5f8719a8 Fix helper to merge style option correctly 2018-09-11 18:48:05 +02:00
Marko Lovic
1fb1437886 Fix merging_translatable_field_options helper 2018-09-11 18:48:01 +02:00
Marko Lovic
5ad3bf03cd Nest TranslatableFormBuilder in helper module
To avoid having multiple top-level classes per file
2018-09-11 18:47:57 +02:00
Marko Lovic
e26500179a Add missing blank line between methods 2018-09-11 18:47:52 +02:00
Marko Lovic
38e6c394e7 Change string manipulation to use interpolation for readability 2018-09-11 18:47:48 +02:00
Marko Lovic
b9f3ea2a33 Change variable name to reflect possibility of being array 2018-09-11 18:47:43 +02:00
Marko Lovic
7b0aa1e104 Extract merge_translatable_field_options helper method 2018-09-11 18:47:34 +02:00
Marko Lovic
61e3b3b406 Incorporate label into translatabel field
Suggested by @javierm so that we can take advantage of certain browser
features that rely on a <label> tag being associated with an <input> tag.
2018-09-11 18:47:28 +02:00
Marko Lovic
2cb3e4b111 Extract translatable field logic to FormBuilder 2018-09-11 18:46:50 +02:00
Marko Lovic
4603a30f95 Change Translatable impl to keep track of enabled locales 2018-09-10 17:18:01 +02:00
Marko Lovic
cb716e07d7 Extract translation helper from translatable form views
So that individual form partials don't depend on the implementation
of how translations are deleted.
2018-09-10 17:17:47 +02:00
Juan Salvador Pérez García
983c108272 Second atempt to fix issue with sprockets 2018-07-31 13:02:57 +02:00
Juan Salvador Pérez García
87d92b2553 Fixed issue with sprockets in production 2018-07-31 12:59:02 +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
Raimond Garcia
2c79197a05 Merge pull request #2809 from wairbut-m2c/backport/translatable-content-for-admin
Basic content for I18n on Admin panel
2018-07-27 18:01:00 +02:00
Alberto
65e4435822 Merge pull request #2137 from wairbut-m2c/iagirre-admin-menu-in-management
Add admin menu in management view (if user is admin)
2018-07-27 12:35:07 +02:00
Alberto
fb19aafee7 Merge pull request #2778 from wairbut-m2c/backport/investments-moderation
Allow budget investments to be moderated
2018-07-27 12:34:17 +02:00
16yuki0702
c14fbf8540 Fixed misunderstanding 2018-07-27 16:34:00 +09:00
16yuki0702
57dbb0220a Fix active item on admin menu 2018-07-27 15:45:42 +09:00
rgarcia
78a5c0356e Add globalization javascript interface specs 2018-07-26 20:49:00 -04:00
Angel Perez
dd42b7ffbd Correctly highlight 'Custom information texts' option on menu if active 2018-07-26 19:08:02 -04:00
Raúl Fuentes
c18479e3ac Add translations management pages
In the admin section of the application, a new page
has been added so that the admins are able to manage
the selected texts for translate.

The texts have been divided in different "sections",
depending on the nature of themselves (budgets, polls,
proposals, management, etc.). Each section has become a tab
with a form associated to edit all the texts for her.

When a language is added, it's added for ALL the texts in the
application. That means that, if an admin adds french for debates,
the french form will appear for the rest of the texts. That doesn't
mean that they need to fill all the texts, only that the languages
work for all of them instead of individually.
2018-07-26 19:05:58 -04:00
María Checa
e9d73eb687 Fix max_per_heading filter in Admin budget investments list
Also changed the name of the param to `min_total_supports`, which is more descriptive on what it actually does.

Backport of 75f20d5 and 07f0806 from AyuntamientoMadrid/consul fork
2018-07-25 15:44:51 +02:00
Alberto
61589122ef Merge pull request #2723 from wairbut-m2c/backport_2400_combine_free_text_search_and_filters
Combine text search and filters for Investments on Admin panel
2018-07-25 14:42:19 +02:00
Juan Salvador Pérez García
8876b285ce Fixes #229
Adds email feature for proposals dashboard
2018-07-25 13:28:44 +02:00
Juan Salvador Pérez García
e5f9cf6710 Fixed #239
Proposals dashboard refactored to dashboard.
Added missing specs for the dashboard.
2018-07-24 15:52:43 +02:00
Juan Salvador Pérez García
3b37b4b09d Fixes #238
Applies new card design for polls in proposals dashboard.
Fixes warnings during tests.
Adds tests for new card design for polls in proposals dashboard.
2018-07-23 10:31:50 +02:00