150 Commits

Author SHA1 Message Date
Javi Martín
600f5c35e9 Use file_validators instead of Papeclip validations
Since we're going to remove Paperclip and Active Storage doesn't provide
any validations, we have to either write our own validation rules or use
a different gem.

We're using the file_validators gem instead of the
`active_storage_validations` gem because the latter doesn't support
proc/lambda objects in size and content type definitions. We need to use
them because in our case these values depend on settings stored in the
database.
2022-02-23 18:21:38 +01:00
Javi Martín
78e543f6d3 Extract method to get a user segment name
We're going to add geozones as user segments, so it's handy to have the
method in the UserSegments class.

We're also changing the `user_segment_emails` parameter name for
consistency and simplicity.
2021-12-20 15:07:43 +01:00
Javi Martín
d59d9aac3b Check missing/unused translations in seeds.yml
We were making some typos during development in the name of the keys and
tests were still passing.

We're also removing some texts that were never used.
2021-12-14 20:10:35 +01:00
Javi Martín
7b8e892f9c Use a switch to enable/disable homepage features
So it's consistent with the way we enable/disable other features.
2021-09-23 13:25:22 +02:00
Machine Learning
4d27bbebad Add experimental machine learning 2021-08-16 16:31:04 +02:00
Javi Martín
c8d8fae98d Move related list partial to a component
This way the code is easier to follow; the code checking whether the
list has contents is in the partial rendering the list.

We also remove some duplication setting up related content in the
controllers.

For some reason, we have to manually ignore i18n keys which were
automatically ignored when the code was in the view.
2021-08-16 16:30:13 +02:00
Javi Martín
bc0f040758 Use order links in legislation proposals admin
As mentioned in the previous commits, a `<select>` field which submits
its form on change causes many accessibility and usability issues, so
we're replacing it with the order links we use everywhere else.

Since the links "Id" and "Title" by themselves don't have enough
information to let users know they're used to sort by ID or title, we
have to update them somehow. We could add a "Sort by:" prefix before the
list of links (and associate it with the `aria-labelledby` attribute);
however, we don't do this anywhere else and might look weird depending
on the screen size.

So we're simply adding "Sort by" before each link.

Now that we don't use the `wide_order_selector` partial anymore, we can
remove it alongside the styles for the `select-order` class.
2021-06-28 01:20:39 +02:00
Javi Martín
d672a4294a Remove unused internationalization key
It looks like it isn't used since we replaced the order selector with
order links in debates a few years ago, in commit 7eda0b288.
2021-06-28 00:15:08 +02:00
Javi Martín
14d8bef0d8 Use order links in print proposals management
A `<select>` tag here might make more sense than in other similar places
since there are 5 options to choose among, and using links might take
too much screen space.

However, as mentioned in the previous commits, `<select>` tags which
automatically submit a form have many accessibility and usability
issues.

An alternative would be to create a dropdown menu with a button and a
list of links (similar to what Foundation does). I'm keeping the links
for simplicity and because the interface looks a bit more consistent
with the rest of the sections. Before these changes, we had a heading,
then a `<select>` field to choose the filter, and then a button to print
the page. We never use a similar interface, and some people might think
the "Print" button is related to the same form as the `<select>` field.

Now that we don't use the `order_selector` partial anywhere anymore, we
can remove it.
2021-06-28 00:15:08 +02:00
Javi Martín
227a5868b8 Use order links in moderation section
Using order links in this case causes an unusual interface, where we
show filter links, then information about the number of results, and
then order links.

Whether or not this makes sense needs to be confirmed with usability
tests. In any case, this is still way better than using `<select>`
fields which automatically change to a new page, since they cause
problems to keyboard users, are harder to select for touchscreen users,
might confuse screen reader users who will notice a form but no way to
submit it, and are not elements we generally use to let users choose the
order of the records.

