Commit Graph

1554 Commits

Author SHA1 Message Date
María Checa
017c242085 Merge pull request #2462 from consul/admin-newsletter-emails
Admin newsletter emails
2018-02-20 16:17:37 +01:00
Bertocq
1434449b84 Fix line length issues at User model 2018-02-19 11:09:19 +01:00
Bertocq
9925e2b02f Extract inline query to User scope & refactor 2018-02-19 11:09:19 +01:00
Bertocq
4fb9f6829c Extract inline query to an OfficerAssignment scope 2018-02-19 11:09:19 +01:00
María Checa
24bca36639 Merge branch 'master' into admin-newsletter-emails 2018-02-14 16:07:13 +01:00
María Checa
f1fbe7ff29 Modified administrator abilities for newsletters 2018-02-14 16:05:31 +01:00
María Checa
07f2419f8f Added newsletter model and UserSegments class 2018-02-13 11:39:10 +01:00
Bertocq
57743df197 Enable rubocop Performance/HashEachMethods cop & fix issues 2018-02-10 21:22:47 +01:00
Bertocq
6d9926441e Reverse investment scoped filter for budget by slug and then id 2018-02-10 16:39:27 +01:00
Bertocq
2341a2f70b Add by_budget scope to Investment and use it 2018-02-10 16:36:14 +01:00
Bertocq
7e67e8c93b Remove unnecesary empty line at milestone model 2018-02-05 15:54:33 +01:00
BertoCQ
c16e42e1e3 Merge pull request #2434 from consul/slug_generation_logic
Only change budget slugs if its on draft phase
2018-02-05 15:35:58 +01:00
Bertocq
e0871e5dc6 Only update slug if empty or model condition is met 2018-02-04 23:04:48 +01:00
Bertocq
a297faec4b Add order scope to milestone for publication date 2018-02-03 19:15:31 +01:00
Bertocq
04de1e19f5 Make mappable 100 line length compliant 2018-02-02 21:51:49 +01:00
Bertocq
24b1e64113 Validate MapLocation lat/long/zoom have numeric values 2018-02-02 21:37:50 +01:00
BertoCQ
38b66e8c6c Merge pull request #2295 from wairbut-m2c/aperez-mappable-objects
Improvements for Mappable objects
2018-02-02 19:26:47 +01:00
Angel Perez
47c9b343ee Admins can search investments by title or ID (#2401) 2018-01-31 09:52:55 -04:00
Raimond Garcia
45d07fa16f Merge pull request #2407 from wairbut-m2c/aperez-investment-filters-aggregation
Investments can be applied several filters at once
2018-01-31 14:39:02 +01:00
BertoCQ
ec81f399bf Merge pull request #2403 from consul/valuation_comments
Valuation comments
2018-01-31 13:46:22 +01:00
Angel Perez
a5159672d4 Investments are now aggregated when using more than 1 advanced filter 2018-01-31 07:21:51 -04:00
BertoCQ
f0f41b0403 Merge pull request #2373 from consul/single_heading_group_names
Improve heading names at select boxes
2018-01-31 02:35:11 +01:00
Bertocq
4ec30a9082 Avoid using comments_count counter_cache at Investment
As Budget::Investment has two relationships over commentable polymorphic
relationship, the counter_cache is counting the sum of both comments and
valuations.

We don't show valuations count anywhere, only the (public) comments so
we just use comments.count in this case
2018-01-31 02:05:37 +01:00
Bertocq
26cf91c61a Create valuation comments creation ability
Why:

Only admins or valuators (for those investments they've assigned) can
create internal valuation comments on them.

How:

* Creating a new `comment_valuation` ability for admins and valuators in
the same manner the `valuate` ability works.

* Adding a validation at Comment model for those with `valuation` flag
active that checks if the author can make a valuation comment on the
commentable, as well as the respective active record error messages.
This will prevent comments from being created at a controller level as
well.

* Improving comment factory trait `valuation` to have an associated
investment, author that is a valuator and setting the valuator on the
valuators list of the investment
2018-01-31 02:03:03 +01:00
Bertocq
149c81371b Allow valuation internal comments to be created
How:

Using a local variable at partials to set a hidden true/false value for
`valuation` parameter on the comment creation form.

Allowing that new param at the comment controller and using it when
building a new Comment.
2018-01-31 02:03:02 +01:00
Bertocq
767fd04bdf Add valuation comments relation at Budget Investment
Why:

Budget Investments already has an existing `comments` relation that is
on use. We need to keep that relation unaltered after adding the
internal valuation comments, that means scoping the relation to only
public comments (non valuation ones) so existing code using it will
remain working as expected.

A new second relation will be needed to explicitly ask for valuation
comments only where needed, again scoping to valuation comments.

How:

Adding a second `valuations` relationship and filtering on both
with the new `valuation` flag from Comment model.
2018-01-30 19:22:27 +01:00
Bertocq
56fc5c9583 Filter internal valuation comments from public api
Why:

Internal valuation comments are only for admins and valuators,
not for the public view.

How:

Adding a `not_valuations` scope and use it at the `public_for_api` one
2018-01-30 19:22:27 +01:00
Raimond Garcia
626b9972d1 Merge pull request #2378 from wairbut-m2c/aperez-investments-search
Add search & sorting options to Admin::BudgetInvestments
2018-01-29 20:06:43 +01:00
Angel Perez
665a5b57ab Empty instances of MapLocation won't result in a new DB record (#2220) 2018-01-26 09:26:48 -04:00
Bertocq
070c94494e Fix linelenght over 100 on multiple files 2018-01-26 00:27:03 +01:00
Angel Perez
e04dc5b8f2 Add sorting options for Admin::BudgetInvestments (#2336) 2018-01-25 08:18:04 -04:00
Bertocq
6dcd01366c Preven admins from destroying others images&docs 2018-01-24 17:07:13 +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
Bertocq
9bb088a5c7 Add single_heading_group? helper at Budget::Group model 2018-01-24 12:15:43 +01:00
María Checa
1c2949b60d Merge pull request #2344 from wairbut-m2c/aperez-investments-filters
Improvements for Admin::Budget::Investment filters
2018-01-23 20:09:54 +01:00
Raúl Fuentes
82b750de68 moved duplicated code to helper 2018-01-23 15:42:01 +01:00
iagirre
846898f3ec New phase "Information" added and UI modified to not show the links.
Specs to test the functionality added.
2018-01-23 15:42:01 +01:00
Bertocq
d017b5bb49 Make Budget::Phase#invalid_dates_range? private 2018-01-23 00:23:22 +01:00
Bertocq
16b6abe2b8 Touch Budget object after updating a Budget::Pphase
Why:

We need to clear associated rails cache keys in order for changes to be
ready to be seen on the views

How:

* Just an after_save callback to a private method
2018-01-23 00:23:19 +01:00
Bertocq
e59ed81528 Return 404 accesing community without communitable
Why:

Somehow we're seeing communities without proposals at production. We
must find why and fix it, but first we need to throw a 404 at the user
instead of a 500 internal server error

How:

First catching the scenario of non-existent communitable at the
controller and raising a 404 error. Secondly preventing the author_id
access over a possibly nil object, this is a smell but it can't be
easily fixed right now... we need to correctly implement a relation
between Community and communitable and avoid the multiple occurences of
`community.from_proposal?` in the codebase that makes it impossible to
extend to a fourth communitable model.
2018-01-23 00:22:53 +01:00
Angel Perez
ff40d32028 Add new filters to Admin::Budget::Investment navbar 2018-01-22 14:02:29 -04:00
Angel Perez
e5c73d8f02 Add advanced filters for Admin::Budget::Investment 2018-01-22 14:02:29 -04:00
María Checa
1f461b09f0 Merge pull request #2353 from consul/2339-admin_budgets_phases
Allow admins to edit Budget phases
2018-01-22 18:07:34 +01:00
Raúl Fuentes
93268fc5d6 changed advanced filter from budgets to budgets/investments 2018-01-22 09:59:09 +01:00
Raúl Fuentes
bb39f8af0a issue #1436, mirrored behavior from proposals 2018-01-22 09:59:09 +01:00
María Checa
1abb7f0310 Added admin budget phases controller and routes 2018-01-19 17:55:24 +01:00
decabeza
f722caac24 removes budget steps on header 2018-01-19 14:35:05 +01:00
Bertocq
7599eb4c35 Refactor budget phases step progress functions and usage 2018-01-18 17:18:05 +01:00
Bertocq
2e883db283 Refactor budget phases current step & total steps 2018-01-18 16:53:36 +01:00
BertoCQ
01d7b86d42 Merge pull request #2331 from consul/current-budget-polish
Add current_budget to management controllers
2018-01-18 00:27:56 +01:00