Commit Graph

16282 Commits

Author SHA1 Message Date
Javi Martín
602daced6b Clarify the meaning of max "votable" headings
The word "vote" is confusing because this option does not apply to the
voting phase, but to the selecting projects phase.
2020-09-09 17:01:13 +02:00
Javi Martín
cd418e45be Allow hints on select fields
Just like we allow them on input fields.
2020-09-09 12:20:46 +02:00
Javi Martín
5332ae609e Filter investments only by assigned staff
In commit 74083df1 we added the possibility to assign administrators and
valuators to budgets, so they would only manage the budgets they're
assigned to.

However, when filtering projects, we were still showing all
administrators and valuators as options to filter investments. It makes
more sense to only show the valuators and administrators assigned to the
current budget.

Note this change only affects the view, and so malicious users could
technically send any other administrator or valuator ID. In this case,
they would get empty results since those administrators/valuators
wouldn't have any investments assigned, so taking this case into account
is not necessary.
2020-09-08 19:11:38 +02:00
Javi Martín
4a5d4b3c0b Group investment search form methods together
We had helper methods all over the place which were only used in one
view. Since we're going to change some of them to use the budget as a
parameter, they don't belong in those helpers anymore.

Note the method `budget_heading_select_options` is used in more places,
so we're keeping it where it was.
2020-09-08 18:35:16 +02:00
Javi Martín
e4c1a8cf45 Merge pull request #4065 from consul/legislation_summary
Add collaborative legislation summary
2020-09-08 13:49:45 +02:00
Javi Martín
b2b64ca8a0 Add link to download summary in XLSX format again
It was removed in commit 128a8164 alongside everything related to the
legislation process summary.

Co-Authored-By: taitus <sebastia.roig@gmail.com>
2020-09-08 13:32:08 +02:00
Javi Martín
14df74fed7 Add collaborative legislation summary again
It was removed in commit 128a8164 because we hadn't reviewed it nor
tested it properly. We're now adding it again, fixing the issues we've
found while reviewing.
2020-09-08 13:32:08 +02:00
Javi Martín
a8a79fe97f Extract mixin to add font awesome icons
This way we can simplify the HTML and easily apply font awesome icons to
any element.

Note the mixin uses `extend`, which we generally try to avoid. It's OK
in this case, since `fa-` classes only have one rule, affecting the
content of its `::before` pseudo-element. Unfortunately we can't use
`include fa-content($fa-var-#{$icon})` because it's not valid SCSS. We
could make the mixin accept an icon instead of an icon name, and call it
using `has-fa-icon(r, $fa-var-plus-square)`. However, IMHO that would
make the code a bit more complex with no real benefit.
2020-09-08 13:32:08 +02:00
Javi Martín
18e99ac069 Merge pull request #4116 from consul/remove-deprecated-columns
Remove deprecated columns
2020-09-08 12:51:45 +02:00
taitus
f90c09bea7 Remove deprecated attributes from Proposals
Some fields from Proposals are deprecated and we no longer need them.
2020-09-08 12:13:21 +02:00
taitus
086b0366a2 Remove deprecated attributes from Debates
Some fields from Debates are deprecated and we no longer need them.
2020-09-08 12:13:13 +02:00
taitus
5eed36ca8e Remove deprecated attribute from Comments
A field from Comment is deprecated and we no longer need it.
2020-09-08 12:13:01 +02:00
taitus
e39b72d945 Remove deprecated attributes from Investments
Some fields from Investment are deprecated and we no longer need them.
2020-09-08 12:12:43 +02:00
Javi Martín
1c8b5a05b5 Merge pull request #4115 from consul/consistency-schema
Update columns type of attachment file
2020-09-08 11:51:32 +02:00
taitus
819e2c82ce Add migration to change columns type of attachments
As suggested in the paperclip update discussed in the previous commit,
we force the type of these fields to be bigint.
2020-09-08 11:02:13 +02:00
taitus
574a5d0067 Update old migrations to maintain consistency
After merge "Bump paperclip from 5.2.1 to 6.1.0 #3905" as indicated in
the release_notes columns type for attachments are changed from integer
to bigint.
For this reason we edit old migrations so that they continue to
generate integer as before.
2020-09-08 11:00:19 +02:00
Javi Martín
c866a8667b Merge pull request #4117 from consul/legislation-process-default-attributes
Apply Legislation Process default colors to dev seeds
2020-09-08 10:30:05 +02:00
taitus
85ffc70f5f Apply Legislation Process default colors to dev seeds
Legislation Processes created through the admin form were getting the default color.
However, Legislation processes created by other means (like the `db:dev_seed` rake task) were not getting these default values.