For a more detailed explanation of these issues, check the commit
message in the commit "Use order links to sort comments and topics"
(just a few commits ago).
2021-06-28 00:15:08 +02:00
Julian Herrero
51bca66533 Adapt help component to multiple and single budget mode 2021-06-11 00:34:00 +02:00
Julian Herrero
0b81f7f621 Allow creating a budget in single or multiple mode
Co-Authored-By: decabeza <alberto@decabeza.es>
2021-06-11 00:28:56 +02:00
Julian Herrero
eb77d09425 Add phases step to budget creation 2021-06-08 18:45:55 +02:00
Julian Herrero
f8d6ba12d7 Add headings step to budget creation
Co-Authored-By: decabeza <alberto@decabeza.es>
2021-06-08 18:45:53 +02:00
Alberto
b304c640e1 Add groups step to budget creation
Note we're keeping this section's original design (which had one button
to add a new group which after being pressed was replaced by a button to
cancel) but we aren't using Foundation's `data-toggle` because there
were a couple of usability and accessibility issues.

First, using `data-toggle` multiple times and applying it to multiple
elements led to the "cancel" button not being available after submitting
a form with errors. Fixing it made the code more complicated.

Second, the "Add new group" button always had the `aria-expanded`
attribute set to "true", so my screen reader was announcing the button
as expanded even when it wasn't. I didn't manage to fix it using
`data-toggle`.

Finally, after pressing either the "Add new group" and "Cancel" buttons,
the keyboard focus was lost since the elements disappeared.

So we're simplifying the HTML and adding some custom JavaScript to be
able to handle the focus and manually setting the `aria-expanded`
attribute.

Co-Authored-By: Javi Martín <javim@elretirao.net>
Co-Authored-By: Julian Herrero <microweb10@gmail.com>
2021-06-08 18:45:13 +02:00
decabeza
04605d5d5b Add filters on budget investments index page
Now it's easier to change the investments filter. Previously we had to
go back to the budget index page, change the filter there, and then
select one heading.

Now the links to change the current filter in the budget index page
aren't needed anymore.
2021-03-17 13:44:01 +01:00
Javi Martín
ad56b01a9a Extract component to render "see more" link 2021-02-02 22:22:37 +01:00
Javi Martín
1fefc910d6 Add list of targets to SDG tag list
Co-authored-by: Senén Rodero Rodríguez <senenrodero@gmail.com>
2021-01-27 16:21:40 +01:00
Senén Rodero Rodríguez
c6407d82e3 Add filters to SDG relations controller
We have three filters: "pending", "all" and "reviewed". Where "pending"
is the default one.

Now we are rendering the `shared/_filter_subnav` partial we need to stub
helper methods defined at the controller and the helper methods that
rely on the request parameters to test the component.
2021-01-19 14:56:30 +01:00
Javi Martín
ceed3c18d3 Display SDG icons alongside tags
We're using the translation fallbacks for the icons, just like we do for
texts.

Note we use the `render?` method provided by view_component to make sure
the component will not be rendered when certain features are disabled.

Also note the `find_asset` method works differently in development and
production, and so we use different approaches here.
2021-01-09 14:53:54 +01:00
Javi Martín
a42cb050a7 Add SDG content section 2020-12-02 12:38:03 +01:00
Ziyan Junaideen
1e3e8c1304 Add approval voting to budgets
Co-Authored-By: Javi Martín <javim@elretirao.net>
2020-08-06 12:38:18 +02:00
Javi Martín
5f726df8be Extract methods showing voting style information
The idea is that different voting styles will display different
information messages.
2020-07-30 16:19:58 +02:00
Javier Martín
7ee3eecae3 Merge pull request #3980 from consul/erased-users
Filter erased users and show erase reason in admin
2020-07-17 23:00:12 +02:00
decabeza
f72f255d15 Filter erased users and show erase reason in admin 2020-07-17 22:21:52 +02:00
Javi Martín
438a751599 Rename admin proposal notifications controller
To be consistent with all the other controllers dealing with hidden
content, we use the word "hidden" in the controller class.
2020-06-16 19:40:04 +02:00
Javi Martín
82b0a6a92d Remove new CSV report generation
The new CSV report was more configurable and could work on proposals,
processes and comments. However, it had several issues.

In the public area, by default it generated a blank file.

In the admin section, the report was hard to configure and it generated
a file with less quality than the old system.

So until we improve this system, we're bringing back the old investment
CSV exporter.

