Commit Graph

821 Commits

Author SHA1 Message Date
Juan Salvador Pérez García
4b8cc85c49 Fixes #234
View questions now is View results and redirects to results
in public view.

Fixed flaky spec that was making the tests fail.

Added missing specs for polls feature as well as poll model.
2018-07-19 17:15:05 +02:00
Juan Salvador Pérez García
7e43206ac0 Fixes #220
Description as well as short description will be optional for proposal
dashboard actions.

Additionally some minor bugfixes have been fixed.
2018-07-17 17:59:12 +02:00
Juan Salvador Pérez García
f439fc7371 Fixes #218
Added check in poll card that allows setting the value of
results_enabled flag.

Access to stats/results now is controlled with abilities.

Polls related to proposals will be accessible to the proposal author
like they were administrators.
2018-07-17 17:59:12 +02:00
Juan Salvador Pérez García
3c3f60dfcc Implements #173
Public view for suggested actions as well as resources has been
completelly redesigned.

Private side for this feature has been adapted as well in order to meet
the requirements.
2018-07-17 17:58:22 +02:00
Juan Salvador Pérez García
2be107f4da Specs
Added specs and fixed some issues found after executing them
2018-07-17 17:57:30 +02:00
Juan Salvador Pérez García
28e17abe72 Syntax for specs adjusted for consistency reasons
is_expected.to has been replaced by should
is_expected.not_to has been replaced by should_not
2018-07-17 17:53:18 +02:00
Juan Salvador Pérez García
47a055ea48 Use time.current instead of Time.now
Use time.current instead of Time.now in order to avoid flakies.
2018-07-17 17:53:18 +02:00
Juan Salvador Pérez García
8bb3d5b3ab frozen_string_literal removed
frozen_string_literal magic comment has been removed until a decission
is taken regarding to its convenience.
2018-07-17 17:53:18 +02:00
Juan Salvador Pérez García
f9a085a400 Implements graph for dashboard
Implements graph secion for dashboard.

Dashboard related actions have been agrupated inside a menu in the admin
section.

Minor bugfixes.
2018-07-17 17:53:18 +02:00
Juan Salvador Pérez García
33b3431c70 Implements #150
Adds an entry inside moderation section that allows moderators to check
pending tasks and mark them as solved.
2018-07-17 17:52:47 +02:00
Juan Salvador Pérez García
83f78b1940 Fixes #135
Adds a table with proposed actions in the dashboard. The user can mark
an action as executed.
2018-07-17 17:51:13 +02:00
Juan Salvador Pérez García
e4e0cb65de Implements #142
Dashboard actions can be proposed actions or resources
2018-07-17 17:50:05 +02:00
Juan Salvador Pérez García
1464bddfa8 Fixes #134
Adds an administration interface for the proposal dashboard actions.
2018-07-17 17:48:46 +02:00
Angel Perez
31c16406c0 Move disable recommendations permissions to Abilities::Common model 2018-07-15 21:28:58 -04:00
rgarcia
f670019325 Deal gracefully with recommendations of hidden proposals
We were seeing an exceptions in the home page when displaying
recommendations. This was due to trying to load tags of hidden proposals

With this commit we are skipping proposals that that have been hidden,
which will hopefully solve this exception
2018-07-10 17:47:28 +02:00
María Checa
fb5b993920 Add Budget::Investment::Statuses tests 2018-06-27 18:34:02 +02:00
María Checa
e8e9fcd0da Add Budget::Investment::Statuses tests 2018-06-27 16:45:58 +02:00
Alberto
6d2c094931 Merge pull request #2469 from wairbut-m2c/chore/i18n-cleaning
I18n maintenance
2018-06-07 17:42:05 +02:00
rgarcia
8986cf4727 Display only published processes in homepage 2018-05-30 13:32:20 +02:00
rgarcia
0e097973cc Add widget feeds to homepage
Note there is some funkiness going on with class loadings
Had to create a `feed` and `widget_feed` table even though in this
first version the Widget::Feed includes only uses ActiveModel instead
of ActiveRecord, otherwise some specs failed

We’ll figure it out and clean up 😌
2018-05-28 18:17:26 +02:00
rgarcia
664e77305c Add widget cards to homepage 2018-05-28 18:17:26 +02:00
Antonis Tzorvas
c21d806ecc Refs #2603 Show 'See Results' button in admin panel 2018-05-19 13:38:02 +03:00
Angel Perez
f9e8e2d86d I18n: cleanup for Admin English/Spanish strings
* Add missing exclamation marks
* Fix typos
* Remove duplicated keys
* Remove trailing whitespaces
* Replace single quotes with double quotes
* Replace untranslated strings
* Fix incorrect 'Spending proposal' assertion
2018-04-09 14:39:03 -04:00
Bertocq
43d78c6c72 Adding Investment#by_valuator_group test scenario
Budget::Investment#by_valuator_group scope didn't had a test scenario
2018-04-06 00:22:41 +02:00
Bertocq
48286f7de9 Validate ValuatorGroup#name presence & uniqueness
Why:

