Commit Graph

367 Commits

Author SHA1 Message Date
Javi Martín
83400b9ed4 Display a message when feeds have no items
This is a scenario which will likely take place for at least some of the
goals.
2020-12-27 21:42:42 +01:00
Javi Martín
fae52274a4 Reuse code between feed components
They were all following the same format.

Note we need to group the `see_all` translation keys together (the same
way it's done with the `most_active` keys) so we don't have an unused
translation warning.

We're also moving the "see all" link in processes outside the feed
content; the same way it's done in debates and proposals and removing
unnecessary classes in the processes feed: the column class is causing
the processes not to be aligned with the debates above them, and the
margin bottom is not needed because the margin of the footer is already
enough.
2020-12-27 21:42:40 +01:00
Javi Martín
de4be15a8d Add empty SDG index 2020-12-23 13:18:10 +01:00
Senén Rodero Rodríguez
5611f58909 Add SDG page to create local targets 2020-12-11 16:10:37 +01:00
Javi Martín
bb2e2fa0a3 Move main <h1> tag inside main header
A <header> tag is the natural place to have headings.

Since we already had the logo there, IMHO it makes sense to merge both
the <h1> tag and the logo together. We were already doing so in the
devise layout.

From the sceen reader users' point of view, having a link with the text
"CONSUL logo" is a bit confusing, since it seems to imply the link will
get us to the CONSUL logo. Using the organization name as the text of
the link makes more sense.

One thing changes, though. Before this commit, the first thing on the
page a screen reader user would hear about would be the organization
name. Now the language selector and the top links are announced before
the organization name is read. That's fine, since the actual first thing
these users will hear is the content of the <title> tag, which contains
the organization name as well.
2020-11-23 18:05:43 +01:00
Senén Rodero Rodríguez
761f5f3f93 Fix inconsistent interpolations 2020-09-15 17:53:54 +02:00
Javier Martín
b8894eac70 Merge pull request #3699 from consul/upgrade_turbolinks
Bump turbolinks to 5.2.1
2020-08-12 14:34:19 +02:00
Javi Martín
cfc60b5de4 Warn for changes just in markdown editor
This is the reason why this feature was implemented in the first
place: it's easy to open the editor, make some changes, close it, and
continue without realizing the changes have not been saved.

In the rest of the forms, this functionality is quite lacking. For
starters, some forms warn if there are unsaved changes, while some forms
don't, which is highly inconsistent and disorients users.

Furthermore, we were having problems with this feature after upgrading
Turbolinks, particularly in forms using CKEditor. In these cases, a lot
of hacking needs to be done in order to make this feature work properly,
since CKEditor adds some formatting automatically, and if this is done
after the form is serialized, we'll get some unexpected behavior. On the
other hand, comparing the value of a textarea against its `defaultValue`
property will work on every edge case, including using the browser's
back button or reloading the page.

Finally, users are used to the way web forms work, and aren't used to be
asked for confirmation when they change their mind and decide to leave
the page without saving the changes. Asking them for confirmation will
be annoying in most cases. Besides that, if they accidentally leave the
page, they can use the browser's back button and they'll recover the
unsaved changes.

It's true this won't happen it they accidentally close the browser's
window, but our WatchFormChanges functionality didn't work in this case
either. Using the "beforeunload" event adds more problems than it
solves, since it doesn't support custom messages (or, to be more
precise, modern browsers ignore custom messages), and it doesn't get
along with turbolinks.

Co-Authored-By: Senén Rodero Rodríguez <senenrodero@gmail.com>
2020-08-05 14:10:22 +02:00
Javi Martín
ed2b217a08 Remove duplication in oauth actions
We were writing the same code twice, with the only difference being the
text "Sign up" in the sign_up action, and "Sign in" in the sign_in
action.

