Commit Graph

991 Commits

Author SHA1 Message Date
Anna Anks Nowak
9786b0bf7d Rewrite sorting to support direction param [#2931] 2019-01-10 15:34:33 +01:00
Anna Anks Nowak
5dd468092a Rewrite the method to not use budget_investments_sorting_options [#2931] 2019-01-10 15:28:55 +01:00
Anna Anks Nowak
22059379f5 Refactor by creating a helper method for generating sorting links [#2931] 2019-01-10 15:28:55 +01:00
Julian Herrero
1ea18f0c89 refactor - correct place for block variable 2019-01-02 12:50:01 +01:00
Julian Herrero
2081269a67 fix Hound violations 2019-01-02 10:46:31 +01:00
Raimond Garcia
a8de5306c8 Merge pull request #3091 from dpgigorro/2791-homepage-for-legislation-process
add homepage for legislation processes
2018-12-19 11:14:24 +01:00
Javier Martín
4782ca37d6 Merge pull request #3111 from consul/backport-customize_toda_la_ciudad
Remove custom "toda la ciudad" code
2018-12-18 13:03:51 +01:00
Julian Nicolas Herrero
2175339609 Merge pull request #3106 from consul/2918-crud_budget_groups_headings
Change CRUD for budget groups and headings
2018-12-18 10:23:24 +01:00
dperez
bef404c443 add homepage for legislation processes 2018-12-15 18:04:24 +01:00
Javi Martín
e6a609e6e5 Extract method to filter investments by status 2018-12-14 18:15:51 +01:00
Javi Martín
b4b0b18a2d Extract method to get investment milestone status 2018-12-14 18:15:51 +01:00
Julian Herrero
8fb8f70efd cleanup (due to new CRUD for budget groups and headings) 2018-12-14 15:37:25 +01:00
Javi Martín
03dc43a500 Manage legislation process milestones 2018-12-11 20:18:53 +01:00
Julian Nicolas Herrero
6aa54d6c62 Merge branch 'master' into content_blocks_for_headings 2018-12-11 16:40:25 +01:00
Javier Martín
3631ff7340 Merge pull request #3074 from consul/backport-refactor_legislation_process_subnav
Refactor legislation process subnav
2018-12-05 13:32:22 +01:00
Javi Martín
9ad8c5728a Refactor legislation process subnav 2018-11-30 18:09:52 +01:00
Javi Martín
b499c88373 Extract method in menu moderated content
This way we can make a long line considerably shorter.
2018-11-30 18:04:55 +01:00
Javi Martín
45a41a7528 Rename Admin::Proposals to Admin::HiddenProposals
The same way we do it with users and budget investments.
2018-11-30 18:04:55 +01:00
Milber Champutiz Burbano
9f455b9165 Added feature to add content block to headings in sidebar -- rebase 2018-11-27 09:37:35 -05:00
decabeza
5abeeb8588 Fixes date format on legislation helper 2018-11-14 12:41:22 +01:00
decabeza
13b3d9cebc Fixes admin menu link when create a new widget 2018-11-12 17:11:17 +01:00
decabeza
1d5335c782 Display last milestones image
Also adds a second order to ensure the order to display milestones with same publication date is always the same
2018-11-07 18:25:02 +01:00
decabeza
ba1a6b4cc8 Display first image available for milestones 2018-11-07 18:09:23 +01:00
María Checa
b6fdf732f2 Add total Investments in the execution list 2018-11-06 13:02:35 +01:00
Marko Lovic
8376efce3f Hide headings with no investments
The page should not show any headings which don't have any
winning investments. The "no content" message should only be
shown when there are no headings with investments to avoid an
otherwise blank page.

__Note:__ in the main @headings query, _both_ #includes and #joins
are needed to:
 1. eager load all necessary data (#includes)
and
 2. to perform an INNER JOIN on milestones to filter out investments
with no milestones (#joins).
2018-11-06 13:02:35 +01:00
Angel Perez
a3ef662509 Filtering investments are based on the latest milestone status 2018-11-06 13:02:35 +01:00
Angel Perez
749954267d Use Budget::Investment#winners scope to fetch only winner investments 2018-11-06 13:02:34 +01:00
Angel Perez
448ac7a158 Restore filtering investments by milestone status query
This commit makes 3 changes:

1. Extracts a query into a helper for clarity and DRYness

2. Adds a `.where` clause to filter investments based on their
(current) milestone status

3. Fixes a bug where investments would be rendered as many times as
milestones associated to an investment
2018-11-06 13:02:34 +01:00
Javi Martín
2a1b50beba Extract method to render form fields for a locale 2018-10-22 16:36:18 +02:00
Javi Martín
361a15640f Use detect instead of select.first 2018-10-22 16:36:18 +02:00
Javi Martín
93a7cb6c0f Simplify code checking whether to enable a locale 2018-10-22 16:36:18 +02:00
Javi Martín
1895e2dd2f Make it easier to know destroy_field is an input
By using the input and finding it by its name, it's easier to see the
difference between this input and the delete-language link.
2018-10-22 16:36:18 +02:00
Javi Martín
dbea577062 Follow naming conventions for HTML classes and IDs
We use underscores for IDs and hyphens for classes.
2018-10-22 16:36:18 +02:00
Javi Martín
0505028d77 Extract method in translatable builder
This way we fix the rubocop warning for line too long and make the code
a bit easier to read.
2018-10-22 16:36:17 +02:00
Javi Martín
34b5a88564 Fix updating translatables without current locale
The current locale wasn't being marked for destruction and so saving
the record tried to create a new translation for the current locale.
2018-10-22 16:36:17 +02:00
Javi Martín
6d6eb1f849 Fix ambiguous field in test 2018-10-22 16:36:17 +02:00
Javi Martín
1255aa5032 Make private methods private 2018-10-22 16:36:17 +02:00
Javi Martín
7479223d59 Wrap translation fields in a div
This way we can show/hide that div when displaying translations, and we
can remove the duplication applying the same logic to the label, the
input, the error and the CKEditor.

This way we also solve the problem of the textarea of the CKEditor
taking space when we switch locales, as well as CKEditor itself taking
space even when not displayed.
2018-10-22 16:36:17 +02:00
Javi Martín
ffb8207f84 Show error message for just the displayed locale
Unfortunately the builder didn't offer any options for the error message
and we just had to overwrite the `error_for` methods.
2018-10-22 16:36:17 +02:00
Javi Martín
00983200d4 Update information texts translatable fields
This part used the code we deleted in order to make it easier to
refactor the rest of the translatable models. Now we add the code back.
2018-10-22 16:36:12 +02:00
Angel Perez
8bba09aac3 Extract translation logic to helper method 2018-10-22 16:30:32 +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
Javi Martín
124b8496de Simplify methods defining translation styles
This refactor is going to be useful when we change these rules within
the next few commits.
2018-10-22 16:28:53 +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
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