ValuatorGroup name should be unique and present to be able to identify
correctly each of them.

How:
  - Adding a presence & uniqueness validation at the model
  - Adding a sequenced value for name attribute at its factory
  - Adding missing model spec that covers validations
2018-04-05 22:12:06 +02:00
Raimond Garcia
65f5ab424b Merge pull request #2570 from consul/unfeasibility-explanation
Display unfeasibility explanation only when valuation has finished
2018-04-05 00:21:31 +02:00
Raimond Garcia
787657e07e Merge pull request #2510 from consul/valuator-groups
Add valuator groups
2018-04-05 00:21:04 +02:00
rgarcia
71bb5b3dcf Fix display of unfeasibility explanation
We were missing a check to make sure valuation had finished before
displaying the unfeasibility explanation
2018-04-04 14:38:31 +02:00
Bertocq
633cc1283b Fix Date & DateTime parsings to use default timezone
Date.new(...) does not take into account the current timezone, while other
parts of the application do. By default always parsing any date with the
default timezone and converting the resulting Time to Date would prevent
this kind of issues

DateTime.parse(...).in_time_zone gives an unexpected result, as the
DateTime.parse(...) will create a DateTime with +0000 time zone and the
`in_time_zone` will modify the DateTime to adjust to the default zone.

Maybe its better explained with an example, using 'Lima' as timezone:

DateTime.parse("2015-01-01")
> Thu, 01 Jan 2015 00:00:00 +0000

DateTime.parse("2015-01-01").in_time_zone
> Wed, 31 Dec 2014 19:00:00 -05 -05:00

And that's not the desired date but the previous day!
2018-04-04 14:21:39 +02:00
rgarcia
00c965b715 Clean up 2018-04-04 13:19:01 +02:00
rgarcia
7a01745188 Add valuation permissions to groups 2018-04-03 20:58:35 +02:00
rgarcia
1dbbe331c9 Assign valuators to groups 2018-04-03 20:55:44 +02:00
rgarcia
09c44ee583 Extend notifications to be marked as read and unread 2018-03-23 11:47:06 +01:00
rgarcia
073cf74818 Fix edge case
The user was able to vote as many investments as wanted in the first
heading voted. However in the second heading voted, only one investment
could be voted

This was due to the previous implementation, where you could only vote
in one heading. Note the `first` call in method
`heading_voted_by_user?(user)`

This commits simplifies the logic and allows voting for any investment
in any heading that the user has previously voted in
2018-03-22 23:08:41 +01:00
rgarcia
5c6eaa76ff Add headings_voted_by_user
This method was used only in Madrid’s fork, but it is now needed to
complete the backport for voting in multiple headings

There wasn’t a test in Madrid, so here goes one too. Even though, the
responsibility should probably be moved soon to the `Budget::Heading`.
For consistency with the related methods and tests it has been left in
the investment_spec
2018-03-22 22:24:58 +01:00
rgarcia
bdffb9765e Allow voting in multiple headings
Now that we have the option of voting in multiple headings per group,
the method of voting in a “different heading assigned” has become
deprecated and thus removed
2018-03-22 22:24:58 +01:00
Alberto García
eba4a3c6cb Merge pull request #2528 from consul/budgets-message
Heading link on budgets message
2018-03-09 13:25:39 +01:00
Alberto Calderón Queimadelos
a55218ad9f Merge pull request #2443 from consul/fix_currency_locale
Use user locale instead of default locale to format currencies
2018-03-08 18:03:52 +01:00
decabeza
0e9190bc43 Adds heading link on different heading message 2018-03-08 11:50:09 +01:00
Bertocq
f0dc2a02a5 Add Budget#formatted_amount unit test 2018-03-08 11:42:22 +01:00
Bertocq
1ef2789640 Trim valuator investment valuation ability scope
Valuators shouldn't be able to valuate an investment which valuation has
already been finished (only admins can)
2018-03-06 20:18:05 +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
Bertocq
c3a3e76304 Improve newsletter model spec list_of_recipients 2018-02-22 18:24:36 +01:00
Bertocq
e3eeca4f06 Improve newsletter model spec with valid_segment_recipient? 2018-02-22 18:24:18 +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
e8c797766a Added newsletter specs 2018-02-14 16:06:33 +01:00
Bertocq
198ff0cd1f Use updatable slug factory trait to sluggable concern
Slugs should only be updated on certain conditions, we need a trait that
meets that conditions and the name of the trait passed as a mandatory &
named argument on the sluggable concern
2018-02-04 23:04:48 +01:00
Bertocq
2eab6a476e Refactor sluggable concern spec 2018-02-04 22:36:23 +01:00
Bertocq
24b1e64113 Validate MapLocation lat/long/zoom have numeric values 2018-02-02 21:37:50 +01:00