This commit reverts most of commit 9d1ca3bf.
2019-11-06 00:04:02 +01:00
Javi Martín
ac6d50e06b Remove tracker role
The current tracking section had a few issues:

* When browsing as an admin, this section becomes useless since no
investments are shown
* Browsing investments in the admin section, you're suddenly redirected
to the tracking section, making navigation confusing
* One test related to the officing dashboard failed due to these changes
and had been commented
* Several views and controller methods were copied from other sections,
leading to duplication and making the code harder to maintain
* Tracking routes were defined for proposals and legislation processes,
but in the tracking section only investments were shown
* Probably many more things, since these issues were detected after only
an hour reviewing and testing the code

So we're removing this untested section before releasing version 1.1. We
might add it back afterwards.
2019-11-01 20:08:46 +01:00
Javi Martín
7b89dd6a5f Refactor links to show staff members 2019-10-31 16:21:39 +01:00
Javi Martín
6fa67b5e53 Use active record translations for labels
This way we can simplify the way we generate form fields. In some cases,
we also use the human attribute in table headers, which IMHO makes
sense.

I haven't moved all of them: for example, sometimes a label is
different depending on whether it's shown to administrators, valuators,
or users. And I haven't touched the ones related to devise, since I
wasn't sure about possible side effects.

Note I've also removed placeholders when they had the same text as their
labels, since they weren't helpful. On the contrary, the added redundant
text to the form, potentially distracting users.
2019-10-07 01:56:23 +02:00
German Galia
9ce524e1f3 Create tracker rol 2019-06-12 16:23:40 +02:00
German Galia
9d1ca3bfd4 Report generation. Download csv 2019-06-12 10:17:31 +02:00
Javier Martín
72c6b05c64 Merge pull request #3376 from LextrendIT/3350_rename_debates_comments_admin
Refactor admin/debates and admin/comments to hidden
2019-06-05 19:15:21 +02:00
Julian Herrero
8e0bbf54f6 Replace harcoded images and documents settings 2019-06-04 11:50:09 +02:00
German Galia
85722eb7c4 Rename admin/debates and admin/comments to hidden 2019-06-02 19:12:26 +02:00
Javi Martín
ff21ce7665 Use translations for official level names seeds 2019-05-31 19:30:14 +02:00
voodoorai2000
d0b8fef6b3 Delete spending proposals 2019-05-31 18:22:59 +02:00
voodoorai2000
24dde9c35e Delete valuation 2019-05-31 15:43:06 +02:00
Javi Martín
4f4dc2c2af Add show results and stats form to budgets 2019-05-22 11:50:03 +02:00
Javi Martín
66ecb2835b Show only available budget stats phases
This way we can show statistics for the supports phase before the vote
phase is over.
2019-05-21 13:50:18 +02:00
Javi Martín
5a3eb70a46 Use same translations for poll and budget stats 2019-05-21 13:50:15 +02:00
decabeza
0a40c747a3 Add default actions list on admin dashboard actions index 2019-04-24 14:05:05 +02:00
decabeza
b53a2f8012 Fix button text on dashboard polls form 2019-04-24 14:02:07 +02:00
decabeza
19c158f4eb Add pending and done filters to dashboard administrator tasks 2019-04-24 13:58:27 +02:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Julian Herrero
c9cdc72537 Use double quotes in config/ 2019-03-15 10:29:07 +01:00
Julian Herrero
87be6f302c Add default site customization pages
From now on these static pages:

`/privacy'
`/conditions'
`/accesibility'
`/help/faq'
`/welcome'

have been moved to the DB and can be modified easily by any
administrator in `/admin/site_customization/pages'
2019-03-14 18:35:51 +01:00
Alessandro Cuoghi
a9e3532ecf Update i18n-tasks.yml 2019-02-04 16:20:45 +01:00
Javi Martín
e34a827c48 Add translations for rails date order
Not doing so caused crashes on applications which don't fall back to
English when a translation is missing.

We're adding them in a separate file so we can exclude it from crowdin
and so translators don't translate symbols as if they were words which
need translation.
2018-12-21 19:31:15 +01:00
Javi Martín
df29b49d05 Make milestones view reusable 2018-12-11 19:22:55 +01:00