Commit Graph

731 Commits

Author SHA1 Message Date
rgarcia
7e839e7815 Filter by valuator group 2018-04-03 20:56:31 +02:00
decabeza
573a272ff9 Changes redirect path on create valuator group 2018-04-03 20:56:31 +02:00
decabeza
d7c822c61a Adds missing i18n to valuator groups notices 2018-04-03 20:56:31 +02:00
decabeza
3163293626 Improves valuator groups index count 2018-04-03 20:56:31 +02:00
decabeza
13d0b08cb4 Adds styles and missing i18n for valuator groups 👨🏻‍🎨 2018-04-03 20:56:31 +02:00
rgarcia
ab498d6d93 Assign groups to investments 2018-04-03 20:55:44 +02:00
rgarcia
1dbbe331c9 Assign valuators to groups 2018-04-03 20:55:44 +02:00
rgarcia
cddfdf4b84 Add valuator groups 2018-04-03 20:55:44 +02:00
rgarcia
730072e91e Add max votable headings to groups 2018-03-22 22:24:58 +01:00
Raimond Garcia
c1d7378c92 Merge pull request #2504 from consul/budget_group_name_edit
Allow Budget Group names to be edited
2018-03-22 22:12:04 +01:00
rgarcia
7a980d79e7 Removes use of slugs to edit group name
Changing a group’s `to_param` to return the slug instead of the id,
breaks many tests in the user facing interface

We should use slugs in upstream soon, but it should be done in a
separate PR, bringing the whole slug implementation from Madrid’s fork
and the corresponding test coverage
2018-03-22 20:06:53 +01:00
rgarcia
86e4a5d853 Find group inside budget
We were having a problem were some groups where not updating correctly.

That was because it was finding the first group with that name. However
we were looking for another group with the same name from another budget

Apart from the group_id, we also get the budget_id in the params for
updating a group. By finding groups within that budget we get the
expected behaviour
2018-03-22 10:19:43 +01:00
Bertocq
316c0aab3e Remove unnecesary slug generation trigger 2018-03-02 09:17:34 +01:00
Raúl Fuentes
6d8d44a5e3 Added interface and methods for edit the name of a Budget::Group if the budget is still inthe drafting phase 2018-03-02 09:16:57 +01:00
Bertocq
6b41b6487b Add UserSegments#user_segment_emails helper method
Why:

Both Newsletters and Email Downloads need the same logic: To extract the
emails from all the users in the segment that have newsletter flag
active, removing all empty email values.

How:

1- UserSegments#user_segment_emails holds that repeated logic and is used
on both Newsletter & EmailDownload.

2- Rename Newsletter#list_of_recipients to list_of_recipient_emails as
it is more descriptive. There is no need to pass entire Users around,
only the emails are needed at Mailer#newsletter method.

3- Cleanup Newsletter#list_of_recipient_emails model spec scenario
2018-03-01 20:59:20 +01:00
Bertocq
99851e9588 Remove empty emails from users segments recipients
Why:

User with an empty email value (nil) should not appear in the recipient
list for a given UserSegment at Newsletters or Email Downloads.

How:

Using Enumerable#compact and Enumerable#select to filter out empty emails

Increasing Email Download feature spec and Newsletter model spec to cover
all possible scenarios including the nil email one.
2018-03-01 20:09:32 +01:00
María Checa
8d2a103744 Changed how newsletters controller and mailer handle recipients
Now newsletters controller calls the Mailer method to send a newsletter once per user.
2018-02-28 17:02:31 +01:00
Bertocq
f34d6c1c1d Prevent invalid newsletters from being sent
Why:

Newsletters without a valid user segment can't be sent since there is no
recipient user email list.

How:

* Hiding the send button at the form
* Preventing an invalid newsletter from being delivered at the controller
2018-02-21 11:47:16 +01:00
Bertocq
4becd0eb35 Change Newsletter's segment_recipient to string
Why:

Newsletter attribute `segment_recipient` is an integer to be used as
enum. There's no advantage to store a number instead of an string if the
ammount of elements in the table is not going to be huge, or we can take
advantage of using an enum.

Also maintaining both Newsletters enum paired with UserSegments::SEGMENTS
would be a maintenance burden.

How:

