Commit Graph

2157 Commits

Author SHA1 Message Date
Senén Rodero Rodríguez
0239efef9d Allow administrators to run local census records importation
Allow only administrator users to run local census records importation
process
2019-07-29 13:07:24 +02:00
Senén Rodero Rodríguez
3c39dccad4 Add uniqueness validation to document_number and document_type pair 2019-07-29 13:07:24 +02:00
Senén Rodero Rodríguez
d1587ecc62 Add sanitization to clear trailing whitespaces 2019-07-29 13:07:24 +02:00
Senén Rodero Rodríguez
f071ca6cb5 Create LocalCensusRecords index page
* Create admin controller and routes
* Add pagination
* Add search by document_number
* Add EN and ES translations
* Add index specs
* Add missing model specs
2019-07-29 13:07:24 +02:00
Senén Rodero Rodríguez
5fa1bd8a6f Allow administrator users the ability to manage all LocalCensusRecords
Also check that other kind of users are not able to manage
LocalCensusRecords.
2019-07-29 13:07:24 +02:00
Senén Rodero Rodríguez
041abe9044 Add persisted but marked for destruction translations to logic
Now we take into consideration locales persisted but marked for
destruction to complete some logic and to be able to show best
translations on different situations.
2019-07-02 17:15:22 +02:00
Senén Rodero Rodríguez
d3422acbb7 Add validation to check translations amount on updates
In order to not allow users to remove all persited
translations from any resource. A few exceptions were
added:

* Does not apply to globalizable models without
   translatable attributes required
* Make a copy of main model error on current translations to be more realistic
2019-07-02 17:15:16 +02:00
taitus
1d3dd6f727 Add RemoteTranslationsCaller to new namespace
- Rename to Caller
 - Add to new namespace RemoteTranslations
 - Update references to new namespace
2019-06-27 09:21:18 +02:00
taitus
abb81fccf4 Allow create translations without length validation
We have changed validate_translation method on Globalize concern.
The objective is skip length validations when locale is distinct to
default_locale.

First we force apply :length validations when locale is equal to
default_locale. After we reject :length from options and apply rest
of validation options only when we have more than 1 options.

Ej: options = { length: "maximum: 10" }
When reject :length option in this example, options is equal to a
empty hash and we cant execute validations.
2019-06-27 09:21:18 +02:00
taitus
21f347778b Add Remote Translations Settings
- Add to seeds and dev_seeds
- Add locales
2019-06-27 09:21:18 +02:00
taitus
4272b60339 Create Remote Translations Caller
This module is used in a callback model and in charge of
  - extracting resources associated from RemoteTranslation and preparing
    its fields to be sent to the MicrosoftTranslateClient thought DelayedJobs
  - receive the response from MicrosoftTranslateClient and update resource
    with his translates

Co-authored-by: javierm <elretirao@gmail.com>
2019-06-27 09:21:18 +02:00
taitus
744a3d48fd Create RemoteTranslations Controller
- Create RemoteTranslations Controller to receive resources without
  translations and create RemoteTranslation instances when theirs
  translations are not enqueued.
- Create remote_translation_enqueued? class method on RemoteTranslation
  model to check if exists same remote translations without errors
  pending to translate.
2019-06-27 09:21:18 +02:00
taitus
04810f5080 Create RemoteTranslation model
- Each RemoteTranslation is associated with a resource (through polymorphic)
  and has the locale to we want translate.
- After create a RemoteTranslation we create a enqueue_remote_translation
  method that will be send remote translation instance to remote translation
  client
2019-06-27 09:20:25 +02:00
Senén Rodero Rodríguez
b5663a7c17 Add translation interface setting values
* Disable translation interface by default
 * Also add rake task to enable translations interface through rake
   command
2019-06-27 09:20:25 +02:00
Senén Rodero Rodríguez
e8f53cb8b7 Add translations to budget investments pg_search_scope
Some Budget::Investment attributes are now translatable so we need to
include all existing translations on pg_search model scope.
2019-06-27 09:20:24 +02:00
Senén Rodero Rodríguez
eb2e402a92 Fix budget investments sorting by title
As we cannot order budget investments by any translatable field through
AR queries we are doing the same using ruby Array sort method and doing
array pagination manually with Kaminari 'paginate_array' helper method.
2019-06-27 09:20:24 +02:00
Senén Rodero Rodríguez
bb2ee6dd3c Fix search_by_title_or_id method
Results were not including records without translations for current
locale (I18n.locale). Now we search for given title against all
translation fallbacks for current locale.
2019-06-27 09:20:24 +02:00
Senén Rodero Rodríguez
eefb9ca4f7 Add budget investment translations
Also fix sort_by_title method [1]

[1] Use ruby sort instead of active record order scope because Globalize
does not provide a way to search over all available fallbacks when
translation for current locale does not exist.
2019-06-27 09:20:24 +02:00
Senén Rodero Rodríguez
0011a0b4c7 Move Translation class inside Budget
The reason to move Translation class is explained here [1]

[1] 106649a8a5
2019-06-27 09:20:24 +02:00
Senén Rodero Rodríguez
3b03e583f9 Move Translation class inside Budget::Phase
The reason to move Translation class is explained here [1]

