Commit Graph

13615 Commits

Author SHA1 Message Date
Javi Martín
c43b0fea64 Use Rails 5 conventions in Dashboard
These models and migrations were added on a branch based on Rails 4.
2019-04-29 13:08:43 -05:00
Javi Martín
8094417828 Remove best_in_place
It was only used in one place, so it's best to remove it and use the
patterns we use everywhere else.
2019-04-29 12:37:28 -05:00
Javi Martín
f284d5c09e Remove record_tag_helper
It was only used in one place, and could easily be replaced.

Note we usually use HTML classes like `map-location` instead of
`map_location`, but I've kept the underscore for compatibility with the
previous version.
2019-04-29 12:36:09 -05:00
Alberto
b35a729750 Merge pull request #3412 from consul/proposal-dashboard
Add proposal's dashboard
2019-04-29 17:45:57 +02:00
decabeza
9f973bf789 Add message on dashboard request to archived proposals 2019-04-29 15:46:44 +02:00
decabeza
47985df4f3 Fix request_to_administrators checkbox on admin dashboard actions 2019-04-29 15:46:38 +02:00
decabeza
197cbcd9bd Fix styles of dashboard poster 2019-04-29 15:46:35 +02:00
decabeza
de72b65151 Use proposal_poll_path on communities poll links 2019-04-29 15:46:32 +02:00
decabeza
55fb14c6e3 Always show dashboard buttons 2019-04-29 15:46:27 +02:00
decabeza
4b7d7f27a4 Fix typo 2019-04-29 15:45:44 +02:00
decabeza
e88c66c92c Dont use faker gem on simulate successful proposal rake 2019-04-29 15:45:35 +02:00
decabeza
3add160b4b Change i18n to resources on next goal
This resources always are locked when are shown on next goal section.
2019-04-29 15:45:04 +02:00
decabeza
ad41f23a98 Improve rake to add published_at to proposals 2019-04-29 15:44:47 +02:00
voodoorai2000
992f1d23a1 Change syntax to delay dashboard emails
After updating to Rails5 It seems the after_action[1] in the dashboard's mailer is not beind called.

Using this syntax the emails are still being delayed and the after_action being called correctly.

[1] https://github.com/AyuntamientoMadrid/consul/pull/1945/files#diff-fdf5590f3241c439fcc9d2225c3cf4d8R3
2019-04-29 15:44:45 +02:00
decabeza
20f505ab7c Fix specs 2019-04-29 15:44:41 +02:00
voodoorai2000
dfbdc0568c Allow actions to be unexecuted
Before actions could be marked as executed. With this commit we are also allowing actions to be marked as unexecuted.
2019-04-29 15:43:53 +02:00
voodoorai2000
e139057001 Disable dashboard email deliveries
We have to doble check all emails deliveries from the dashboard.

Using a setting to skip all dashboard email deliveries for now.

Note that a rake task to activated the `Setting["dashboard.emails"]` will need to be addded when we want to activate deliveries of these emails.
2019-04-29 15:43:46 +02:00
voodoorai2000
6f3b213612 Refactor proposal poll routes
Moving routes from custom file to the proposal's routes file.
2019-04-29 15:43:25 +02:00
voodoorai2000
34834889d8 Fix Answer's class conflict
We have two models called `Answer`: The `Answer` model and the `Poll::Answer` model.

This conflict ocurrs when trying to create a user generated poll for a proposal. from the Dashboard. In that case we are getting an exception, only in the development environment, as the class `Answer` is loaded before the class `Poll::Answer` which is the one we want to use.

With this commit we are explicitly requiring the correct model, solving the class conflict.
2019-04-29 15:43:06 +02:00
voodoorai2000
93972eeb33 Use custom url for proposal poll results 2019-04-29 15:42:27 +02:00
voodoorai2000
93ff173a0d Use a custom url for proposal polls
Before we used the standard poll url (vota/:id) for a user generated poll.

However this url is considered too important for this kind of polls, so we are changing it to a namespaced url (proposals/:proposal_id/polls/:id)
2019-04-29 15:42:04 +02:00
decabeza
99023a01c9 Fix merge conflicts 2019-04-29 14:22:22 +02:00
decabeza
51ced318e0 Merge branch 'master' into proposal-dashboard 2019-04-29 13:48:23 +02:00
Javier Martín
e13c4d8d10 Merge pull request #3460 from consul/backport-fix_remove_ballot_spec
Fix flaky spec: Ballots Groups Change my heading
2019-04-25 22:22:30 +02:00
Javier Martín
e0484e45ec Merge pull request #3459 from consul/backport-fix_cross_origin_exception
Fix InvalidCrossOriginRequest response
2019-04-25 22:01:51 +02:00
Javier Martín
95ce139e0a Merge pull request #3458 from consul/backport-fix_access_denied_exception
Handle AccessDenied in management sessions
2019-04-25 21:53:15 +02:00
Javi Martín
ca40e657fb Check page after an AJAX call removing a ballot
We were sending a new request without checking the previous one had
finished, and if it hadn't finished, the test failed.