* Migration to change segment_recipient column from integer to string
* Removing enumeration from Newsletter model class
* Using UserSegments::SEGMENTS instead of Newsletter.segment_recipients
or integer values
2018-02-21 11:46:11 +01:00
Bertocq
bdbb32e824 Move newsletter User scope outside UserSegments
Why:

UserSegments are not only used for Newsletters or Email downloads, but
also for internal Global Notifications. We don't want to have that scope
hardcoded inside UserSegments as users that have opted-out from the
newsletter should still be recipients of global notifications.

How:

Removing the scope from the UserSegments `all_users` method that acts as
base for all the other segments. Including that `newsletter` scope only
on the places that is relevant:
* When listing recipients for a newsletter
* When downloading a listing emails that can be newsletter recipients

Also updated relevant tests
2018-02-21 11:45:38 +01:00
María Checa
cb15a2e25b Added EmailsDownload controller and routes
Removed original method to return emails file from Newsletters controller and NewsletterZip class, included `rubyzip` gem that's no longer necessary.
2018-02-20 22:33:01 +01:00
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
9925e2b02f Extract inline query to User scope & refactor 2018-02-19 11:09:19 +01:00
Bertocq
62d75af892 Fix line lenght offenses at multiple controllers 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
Bertocq
118deb9fc4 Fix line lenght offenses at multiple controllers 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
49adcfde02 Added newsletter controller and routes 2018-02-13 11:39:12 +01:00
Bertocq
2341a2f70b Add by_budget scope to Investment and use it 2018-02-10 16:36:14 +01:00
Bertocq
c0dcd03bab Prevent valuation comments from appearing in public pages 2018-01-31 18:14:11 +01:00
Bertocq
b926740a32 Show valuation comments at admin investment show page 2018-01-31 16:35:45 +01:00
Angel Perez
47c9b343ee Admins can search investments by title or ID (#2401) 2018-01-31 09:52:55 -04:00
Angel Perez
a5159672d4 Investments are now aggregated when using more than 1 advanced filter 2018-01-31 07:21:51 -04:00
Bertocq
093b191f16 Small rubocop autocorrections 2018-01-30 03:07:52 +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
Alberto García
1207b5ce51 Merge pull request #2279 from wairbut-m2c/aperez-missing-i18n-keys
I18n maintenance
2018-01-29 14:02:15 +01:00
Angel Perez
e04dc5b8f2 Add sorting options for Admin::BudgetInvestments (#2336) 2018-01-25 08:18:04 -04:00
Angel Perez
680ca46ef1 Add search form for Admin::BudgetInvestments (#2336) 2018-01-25 08:16:32 -04:00
Angel Perez
1027896617 Reenable 'winners' tab under Admin::Budget::Investment 2018-01-22 14:04:57 -04:00
Angel Perez
ff40d32028 Add new filters to Admin::Budget::Investment navbar 2018-01-22 14:02:29 -04:00
Angel Perez
e92a67a206 Simplify filters navbar on Admin::Budget::Investment 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
Angel Perez
8499549eeb Add missing I18n key for Admin::Poll::Questions::Answers::Images 2018-01-19 15:34:44 -04:00
Angel Perez
10fac6d2d1 Admins can delete an answer's associated images (#1999) 2018-01-19 15:29:18 -04:00
María Checa
1abb7f0310 Added admin budget phases controller and routes 2018-01-19 17:55:24 +01:00
BertoCQ
d44db9cec4 Merge branch 'master' into feature/budget_phases 2018-01-16 17:47:47 +01:00
Bertocq
66691b644a Refactor Budget::PHASES constant to Budget::Phase::PHASE_KINDS 2018-01-16 12:18:13 +01:00
rgarcia
349780922d Add Budget.open scope
Before Budget.current could return multiple budgets, now there can only
be a single current_budget.

Adding the concept of open, which better reflects what the admin sees
in this page: A tab for open budgets and a tab for finished budgets
2018-01-15 22:01:59 +01:00
Raimond Garcia
b0bd7792be Merge pull request #1917 from wairbut-m2c/iagirre-admin-budget-heading-action
Actions for budgets' headings added. Edit headings, delete headings i…
2018-01-11 13:47:27 +01:00
Bertocq
3026115382 Remove redundant curly braces around a hash parameter 2018-01-10 22:44:11 +01:00