Commit Graph

6051 Commits

Author SHA1 Message Date
Sebastia
810a516078 Merge pull request #4806 from consul/budget_phases_hint
Add and improve hint information related to phases duration
2022-04-12 15:50:20 +02:00
taitus
703e28e6cd Add information to the phase table to clarify its functionality.
Add a help text on admin budget show page and improve text from Admin::Budgets::HelpComponent in order to
clarify its functionality when we are using the wizard.
2022-04-12 15:22:29 +02:00
taitus
bdf4d6a79c Do not use the wizard component when edit phases
Currently we were using the wizard component to edit a
phase when we were no longer in the wizard.

This was a bit strange, as it took us out of the context
and showed us information such as the
CreationTimelineComponent or the HelpComponent
that is meant for when navigating the Wizard.
2022-04-12 14:41:48 +02:00
taitus
2464b517c1 Add hint information related to phase dates 2022-04-12 14:41:48 +02:00
Javi Martín
2684fc70d3 Show either investments header or results summary
We were showing the header when there were no search terms but there
were advanced search filters, unlike what we do for debates and
proposals. Besides, we were already hiding the header when there were
search terms, so it makes sense to hide it when using the advanced
search too.

We're using the `@search_terms` and `@advanced_search_terms` instance
variables in order to be consistent with what we do in the debates and
proposals sections.
2022-04-12 14:24:24 +02:00
Javi Martín
015613a140 Fix HTML injection in search results summary
In commit f374478dd, we enabled the possibility to use HTML in the
search results translations in order to add a <strong> tag to these
results. However, that meant we were also allowing HTML tags inside the
search term itself, and so it was possible to inject HTML on the page.

Stripping the HTML tags solves the issue.

Note the issue wasn't a high severity issue because tags such as
`<script>` weren't allowed since we were using the `sanitize` helper.
2022-04-12 14:23:35 +02:00
taitus
dbc51bcdcd Improve hint information related to duration phases
Specify that this field is for information purposes only and
does not automatically update phase status.

We also improve enable help text.
2022-04-12 13:23:59 +02:00
Javi Martín
8aff5e95d6 Fix term in investments advanced search results
When using the advanced search in the debates and proposals sections, we
were not displaying the search term in the search results summary.
However, we were displaying it when using the advanced search in the
investments section.

Now we're doing the same thing everywhere.
2022-04-10 13:48:27 +02:00
Javi Martín
b68aa67b1d Remove unnecessary "pending" comment
The test is already working with poll question answers (which are the
only ones using `has_many_images`) as well.
2022-04-07 15:34:10 +02:00
Javi Martín
e637bce3d8 Fix error messages for question answer images
Since we were creating a new answer in the form, we weren't getting the
errors associated to the answer the administrator was trying to create,
and so we were skipping the test.

Using the answer which contains the information about validation errors
fixes the issue and so we don't have to skip the tests.
2022-04-07 15:34:10 +02:00
Javi Martín
fb99d8cb33 Remove obsolete "pending" test
I'd say this feature is actually tested in the "proposal polls specific
validations"; the empty test was probably added by accident in commit
4b8cc85c4.
2022-04-07 15:34:10 +02:00
Javi Martín
c0f71c4c8d Complete proposal notification test
We were finishing the test with the first "visit", so it was doing
nothing (other than potentially generating concurrency issues with other
tests).
2022-04-07 15:34:10 +02:00
Javi Martín
e49c32638d Use if instead of skip to skip tests
This way the tests won't appear as "pending" when running the test
suite, and so we get rid of a lot of noise in the test results. There
doesn't seem to be a way to call `skip` without the test being marked as
"pending".