Note we're renaming the `omniauth.info_*` I18n keys so we don't need to
add new exceptions to the `ignore_unused` list, and so it's consistent
with all the other keys under the `omniauth` key.
2020-07-27 14:46:20 +02:00
Javi Martín
bedd879025 Remove redundant show/hide screen reader texts
These texts are redundant since we added the same texts for everyone in
commit 6b85ed87.
2020-05-12 23:23:01 +02:00
Javi Martín
b483d50d30 Remove unused tag filter
This filter was added in commit 4285ba4b, it was changed in commit
002d8688, and most of the code from the original commit has disappeared
without a trace (maybe due to a merge conflict?).

This filter could actually be useful if we started using it when users
click on a tag. Since we don't, I'm removing it. We might add it back if
we decide to actually use it.
2020-04-08 13:49:48 +02:00
Andy Sims
74fbde09f1 Support creates follow (Merge pull request #3895)
* Supporting a proposal will create a follow relationship
* Only followers receive notifications
2020-04-06 15:26:47 +02:00
Julian Herrero
193e51d42f Enable Wordpress Oauth login and registration 2020-02-07 12:23:41 +07: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
b15ae77ddc Simplify Javascript to pluralize translations
We can pass the whole translation hash instead of passing descriptions
individually, and we can replace `%{count}` so we don't need any <span>
tags.
2019-10-31 14:49:46 +01:00
Javi Martín
af7c37634d Remove poll votation types
Unfortunately this feature wasn't properly reviewed and tested, and it
had many bugs, some of them critical and hard to fix, like validations
being skipped in concurrent requests.

So we're removing it before releasing version 1.1. We might add it back
in the future if we manage to solve the critical issues.

This commit reverts commit 836f9ba7.
2019-10-30 18:48:55 +01:00
Javier Martín
a1dce46754 Merge pull request #3800 from rockandror/add-missing-spanish-translations
Add missing spanish translations
2019-10-28 11:23:40 +01:00
Senén Rodero Rodríguez
db7b826902 Add missing spanish translations for poll questions 2019-10-27 08:55:24 +01:00
Javi Martín
8ff728ee83 Use the shared partial to render errors
We were using it most of the time, but in some places we still had
duplicated code.
2019-10-25 15:15:47 +02:00
Javi Martín
7f1bfc6bd7 Avoid using html() to set languages description
The jQuery html() function does not filter <script> tags, so if somehow
an attacker introduced a <script> in the translation, we would be
vulnerable to a XSS attack.

Note using $.parseHTML wouldn't solve the problem, since it doesn't
filter attributes in image tags.

Since changing the text of the part which doesn't have the count wasn't
very clean, I've added another <span> tag for the part with the
description, and so we can use jQuery's text() function to replace it.
2019-10-21 20:24:50 +02:00
Javi Martín
6b1864fbcd Sanitize translations instead of using _html
Using the `_html` suffix in an i18n key is the same as using `html_safe`
on it, which means that translation could potentially be used for XSS
attacks.
2019-10-09 19:46:47 +02:00
Javi Martín
b66859945e Remove _html suffix from already sanitized texts
Using the `_html` suffix automatically marks texts as HTML safe, so
doing so on sanitized texts is redundant.

Note flash texts are not sanitized the moment they are generated, but
are sanitized when displayed in the view.
2019-10-09 19:46:47 +02:00
Javi Martín
55a190f44a Remove unneeded _html suffix in I18n keys
This suffix does the same thing as calling `.html_safe` on them. So we
don't need to use it in texts that don't use HTML.
2019-10-08 13:20:22 +02:00
Javi Martín
e06bbaed78 Remove unused and add missing Spanish i18n keys
They were accidentally added in commit 9d1ca3bf, missing in that same
commit, or left by accident in commit 78c6f6f7.
2019-10-07 17:26:45 +02:00
Javi Martín
2614253b69 Fix typo in <br> tag
We probably meant `<br>`, `<br />` or `<br/>`, but wrote `</br>`
instead.
2019-10-07 17:26:24 +02:00
Javi Martín
bbbd0820c1 Use active record translations in votation types
We need to build a votation type object in the form so translations are
applied automatically.
2019-10-07 01:56:24 +02: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
Javi Martín
2ccc283bb7 Use the same I18n key for "verify account" text
We were using several different keys, all of them having the same text.
2019-10-05 14:07:24 +02:00
Javi Martín
78c6f6f7e9 Use the same key for "signin" and "signup" texts
We were using the same texts in several places
2019-10-05 14:07:23 +02:00
Javi Martín
ae64458fce Use the same I18n key for "login to comment" text
We were using several different keys, all of them having the same
translations.
2019-10-05 14:07:23 +02:00
decabeza
abf04bea4c Add related content section on proposal dashboard 2019-09-11 19:45:19 +02:00
Javi Martín
06be5e132f Fix label in form to add own answer
The label text was always in English, and it wasn't associated with any
input field.

The `SecureRandom` part is a quick hack so we don't get duplicate IDs.
Using "your_answer_#{question.id}" might work as well, but right now I'm
not sure if the form is sometimes rendered twice for the same question.
2019-08-27 17:22:22 +02:00
Senén Rodero Rodríguez
9b5f5e653a Add local census importations controller 2019-07-29 13:07:24 +02:00
Senén Rodero Rodríguez
fd7cc624db Add new and create actions 2019-07-29 13:07:24 +02:00
Senén Rodero Rodríguez
9fd77d4042 Add languages in use description
New interface now shows a description to ensure the user
knows how many languages are currently in use.
2019-07-01 14:49:43 +02:00
taitus
395143ba5a Display button or informative text
When all remote translations are enqueued we not display button but
we display informative text.

Co-Authored-By: alessandro <agileontheweb@gmail.com>
2019-06-27 09:21:19 +02:00
taitus
cbd7ab7179 Add remote translation button
- Create partial to render remote translation button. This button will
  send remote_translations as json to remote translations controller.
- Add locales
- Add styles

Co-Authored-By: alessandro <agileontheweb@gmail.com>
2019-06-27 09:21:18 +02:00
taitus
744a3d48fd Create RemoteTranslations Controller
- Create RemoteTranslations Controller to receive resources without
  translations and create RemoteTranslation instances when theirs
  translations are not enqueued.
- Create remote_translation_enqueued? class method on RemoteTranslation
  model to check if exists same remote translations without errors
  pending to translate.
2019-06-27 09:21:18 +02:00
Senén Rodero Rodríguez
4236a3a388 Move label translations to activerecord.yml files
Moved only :es and :en translations from general.yml to activerecord.yml
and use them in related forms.
2019-06-27 09:19:37 +02:00
Senén Rodero Rodríguez
f70adbe23a Move label translations to activerecord.yml 2019-06-27 09:19:37 +02:00
lalo
23d36835d7 Add Admin changes to create Poll:Questions with votation type 2019-06-12 19:44:14 +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
Julian Herrero
1f76b25e2a Show name and email for deleted poll officer's user account
Avoid to raise an exception `Module::DelegationError' when trying to
show the name and/or email of a poll officer whose user account has
been deleted.
We'll show a message "User deleted" and "Email deleted" instead.
2019-06-04 18:55:51 +02:00
Alberto
2f8505332e Merge pull request #3574 from consul/remove-dashboard-polls
Allow users to delete dashboard polls
2019-06-01 11:06:34 +02:00
Alberto
8ee396f311 Merge pull request #3573 from consul/improve-ux
Add help texs, links and new message section to improve UX
2019-06-01 10:38:52 +02:00
voodoorai2000
d0b8fef6b3 Delete spending proposals 2019-05-31 18:22:59 +02:00
Julian Nicolas Herrero
3ba7bd1cab Merge pull request #3567 from consul/select_proposals_by_admins
Make proposals to be selected by administrators
2019-05-31 15:30:39 +02:00
decabeza
7ed80d7883 Move link to selected proposals on proposals index 2019-05-31 12:24:10 +02:00