This test started to fail after upgrading to Rails 5, since we removed
the change done in commit eda47eff which set `config.allow_concurrency`
to `false` in the test environment.

While we could re-introduce that configuration option, which might have
side effects, an easier solution is to check an AJAX request has been
completed before sending a new request depending on the previous one
seems to be a more solid option.

Note this test failed with two possible errors: "undefined method
`heading' for nil:NilClass" and "stale element reference: element is not
attached to the page document". This change fixes the second error; it
might fix the first error as well, but since I couldn't reproduce it
locally, we'll only be sure when this test stops failing in travis
builds.
2019-04-25 20:57:19 +02:00
Javi Martín
d90efa15e4 Fix InvalidCrossOriginRequest response
When requesting files like `/hackattempt.js`, the pages controller was
responding with 404 status code.

However, since the request was considered a JavaScript request (because
of the `.js` extension), the response was also considered to be a
JavaScript one, and since the request wasn't an AJAX request, our
protection from forgery was preventing a potential security issue by
raising an InvalidCrossOriginRequest exception.

By setting HTML as content type, we correctly respond with a 404 status
code.

More info:

https://die-antwort.eu/techblog/2018-08-avoid-invalid-cross-origin-request-with-catch-all-route/
2019-04-25 20:48:38 +02:00
Javi Martín
286e0ca878 Handle AccessDenied in management sessions
We were raising a `CanCan::AcessDenied` and were getting a 500 Internal
Server Error.

I've chosen to do the same thing we do in the ApplicationController.
There are other options to handle this request, like redirecting to the
login page or returning a 401 Unauthorized HTTP status.
2019-04-25 20:36:50 +02:00
Javier Martín
b33401ca0f Merge pull request #3452 from consul/backport-fix_interpolation_share_message
Update share messages interpolation variables
2019-04-25 20:13:18 +02:00
Javier Martín
488dd66806 Merge pull request #3454 from consul/fix_rails5_forgery_protection
Fix Invalid Authenticity Token with Rails 5
2019-04-25 20:12:43 +02:00
Javier Martín
b087cf4621 Merge pull request #3453 from consul/update_recent_migrations
Use Rails 5 conventions in ballot migrations
2019-04-25 20:10:47 +02:00
Juanjo Bazán
c63c06b7ec protect_from_forgery is not prepended by default
so it has to appear before devise's auth methods
2019-04-25 14:22:19 +02:00
Javi Martín
4b1cbb7db6 Use Rails 5 conventions in ballot migrations
These migrations and models were added after the Rails 5 branch was
created but before it was merged.
2019-04-24 19:24:01 +02:00
decabeza
0994ef2342 Hide request to admin button for archived proposals 2019-04-24 14:08:22 +02:00
decabeza
aa960ac50a Prevent long action content break dashboard layout 2019-04-24 14:08:15 +02:00
decabeza
0a40c747a3 Add default actions list on admin dashboard actions index 2019-04-24 14:05:05 +02:00
decabeza
7b6619528c Temporally not send dashboard's notifications 2019-04-24 14:04:45 +02:00
decabeza
f0305e36a6 Replace capistrano task restart file 2019-04-24 14:04:01 +02:00
decabeza
467d05ab98 Replace poll summary to title on social meta tags 2019-04-24 14:03:39 +02:00
decabeza
534ad75206 Downgrade autoprefixer-rails gem
We need update Node version before upgrade this gem version.
2019-04-24 14:02:46 +02:00
decabeza
b53a2f8012 Fix button text on dashboard polls form 2019-04-24 14:02:07 +02:00
decabeza
5bbf325c1f Remove copy link on dashboard polls 2019-04-24 14:01:08 +02:00
decabeza
07fd5084f7 Show request to admins and short description only for resources 2019-04-24 14:01:04 +02:00
decabeza
17d4af31ae Remove duplicated content on model poll 2019-04-24 14:00:58 +02:00
decabeza
18f0697ef7 Fix proposal dashboard settings 2019-04-24 14:00:48 +02:00
decabeza
4100bf2ddf Update dashboard specs 2019-04-24 14:00:38 +02:00
decabeza
c76b465ce8 Show message when request a resource to admins 2019-04-24 13:58:42 +02:00
decabeza
5b8fe4bb98 Add truncate to proposed action description
The show description link only appears if the description is longer than defined length.
2019-04-24 13:58:37 +02:00
decabeza
41e692737b Add expanded class to dashboard resources buttons 2019-04-24 13:58:32 +02:00