Commit Graph

37 Commits

Author SHA1 Message Date
Javi Martín
d18c627392 Add and apply Layout/EmptyLinesAfterModuleInclusion rule
This rule was added in rubocop 1.79. We were inconsistent about it, so
we're adding it to get more consistency.
2025-11-05 14:27:12 +01:00
Javi Martín
8b13daad95 Add and apply rules for multi-line hashes
For the HashAlignment rule, we're using the default `key` style (keys
are aligned and values aren't) instead of the `table` style (both keys
and values are aligned) because, even if we used both in the
application, we used the `key` style a lot more. Furthermore, the
`table` style looks strange in places where there are both very long and
very short keys and sometimes we weren't even consistent with the
`table` style, aligning some keys without aligning other keys.

Ideally we could align hashes to "either key or table", so developers
can decide whether keeping the symmetry of the code is worth it in a
case-per-case basis, but Rubocop doesn't allow this option.
2023-08-18 14:56:16 +02:00
Matheus Miranda
de13e789dd Add polygon geographies to Budgets' map
Note that in the budgets wizard test we now create district with no
associated geozone, so the text "all city" will appear in the districts
table too, meaning we can't use `within "section", text: "All city" do`
anymore since it would result in an ambiguous match.

Co-Authored-By: Julian Herrero <microweb10@gmail.com>
Co-Authored-By: Javi Martín <javim@elretirao.net>
2023-05-31 16:56:15 +02:00
decabeza
88ad711330 Hide group name only on budgets with one group
In the form of creating a new investment was hiding the name of the
group if it had only one heading, but could be confusing to users if
there are, for example, five different groups of one heading.

The solution:

- If the budget has one group and one heading, the heading selector is
  hidden.
- If the budget has one group and more than one heading, the group name
  is hidden.
- If the budget has more than one group, the group name appears
  regardless of the number of headings.
2021-06-11 14:43:18 +02:00
Ziyan Junaideen
1e3e8c1304 Add approval voting to budgets
Co-Authored-By: Javi Martín <javim@elretirao.net>
2020-08-06 12:38:18 +02:00
Javi Martín
8b5cca746c Apply rubocop rules to freeze constants
Added by popular demand among our team members.
2019-10-26 13:21:36 +02:00
Javi Martín
47b2c42a1d Apply IndentationConsistency rubocop rule 2019-09-10 20:02:15 +02:00
Javi Martín
59478ef461 Remove duplicate Translation classes
We accidentally added them twice when rebasing the translations branch.
2019-08-08 18:49:13 +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
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
Javi Martín
dadbf873ba Order translations using ruby
Joining the translations table caused duplicate records to appear.
Ordering with SQL is simply too hard because we need to consider
fallback locales.

Thanks Senén for providing most of the tests in the poll spec.
2019-06-03 18:35:59 +02:00
Juanjo Bazán
7ab602175a makes models inherit from ApplicationRecord 2019-04-17 17:40:56 +02:00
taitus
fbfe5b3468 Fix specs heading_specs.rb:313 2019-04-17 17:40:55 +02:00
Julian Herrero
aa0b48badd Remove Budget::Heading overrided translation class
Since Globalize gem update to v5.2.0 we cannot override translations
anymore in the same way that before the update. Milestone::Translation
class removed in this commit were no longer loaded correctly when
translation class is retrieved by translation_class method provided by
Globalize. Here is the diff between both gem versions:

https://github.com/globalize/globalize/compare/v5.0.0...v5.2.0diff-a1370b109e0dd567545b072bc6447b8fR51

This problem is not happening on test environment but is throwing an
exception in other environments as it has not loaded the delegation
definition inside our custom translation class.

To fix this we added a new class method inside globalizable model
concern to allow to define method delegation on translations classes from
parent globalizable classes when needed without having to override
Translation classes.

Another way to properly load our custom Milestone::Translation class is
to place it inside parent model class.
2019-04-16 17:28:07 +02:00
Julian Herrero
a963a99c55 Use correct scope to sort headings by name 2019-02-13 13:35:09 +01:00
Julian Herrero
29a704bd60 Show headings in budgets landing page when translations are missing 2019-02-13 13:35:09 +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
25e1afea48 fix map rendering for budget headings 2018-12-14 15:37:22 +01:00
Julian Nicolas Herrero
6aa54d6c62 Merge branch 'master' into content_blocks_for_headings 2018-12-11 16:40:25 +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
Matheus Miranda
06f07b1139 Add map to sidebar on Heading's page
Signed-off-by: Matheus Miranda <matheusmirandalacerda@gmail.com>
2018-11-16 09:05:23 +01:00
Bertocq
e0871e5dc6 Only update slug if empty or model condition is met 2018-02-04 23:04:48 +01:00
Bertocq
ce3bf20152 Add group name on heading options if more than one heading per group 2018-01-24 12:15:56 +01:00
iagirre
0e11e21b2a Merged with master and solved conflicts 2018-01-10 13:23:39 +01:00
iagirre
bfcbb6c0ad Validation in model and in form added. When users makes the on focus on population field an explanation appears. Some specs added to test the model validations 2017-10-31 13:04:30 +01:00
iagirre
f7e96067b0 Actions for budgets' headings added. Edit headings, delete headings if not budget investments associated and add link in order to see budgets investments filtered by the heading.
Cambios para hacer commit:
	modificado:    app/controllers/admin/budget_headings_controller.rb
	modificado:    app/models/budget/heading.rb
	nuevo archivo: app/views/admin/budget_headings/_errors.html.erb
	nuevo archivo: app/views/admin/budget_headings/edit.js.erb
	nuevo archivo: app/views/admin/budget_headings/update.js.erb
	modificado:    app/views/admin/budgets/_group.html.erb
	nuevo archivo: app/views/admin/budgets/_heading.html.erb
	nuevo archivo: app/views/admin/budgets/_heading_form.html.erb
	modificado:    config/locales/en/activerecord.yml
	modificado:    config/locales/es/activerecord.yml
	modificado:    spec/features/admin/budgets_spec.rb
	modificado:    spec/models/budget/heading_spec.rb
2017-09-25 15:40:17 +02:00
Bertocq
e3d89261a6 Add Sluggable concern and unique validation to Budget, Group and Heading
* What: We need to generate slug on Budget, Group and Heading classes, validating its unique for its scope

* How: Adding a presence and unique validation using Budget always as scope.
2017-07-05 12:33:16 +02:00
rgarcia
c3380d18fa fixes conflicts with budgets 2017-01-05 13:14:09 +01:00
kikito
08586d521b Refactors heading.budget . adds heading.budget_id 2017-01-04 13:54:07 +01:00
kikito
52d182f099 Removes geozone from budget heading 2017-01-03 18:51:21 +01:00
kikito
5ac2d9ccc9 started working on tags for budget investments. Error in investments/show because paths are hard 2017-01-03 17:13:28 +01:00
kikito
748fd8becf Makes all tests pass in bi management 2016-12-07 19:16:37 +01:00
rgarcia
f21fda0898 fixes pending specs 2016-07-27 16:39:25 +02:00
Juanjo Bazán
b5a6828e41 adds Budget::Group model to group headings
many refactors through budget related models
2016-06-09 18:00:06 +02:00
Juanjo Bazán
da769d8746 investment can not have many headings 2016-05-23 13:57:36 +02:00
kikito
ccffcf60b3 Replaces geozones by headings in the models 2016-05-20 14:06:50 +02:00