This feature was originally implemented when we were using Rails 4.
With Rails 5, we can provide default values to all new Legislation processes
and simplify the code at the same time thanks to its `attribute` method.

Related commit:
https://github.com/consul/consul/pull/4080/commits/0b83be6
2020-09-08 10:07:43 +02:00
Javier Martín
a4e39e66ed Merge pull request #4051 from rockandror/upgrade_jquery
Upgrade to jQuery 3.5.1
2020-09-07 00:22:19 +02:00
Senén Rodero Rodríguez
d7efd748fa Apply jQuery 3.0 upgrade_guide recommendation
Use recommented way to define document-ready handlers. See [1]

[1] https://jquery.com/upgrade-guide/3.0/#deprecated-document-ready-handlers-other-than-jquery-function
2020-08-28 16:10:31 +02:00
Senén Rodero Rodríguez
b499c0dcdd Solve bindmethod deprecation warning
As mentioned at the jQuery 3.0 upgrade guide [1] the `bind` method is deprecated. Replace with `on` method.

[1] https://jquery.com/upgrade-guide/3.0/#deprecated-bind-and-delegate
2020-08-28 16:10:31 +02:00
Javi Martín
b8e352145c Use prop() instead of removeAttr()
According to the jQuery upgrade guide:

> It is almost always a mistake to use .removeAttr("checked") on a DOM
> element. The only time it might be useful is if the DOM is later going
> to be serialized back to an HTML string. In all other cases,
> .prop("checked", false) should be used instead.
2020-08-28 16:10:31 +02:00
Javi Martín
996062fa19 Reset language select after adding a language
It worked differently after upgrading to jQuery 3. According to the
jQuery upgrade guide:

> It is almost always a mistake to use .removeAttr("checked") on a DOM
> element. The only time it might be useful is if the DOM is later going
> to be serialized back to an HTML string. In all other cases,
> .prop("checked", false) should be used instead.
2020-08-28 16:09:41 +02:00
Senén Rodero Rodríguez
f4916a981a Fix focus deprecation warning 2020-08-28 16:09:41 +02:00
Senén Rodero Rodríguez
e138bbb04e Upgrade to jQuery 3.5.1
Latest version of jquery-rails gem includes latest jQuery 3 version with
all security patches. See [1].

[1] https://github.com/rails/jquery-rails/blob/v4.4.0/CHANGELOG.md#440
2020-08-28 16:09:41 +02:00
Javier Martín
3853557343 Merge pull request #4112 from consul/extra_admin_datepicker
Simplify banner form dates
2020-08-28 15:24:47 +02:00
Javi Martín
2d659b4113 Simplify date fields in admin banners form
I forgot to merge this change into commit fc9a87a8, so here it goes.
2020-08-28 14:46:16 +02:00
Javier Martín
8e38838040 Merge pull request #4111 from consul/remove_admin_datepicker
Use native HTML5 date fields in the admin section
2020-08-28 14:34:53 +02:00
Senén Rodero Rodríguez
871b58a4a0 Move datepicker initialization code to datepicker.js file
Now we have a file named 'datepicker.js' it should be easier to
have all code related to datepicker plugin within the same file.
2020-08-28 14:22:14 +02:00
Javi Martín
fc9a87a8ab Use native HTML5 date fields in the admin section
We've had to add a couple of hacks in order to make jQuery UI datepicker
work with Turbolinks, and one of our tests is failing because the
datepicker changes its height when changing from a month with 5 weeks to
a month with 6 weeks.

