Commit Graph

11202 Commits

Author SHA1 Message Date
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
601fe666d9 Fix question options translations not being saved
If we enabled the locale and then added an option, the "add option" link
added the partial which was generated before enabling the translation,
and so it generated a field where the translation was disabled.

Enabling the translation after inserting each field solves the issue.
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
5e6dfe6ed8 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-11-05 18:19:50 +01:00
Javi Martín
a8f8a7bc4f 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-11-05 18:19:50 +01:00
Javi Martín
6fc3389587 Keep invalid translation params through requests
We were reloading the values from the database and ignoring the
parameters sent by the browser.
2018-11-05 18:19:50 +01:00
Javi Martín
1874480ff0 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-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
decabeza
68b83f3a2b Removes unnecessary style to orbit slide 2018-11-05 18:19:50 +01:00
decabeza
c30c94f878 Removes condition to allow images and data equalizer on proposals
The proposal image only can be present if feature :allow_images is enabled, so there is no need to include both conditions. The data-equalizer also is unnecessary because the :thumb image already has an fix height.
2018-11-05 18:19:50 +01:00
decabeza
ebca4bca9b Removes styles to fix logo size on devise views 2018-11-05 18:19:50 +01:00
decabeza
22d8a26b33 Removes unnecessary styles for admin budgets groups 2018-11-05 18:19:50 +01:00
decabeza
d5aa4f7807 Fixes color of datepicker calendar 2018-11-05 18:19:50 +01:00
decabeza
889311853e Updates is-active class for view mode 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
Javi Martín
55a32d8579 Bring back CKEditor images button
It was accidentally deleted in commit 914bfa6.

Note the following spec passes on my machine if we add a `sleep 0.1`
call in the `:wait_readable` part of ruby's `Net::Protocol#rbuf_fill`.
Otherwise, it hangs forever after clicking the `.fileupload-file` div,
which closes its window. It might be solved when upgrading rails,
capybara, selenium or chromedriver.

scenario "Allows images in CKEditor", :js do
  visit edit_admin_site_customization_page_path(custom_page)

  within(".ckeditor") do
    within_frame(0) { expect(page).not_to have_css("img") }

    expect(page).to have_css(".cke_toolbar .cke_button__image_icon")
    find(".cke_toolbar .cke_button__image_icon").click
  end

  within_window(window_opened_by { click_link "Browse Server" }) do
    attach_file :file,
                Rails.root.join('spec/fixtures/files/clippy.jpg'),
                visible: false
    find(".fileupload-file").click
  end

  click_link "OK"

  within(".ckeditor") do
    within_frame(0) { expect(page).to have_css("img") }
  end
end
2018-11-05 18:19:50 +01:00
Javi Martín
5e95339e51 Fix flaky legislation question spec
The test was failing sometimes because of the sequence:

within('#side_menu') do
  click_link "Collaborative Legislation"
end

click_link "All"
expect(page).to have_content 'An example legislation process'
click_link 'An example legislation process'

Right after clicking the "Collaborative Legislation" link, the link 'An
example legislation process' is already available. So sometimes Capybara
might click the links "All" and 'An example legislation process' at more
or less the same time, causing the second link not to be correctly
clicked.

Making sure the "All" link doesn't exist anymore we guarantee Capybara
will wait for the previous AJAX request to finish before clicking the
next link.

Note the test to "Create Valid legislation question" is almost identical
but it doesn't fail because it doesn't use Capybara's JavaScript driver.
2018-11-05 18:19:50 +01:00
decabeza
c80e436614 Removes guide feature 2018-11-05 18:19:50 +01:00
voodoorai2000
bc0479f9c3 Fix pluralization spec when using different default locale
This spec was failing due to using :es as the default_locale in application.rb[1], but using :en as the default_locale in the test environment[2]

The fallback rules where getting a little confused and not including the default locale, for the test environment, in the fallback rules

With this commit we are making sure that rule is created, as it would in a production environment that uses the default_locale in application.rb

[1] https://github.com/AyuntamientoMadrid/consul/blob/master/config/application.rb#L22

[2] https://github.com/AyuntamientoMadrid/consul/blob/master/spec/rails_helper.rb#L15
2018-11-05 18:19:50 +01:00
voodoorai2000
2c34a8b4e2 Remove fallback rules for locales not yet added 2018-11-05 18:19:50 +01:00
voodoorai2000
56e85ff692 Remove duplicate language names 2018-11-05 18:19:50 +01:00
voodoorai2000
9fcd2598c1 Add fallback i18n locales
All other languages will fallback to the default locale