[1] 106649a8a5
2019-06-27 09:19:37 +02:00
Senén Rodero Rodríguez
27f6c8804f Move Translation class inside Budget::Heading
The reason to move Translation class is explained here [1]

[1] 106649a8a5
2019-06-27 09:19:37 +02:00
Senén Rodero Rodríguez
c2f393276a Move Translation class inside Budget::Group
The reason to move Translation class is explained here [1]

[1] 106649a8a5
2019-06-27 09:19:37 +02:00
Senén Rodero Rodríguez
da1c5fdb01 Remove unneded before validation callbacks
After globalize gem update there is no need to keep this monkey patch.

More information here [1]

[1] 3075c89b70
2019-06-27 09:19:37 +02:00
Senén Rodero Rodríguez
f572d5b579 Add translations to proposal pg_search_scope
Some Proposal attributes are now translatable so we need to include all
existing translations on pg_search scope.
2019-06-27 09:19:37 +02:00
Senén Rodero Rodríguez
158af0217d Add comments translations
Co-Authored-By: Sebastia <sebastia.roig@gmail.com>
2019-06-27 09:19:37 +02:00
Senén Rodero Rodríguez
ed750f6cce Move private method to a more reusable location
This method will be used by any translatable model that uses pg_search
feature so it's better to have it within globalizable model concern so
all translatable models can use it.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
036a3d7636 Add translations to debate pg_search_scope
Some Debate attributes are now translatable so we need to include all
existing translations on pg_search scope.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
740c738fc5 Add debate translations 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
02be0c61f9 Add proposal translations
Adapt retire form to include needed translations and move validations
from controller to model.

Also change sanitizable concern to sanitize not marked for destruction
translations.
2019-06-27 09:19:36 +02:00
taitus
b503eeac66 Fix spec models/widget/feed_spec.rb:61 as branch master. 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
ce7be5f2d6 Change the way to retrieve notifiable body
Using 'try' method to get notifiable is not working with translations
anymore. It was returning 'nil' always even when body translation is
populated.
2019-06-27 09:19:36 +02:00
taitus
0ffb52257f Fix specs budget_investments_spec.b:99 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
b86579c40f Avoid crash when adding new translations
Paranoia is activated on translation classes by reflection, this is
making Rails to load translation classes before to execute migration
that adds the new column.

With this extra check Rails will not execute this code until translation
table has this column created.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
1de23fc726 Add paranoid behavior to translations of paranoid models
We want to be able to fetch soft deleted translations without using
with_deleted scope.
2019-06-27 09:19:35 +02:00
Senén Rodero Rodríguez
2e8e7b83a5 Remove monkey patch
Since globalize version update this is no longer needed. New Globalize
version initializes globalized_model correctly when building new
translations.
2019-06-27 09:19:35 +02:00
lalo
c6e4b2480f Add public changes to create and vote Poll:Questions with votation type 2019-06-12 19:44:14 +02:00
lalo
23d36835d7 Add Admin changes to create Poll:Questions with votation type 2019-06-12 19:44:14 +02:00
lalo
7c9c50f4c6 Add Model changes to work with votation_types 2019-06-12 19:32:41 +02:00
German Galia
74083df10f Add historic fields to participatory budget 2019-06-12 18:03:53 +02:00
German Galia
9ce524e1f3 Create tracker rol 2019-06-12 16:23:40 +02:00
German Galia
16ffa2a259 Add change log in investment participatory budget 2019-06-12 13:06:20 +02:00
Raimond Garcia
259e05c3e0 Merge pull request #3410 from LextrendIT/report_generation
Report generation, download CSV
2019-06-12 11:45:59 +02:00
German Galia
9d1ca3bfd4 Report generation. Download csv 2019-06-12 10:17:31 +02:00
Raimond Garcia
e0e1e1dac1 Merge pull request #3437 from LextrendIT/feature/add_valuator_role_actions_manager
Add abilities to valuator model for comment and edit dossiers
2019-06-11 17:13:13 +02:00
Raimond Garcia
c1b14943e6 Merge pull request #3473 from LextrendIT/3463_collaborative_legislation_summary
Collaborative legislation summary
2019-06-11 16:41:45 +02:00
lalo
c2860dda0e Add can_comment and can_edit_dossier abilities to valuators 2019-06-11 16:24:02 +02:00
Julian Nicolas Herrero
c7ea0528e0 Merge pull request #3603 from consul/admin_stats_before_voting_phase
Avoid error when accessing final voting stats before the balloting phase
2019-06-11 14:34:42 +02:00
lalo
ef345ca87c Collaborative legislation summary 2019-06-11 14:31:44 +02:00
Raimond Garcia
139b2720d8 Merge pull request #3419 from LextrendIT/feature/add_tags_to_milestones
Add tags to milestones
2019-06-11 12:37:30 +02:00
Julian Herrero
fd71ed825b Avoid error when accessing final votes stats before balloting phase
When accessing the URL `/admin/stats/budget_balloting?budget_id=X'
for a budget in a phase prior to the balloting phase, the following
error was raised due to the stats where not calculated yet.
Instead, we'll now show a flash message.

NoMethodError:
  undefined method `[]' for nil:NilClass
  ./app/controllers/admin/stats_controller.rb:82
2019-06-10 17:28:16 +02:00