We could add a workaround so the test still passes (jQuery UI doesn't
provide a configuration option to always displays 6 weeks in the
datepicker), but I think it's easier to just use the HTML5 native date
input field, which also allows us to simplify the code a bit and IMHO it
improves the user experience, particularly when using mobile phones.

Since date fields are not supported in Safari and Internet Explorer,
we're still using the jQuery UI datepicker on those browsers (and on any
other browser not supporting date fields).

Due to these changes, we're moving the tests checking datepicker's
behaviour to the dashboard. I've choosing not to change the public pages
because I'm not 100% sure everybody would like this change (some people
prefer the datepicker because we can configure the way it looks).
2020-08-28 12:55:58 +02:00
Javier Martín
7ee2f15a2e Merge pull request #3624 from consul/add_errbit_support
Add support for Errbit self-hosted exception management
2020-08-27 16:53:27 +02:00
Javier Martín
69e17a3cf4 Merge pull request #4069 from consul/dependabot/bundler/rollbar-2.27.0
Bump rollbar from 2.18.0 to 2.27.0
2020-08-27 16:52:02 +02:00
Javi Martín
6db5e1ed55 Only enable rollbar if it's configured
Many users who didn't configure rollbar were getting exceptions when
trying to connect to the rollbar service.
2020-08-27 16:22:01 +02:00
Julian Herrero
83fb7a769c Ignore RecordNotFound exceptions in Errbit 2020-08-27 16:22:01 +02:00
Javi Martín
4ac36b91e2 Accept self-signed SSL certificates with airbrake
Since some people hosting errbit might be using it as an internal tool
with a self signed certificate, we need to patch Airbrake so it accepts
these certificates.
2020-08-27 16:22:01 +02:00
Javi Martín
f658126780 Support exception management with Airbrake+Errbit
With Errbit, you can set up your own server and host the information
regarding your exceptions there. You can also hire Airbrake's hosting
services or easily setup Errbit on Heroku.

We're still including the rollbar gem so we don't harm CONSUL users who
are using rollbar.