Rails also, seems to pick up dialect fallbacks, for locales with this format: es-CO, es-PE, etc, which will fallback to "es", so that is great 😌
2018-11-05 18:16:58 +01:00
voodoorai2000
df32a5407f Add all available locales
Only addding those with significant number of translations
2018-11-05 18:16:58 +01:00
voodoorai2000
5117f3eb37 Add all language names 2018-11-05 18:16:58 +01:00
Javi Martín
82187a9c1a Skip spec before doing any requests
Skipping a spec in the middle of it, particularly after doing some
requests, caused Capybara to keep using the same driver in the following
spec.

Since the current spec uses the JavaScript driver, the next test would
also use the JavaScript driver, causing apparently random failures if
that test was supposed to use the Rack driver.
2018-11-05 18:05:49 +01:00
kreopelle
e357ff2236 Change spelling for constant to TITLE_LENGTH_RANGE, instead of TITLE_LEGHT_RANGE 2018-11-05 18:05:49 +01:00
voodoorai2000
b49b20a6bb Fix locale folder names
There seems to be some differences between the folder name and the locale name used in the files themselves.

For example: the folder might have been called "de-DE", for German, but the files use one "de"

And thus translations where not being displayed

Using the locale key in the files and modifying the folder name if neccesary, let's see what happens in the next Crowdin pull, might need to review more thoroughly why this is happening (maybe due to custom settings in Crowdin)
2018-11-05 18:05:49 +01:00
voodoorai2000
c46ee1175b Fix flaky spec for translations
This spec was causing a side effect on another spec[2], making it fail 😌

I think it was because no translation had been called yet, in the failing spec, and so the the i18n backend translations had not been initialized, and was always returning empty translations for any locale. This might have been due to tampering with translations in the this newly introduced spec.

By forcing translations to load after this new spec, the other spec passes again

[2] https://github.com/AyuntamientoMadrid/consul/blob/master/spec/features/localization_spec.rb#L20
2018-11-05 18:05:49 +01:00
Angel Perez
97809db1b7 Enable filtering of investments by their milestones statuses 2018-11-05 18:04:38 +01:00
Angel Perez
3574bf867c Add default image for investments without picture 2018-11-05 18:04:38 +01:00
Angel Perez
3e6cbc9505 Add basic frontend for budget executions list 2018-11-05 18:04:38 +01:00
Consul Bot
3bd19b2046 New translations general.yml (Spanish, El Salvador) 2018-11-05 17:41:38 +01:00
Consul Bot
93c53520a1 New translations mailers.yml (Spanish, El Salvador) 2018-11-05 17:41:34 +01:00
Angel Perez
b483ca7f7e Add 'Execution' tab to a finished Budget
This new tab will show all winner investments projects with milestones
2018-11-05 16:33:32 +01:00
Consul Bot
90fec25489 New translations general.yml (Spanish, El Salvador) 2018-11-05 16:11:29 +01:00
Consul Bot
8e6922de9f New translations devise.yml (Spanish, El Salvador) 2018-11-05 16:11:25 +01:00
Consul Bot
86ebd64504 New translations rails.yml (Turkish) 2018-11-05 14:42:32 +01:00
Consul Bot
1db9022a25 New translations i18n.yml (Persian) 2018-11-05 14:42:31 +01:00
Consul Bot
6079c1f235 New translations i18n.yml (German) 2018-11-05 14:42:29 +01:00
Consul Bot
6c33f17fcb New translations rails.yml (Portuguese, Brazilian) 2018-11-05 14:32:09 +01:00
Consul Bot
a4f87553d4 New translations rails.yml (Polish) 2018-11-05 14:32:07 +01:00
Consul Bot
192d654d73 New translations rails.yml (Italian) 2018-11-05 14:32:05 +01:00
Consul Bot
e71d6ddfc5 New translations rails.yml (Indonesian) 2018-11-05 14:32:04 +01:00
Consul Bot
0b7730fcf6 New translations rails.yml (Galician) 2018-11-05 14:32:02 +01:00
Consul Bot
23a5ecdbf0 New translations rails.yml (Dutch) 2018-11-05 14:32:01 +01:00