Note that in the globalizable tests we need to build a factory before
deciding whether an atribute is required or not (particularly for the
milestone factory, since milestone attributes are required depending on
the presence of other attributes). This isn't possible before we're
inside the test, so we can't add an `if:` condition to the test. So
we're adding the condition inside the test instead. A minor
inconvenience of this method is the test still runs even when the
condition is `false`.
2022-04-07 15:34:10 +02:00
Javi Martín
2927174e06 Remove unnecessary locales check in specs
We define the available locales in the test environment, so Spanish is
always available in this environment even if it isn't available in the
production environment.
2022-04-07 15:34:10 +02:00
Javi Martín
702fc84391 Remove pending reportable tests
These tests are obsolete since commit 5ed308c6f.
2022-04-07 15:34:10 +02:00
Javi Martín
c5791278b2 Implement pending card image expectations 2022-04-07 15:34:10 +02:00
Javi Martín
4a8a4eacdd Remove pending tag cloud test for debates
This feature was only enabled for proposals five years ago, and it
hasn't changed since then. The pending test only gets in the way.

Implement. Or implement not. There is no pending.
2022-04-07 15:34:10 +02:00
Javi Martín
6c322e20f4 Implement tests to disable homepage settings
They were marked as pending.

Note Capybara doesn't support finding a button by its `aria-labelledby`
attribute, so we're using the ugly `click_button "Yes"`, like we did in
commit fabe97e50.
2022-04-07 15:34:10 +02:00
Javi Martín
695d5d8765 Enable passing legislation comment test
It was disabled in commit 792b15b22 for unknown reasons.
2022-04-07 15:34:10 +02:00
Javi Martín
6ddb22c1ea Enable test checking alert to finish valuation
It looks like it was disabled because it was failing sometimes for some
reason. I haven't found the reason, though; we're changing the test a
little bit to make it easier to read. Enabling it will let us find out
whether it still fails.
2022-04-07 15:34:09 +02:00
Javi Martín
fa15ac0c3b Implement pending email digest test 2022-04-07 15:34:09 +02:00
Javi Martín
d5867db2cf Remove unnecessary condition to skip tag list test
This file only has tests related to tags; if the model doesn't have
tags, we simply wouldn't include `it_behaves_as` in their tests instead
of including it and then skipping it.
2022-04-07 15:34:09 +02:00
Javi Martín
42b8729cd8 Remove duplicate map test
We were skipping the test, but there's an identical test right below it.
2022-04-07 15:34:09 +02:00
Javi Martín
0eb666db4d Allow commenting on polls as moderator/admin
So it works the same way as everywhere else.
2022-04-07 15:34:09 +02:00
Javi Martín
c77759469d Enable poll comments test
This feature was actually implemented, but the test was checking the
wrong selectors.
2022-04-07 15:34:09 +02:00
Javi Martín
3752fef6bf Remove map page in debates
The map feature was never implemented for debates (only for proposals
and budget investments) and it was crashing for debates because the page
didn't load the geozones. And we don't have a "geozone" field in the
debates form either.

So we're removing the map page alongside its (pending implementation)
tests.
2022-04-07 15:34:07 +02:00
Javi Martín
1f55be7c5e Remove obsolete pending test reference
The test "Sender email" already checks the receiver's name appears in
the copy sent to the sender.
2022-04-07 11:55:35 +02:00
Javi Martín
b89c358d03 Remove comments related to code from Madrid
CONSUL doesn't implement blank votes via web; the comment was based on
the code used in Madrid, which was actually very complex.

And the concept of "all city" was also specific to Madrid. Poll
questions aren't associated to a geozone, so the geozone will depend on
the poll they're associated to.
2022-04-07 11:55:35 +02:00
Senén Rodero Rodríguez
c086308b6f Call new common actions modules methods explicitly 2022-04-06 16:06:44 +02:00
Senén Rodero Rodríguez
7b1897b7a7 Remove method duplications as only the latest method loaded is used
The `management` variable gets its value from the caller context.
2022-04-06 16:06:44 +02:00
Senén Rodero Rodríguez
b24e49a6c8 Set a folder where to place custom spec support modules 2022-04-06 16:06:44 +02:00
Senén Rodero Rodríguez
46537cb708 Move nested_imageable helper methods to a new common actions module 2022-04-06 11:15:23 +02:00
Senén Rodero Rodríguez
071311be00 Move nested_documentable helper methods to a new common actions module 2022-04-06 11:15:23 +02:00
Senén Rodero Rodríguez
b26a7528df Move mappable helper methods to a new common actions module
So we can use the same customization technique overriding
the methods we need.
2022-04-06 11:15:23 +02:00
Sebastia
fbc74e8d46 Merge pull request #4800 from consul/checkbox_label_styles
Fix checkbox label styles
2022-04-04 20:09:15 +02:00
taitus
923c2a7ee2 Check labels styles
We are use a display: block style for labels containing check boxes inside
them, and the label has a width of 100%.