Note Errbit requires an old version of Airbrake which forced users to
configure the gem. So we're adding the current environtment to
`ignore_environments` when the project id isn't defined; this way the
application won't crash in this case.
2020-08-27 16:22:01 +02:00
Javier Martín
6714c1bd6d Merge pull request #4107 from consul/dependabot/bundler/omniauth-facebook-7.0.0
Bump omniauth-facebook from 4.0.0 to 7.0.0
2020-08-27 15:43:44 +02:00
dependabot-preview[bot]
c1693e24c4 Bump omniauth-facebook from 4.0.0 to 7.0.0
Bumps [omniauth-facebook](https://github.com/mkdynamic/omniauth-facebook) from 4.0.0 to 7.0.0.
- [Release notes](https://github.com/mkdynamic/omniauth-facebook/releases)
- [Changelog](https://github.com/simi/omniauth-facebook/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mkdynamic/omniauth-facebook/compare/v4.0.0...v7.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-27 09:08:08 +00:00
Javier Martín
0838ed3c60 Merge pull request #4084 from consul/dependabot/bundler/omniauth-google-oauth2-0.8.0
Bump omniauth-google-oauth2 from 0.4.1 to 0.8.0
2020-08-27 11:06:17 +02:00
Javier Martín
946f232c70 Merge pull request #4087 from consul/fix_hint
Fix invalid "hint" attribute in forms
2020-08-26 16:24:16 +02:00
dependabot-preview[bot]
3df4df3a61 Bump omniauth-google-oauth2 from 0.4.1 to 0.8.0
Bumps [omniauth-google-oauth2](https://github.com/zquestz/omniauth-google-oauth2) from 0.4.1 to 0.8.0.
- [Release notes](https://github.com/zquestz/omniauth-google-oauth2/releases)
- [Changelog](https://github.com/zquestz/omniauth-google-oauth2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zquestz/omniauth-google-oauth2/compare/v0.4.1...v0.8.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-26 09:01:07 +00:00
Javier Martín
8007a24241 Merge pull request #4103 from consul/dependabot/bundler/mdl-0.11.0
Bump mdl from 0.10.0 to 0.11.0
2020-08-25 15:31:18 +02:00
dependabot-preview[bot]
536fc64a06 Bump mdl from 0.10.0 to 0.11.0
Bumps [mdl](https://github.com/mivok/markdownlint) from 0.10.0 to 0.11.0.
- [Release notes](https://github.com/mivok/markdownlint/releases)
- [Changelog](https://github.com/markdownlint/markdownlint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mivok/markdownlint/compare/v0.10.0...v0.11.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-25 13:13:42 +00:00
Javier Martín
59b7b524d4 Merge pull request #4097 from consul/downgrade_sassc
Downgrade sassc from 2.4.0 to 2.2.1
2020-08-25 12:53:18 +02:00
Javier Martín
2e71ba139a Merge pull request #4090 from consul/dependabot/bundler/initialjs-rails-0.2.0.9
Bump initialjs-rails from 0.2.0.8 to 0.2.0.9
2020-08-25 11:46:38 +02:00
Javi Martín
e6db50e9b9 Downgrade sassc from 2.4.0 to 2.2.1
Using sassc 2.4.0, we were getting several warnings when compiling
Foundation's assets:

DEPRECATION WARNING (...) !global assignments won't be able to declare
new variables in future versions.

According to issue 12080 in Foundation's repository, it won't be fixed
before Foundation 7.

Using sassc 2.3.0 my machine froze when trying to compile the assets in
our current master branch, so I'm downgrading to version 2.2.1.
2020-08-24 20:24:18 +02:00
Javier Martín
8531d78bb2 Merge pull request #4096 from rockandror/sticky_fixes
Fix sticky element on medium/large screens
2020-08-24 20:05:21 +02:00
Senén Rodero Rodríguez
46af09e348 Destroy Sticky elements before leaving the page
When Foundation initializes a page that has any sticky element, it
loads a window scroll listener into window object to handle the sticky
element positioning when scrolling. This works great until user moves
to a page without sticky elements and the window listeners remain
attached to the window object on this new page too when there is no
need to run the scrollListener and there is no sticky elements so the
window scroll listener cannot find the sticky object on that page a lot
of errors are thrown when user scrolls.

With this approach we are destroying sticky elements before leaving
the page which also remove the Sticky scrollListener from the window
object.

I do not know how to write a test to demonstrate this fix, but at least
there is some steps to reproduce this behavior:

0. Undo this commit
1. Go to any proposal page
2. Click on any link (with Turbolinks enabled)
3. Scroll the page
4. Check the console log. Yo will find as error occurrences as pixels you scrolled.
2020-08-24 19:41:14 +02:00
Senén Rodero Rodríguez
b2196561e2 Override proposal sticky top property when anchored
It's known that Foundation Sticky causes some renderization problems
when rendering sticky elements in anchored position.

The problem seems to be that Foundation Sticky is showing the
support box on medium and up devices overlapped with "Share" and
"Community" sidebar boxes when loading proposal page through
Turbolinks and when restoring the page from brwoser history.
Foundation seems to be doing some top property dynamic calculation
(javascript) and is setting top property to `206px` when it should be
`0px`. Notice that this do not happen on page first load (without
Turbolinks). Check foundation/foundation-sites issue 11098.

Another workaround could be to remove sticky feature for bigger that
small devices (medium large xlarge xxlarge).
Check foundation/foundation-sites issue 9892.
2020-08-24 19:41:14 +02:00
Javier Martín
9735dad792 Merge pull request #4100 from consul/dependabot/bundler/database_cleaner-1.8.5
Bump database_cleaner from 1.7.0 to 1.8.5
2020-08-24 16:14:34 +02:00