This means that clicking on the blank space on the right of the label text
will check/uncheck the checkbox. To avoid this behaviour we modify the
"display" attribute of the labels.

In order to prevent unexpected behaviour in terms_of_service form labels,
we add specific css for this case when define a checkbox within the
.actions class.
2022-04-04 18:55:56 +02:00
Julian Herrero
0c9a46221e Show assigned heading on investment show 2022-03-31 17:00:24 +02:00
Senén Rodero
3ecf2feb2e Merge pull request #4601 from consul/budgets_hide_money
Add hide money option for approval budgets
2022-03-30 09:58:29 +02:00
decabeza
50e00a096b Update investments order when hide_money is active 2022-03-29 14:49:30 +02:00
decabeza
8c3b222c98 Manage the render of the price field on valuation investments section 2022-03-29 14:49:29 +02:00
decabeza
4c0499d53b Manage the render of the price field on budgets results section 2022-03-29 14:49:28 +02:00
decabeza
5d475e6401 Manage the render of the price field on budgets ballot section 2022-03-29 14:49:28 +02:00
decabeza
abc4e9dca1 Manage the render of the price field on public investment section 2022-03-29 14:49:27 +02:00
decabeza
40bdd1f03a Manage the render of the price field on admin investments section 2022-03-29 14:49:27 +02:00
decabeza
2c16bac5f8 Manage the render of the price field on public budget headings 2022-03-29 14:49:26 +02:00
decabeza
9fb5019f0f Manage the render of the price field on admin budget headings
Avoid displaying the price in admin budget headings section
and avoid fill the field 'price' in admin budget headings form
when the budget has been checked with hide_money field.
2022-03-29 14:49:26 +02:00
decabeza
80e64590b7 Allow enable 'hide_money' check on admin budget form
Add new 'hide_money' field to admin budget form.

Only display new field 'hide_money' when voting style is 'approval'
2022-03-29 14:49:25 +02:00
Javi Martín
1fa05b1f54 Fix crash on attributes with interpolation arguments
The application crashed when we generated hints to attributes with
interpolation arguments in their `human_attribute_name`.

When generating the hint, we used the `custom_label` method to generate
a label and get the `for` attribute and, since we weren't passing a
text, it used the default human attribute name for the field. However,
it crashes if the default attribute name requires an interpolation
argument.

So now, since we were only using the `custom_label` method in order to
get the `for` attribute, we're simply passing an arbitrary text to the
method.
2022-03-28 14:55:42 +02:00
taitus
d719b2291e Do not generate an empty hint element when there's an empty hint 2022-03-28 14:55:42 +02:00
Javi Martín
df2b3f2ee7 Avoid model inheritance in skip validation test
One of these tests was failing sometimes on Github Actions. It looked
like the line `custom_banner.save!` was using the validations from the
Banner class sometimes, even if the callbacks had correctly been
removed in the DummyBanner class.

Se we're inheriting from ApplicationRecord instead of inheriting from
Banner. Since I couldn't reproduce the issue locally after running the
test hundreds of times and with the same seed and tests that were
running on Github Actions, there's a change this won't work. I've tested
a few times on Github Actions and it seems to be working, but we'll have
to keep an eye on it.
2022-03-25 20:25:34 +01:00