Commit Graph

82 Commits

Author SHA1 Message Date
Javi Martín
3753c42ab2 Open moderation links in the same window
Note that, unlike what we did in the admin section we're opening links
to budget investments on the same tab. There are two reasons for it; the
first one is that, in this case, there are no filters in the moderation
section that are lost after editing an investment, and the second one is
that, in this context, administrators usually don't go to the investment
in order to edit it, so they can just check something and use the
browser's back button to go back.
2023-10-24 16:31:39 +02:00
Javi Martín
e9d9789c25 Move users moderation index view to a component
This way it's easier to change the logic and write tests for it.
2021-12-30 15:50:03 +01:00
Javi Martín
a31e73bf23 Ask for confirmation when hiding/blocking users
In the moderation section there's no clear indicator as to what the
"Hide" and "Block" buttons do and the difference between them.

Since we're using confirmation dialogs in all moderation actions except
these ones, we're adding them here as well, so the difference will
appear in the dialog.

This isn't a very good solution, though, since the confirmation dialog
comes after clicking the button and users have already been wondering
whether clicking that button will be the right choice. A better solution
would be making the purpose clear before the button is clicked, although
that's something we don't do anywhere in the admin/moderation sections.
2021-12-30 15:50:03 +01:00
Javi Martín
021fef07b6 Make action names to block and hide more clear
The `hide` action was calling the `block` method while the `soft_block`
action was calling the `hide` method.

Combined with the fact that we also have a `block` permission which is
used in `ModerateActions` the logic was hard to follow.
2021-12-30 15:50:03 +01:00
Carlos Iniesta
49edd6a9b1 Add soft block button in moderation user view 2021-12-30 15:50:03 +01:00
Javi Martín
4c8dfb6695 Use just one action to hide users
Other than removing a redundant action, we're fixing two bugs when
blocking an author using the links in the public views:

* We were always redirecting to the debates index, even if we blocked
  the author of a proposal or an investment
* We weren't showing any kind of success message
2021-12-30 15:50:02 +01:00
Javi Martín
84c6eeae9c Use headers and actions in users moderation table
Having proper headers makes it more accessible.

We're also using the table actions component because we're going to add
another action. Since table actions use a flex layout, we have to tweak
the styles a little bit. For that, I'm adding a <main> element which
will make it possible to style just this table while also providing an
extra shortcut for people using screen readers.
2021-12-30 15:50:02 +01:00
Javi Martín
600a2bd4c2 Use a button instead of a link to block users
We're continuing to replace links with buttons, for the reasons
explained in commit 5311daadf.

We're also adding an ARIA label since on the same page there might be
several links to block different users.
2021-12-30 15:50:02 +01:00
Javi Martín
9a8a8ce5ce Fix missing </td> closing tag for blocked users
It was working because browsers automatically assume one <td> element
ends when finding a </tr> tag without a </td>.
2021-12-30 15:50:02 +01:00
Javi Martín
d2f38fd276 Reduce duplication in moderation sections
We had five almost-identical views. Now we've removed most of the
duplication, although the tables are still similar. We might refactor
them in the future.
2021-06-28 00:15:08 +02:00
Javi Martín
5db6edfbd2 Simplify internationalization key in moderation
In keys like `hide_debates`, the suffix part is redundant when that key
is part of an absoulte key starting with `moderation.debates`.

This change will make it easier to remove duplication in moderation
views.
2021-06-28 00:15:08 +02:00
Javi Martín
55d2cfe5b1 Use link list helper in admin menus
For now we're not including lists with nested lists.
2020-12-07 15:28:56 +01:00
Javi Martín
cf510043a4 Search on the same URL by default 2020-12-07 14:28:36 +01:00
Javi Martín
e33794e45e Reuse admin search component in other sections
There are some sections where we are not reusing it:

* The budget investments search is completely different, so this
  component isn't appropriate there
* Booth assignment and officers are slightly different, and I'm not
  entirely sure it's safe to refactor these cases
2020-12-04 19:57:05 +01:00
Javi Martín
0a3acf3c5f Use a shared translation for search buttons
We were writing the same text over and over for the same translations.
Since they all serve the same function, it's perfectly fine for them to
have the same text, and so we can have a shared translation.
2020-12-04 19:57:05 +01:00
Javi Martín
155da08cf0 Use a generic name for the search parameter
This way we can use it for any model.
2020-12-04 19:57:05 +01:00
Javi Martín
bdf30aa14e Use CSS to display icons in the admin menu
This way we simplify the HTML and generating similar menus will be
easier. We also improve the experience for screen reader users, who
might have been hearing the icons as text because we weren't using the
`aria-hidden` attribute.

We're still keeping the "icon-" classes for compatibility with CONSUL
installations which might have changed this code.
2020-11-27 12:33:42 +01:00
Javi Martín
125106f9c0 Simplify code to have an off-canvas menu
While Foundations's off-canvas menu allows us to forget about writing
CSS, it also leads to complicated HTML.

Ideally Foundation would provide an easy way to simplify what we're
doing, but I haven't found anything in the documentation.

We could simplify the HTML a bit more if we used a CSS grid layout
instead of a flex one, but old browsers have better support for the
latter.

Note we're using `breakpoint(medium)` so we can group the CSS for small
screens and follow SCSS-Lint rules at the same time.

Also note behavior of the main area when the menu appears on small
screens is slightly different: it doesn't move the main content to the
right. I've done it this way so we don't have any overflow issues,
unlike the previous version.

There's a small issue using a label and a checkbox to enable/disable the
menu: sighted keyboard users with a small screen might not be able to
enable the menu. So we're adding the `:focus-within` pseudoclass so the
menu can be normally navigated using the keyboard. Even if old browsers
don't support this pseudoclass, we believe the probability of a sighted
user using a small screen, navigating with the keyboard and using an old
browser is really low, particularly in the admin area.

We're also adding the `aria-hidden` attribute on the label, since the
menu is never hidden for screen readers and so having a control to show
it could be confusing. Since the label is not focusable, we're complying
with the fourth ARIA rule:

> Do not use role="presentation" or aria-hidden="true" on a focusable
> element .
>
> Using either of these on a focusable element will result in some users
> focusing on 'nothing'.
2020-09-21 15:14:20 +02:00
Javi Martín
7bf4e4d611 Sanitize descriptions in the views
Sanitizing descriptions before saving a record has a few drawbacks:

1. It makes the application rely on data being safe in the database. If
somehow dangerous data enters the database, the application will be
vulnerable to XSS attacks
2. It makes the code complicated
3. It isn't backwards compatible; if we decide to disallow a certain
HTML tag in the future, we'd need to sanitize existing data.

On the other hand, sanitizing the data in the view means we don't need
to triple-check dangerous HTML has already been stripped when we see the
method `auto_link_already_sanitized_html`, since now every time we use
it we sanitize the text in the same line we call this method.

We could also sanitize the data twice, both when saving to the database
and when displaying values in the view. However, doing so wouldn't make
the application safer, since we sanitize text introduced through
textarea fields but we don't sanitize text introduced through input
fields.

Finally, we could also overwrite the `description` method so it
sanitizes the text. But we're already introducing Globalize which
overwrites that method, and overwriting it again is a bit too confusing
in my humble opinion. It can also lead to hard-to-debug behaviour.
2019-10-21 21:32:02 +02:00
cyrillefr
44b2a07878 Moderate legislation proposals (#3602)
Moderate legislation proposals

- added a controller for moderation/legislation
- updated view to appropriate link + added route
- added a spec
- Feature test
- test for faded
- javascripts for visual effects
2019-10-05 04:02:39 +02:00
Javi Martín
71d9ddd849 Apply rule to end files with a newline character 2019-09-10 20:02:15 +02:00
Julian Herrero
129a258f19 Use double quotes in app/views/moderation 2019-03-19 12:16:50 +01:00
Alberto
fb19aafee7 Merge pull request #2778 from wairbut-m2c/backport/investments-moderation
Allow budget investments to be moderated
2018-07-27 12:34:17 +02:00
Angel Perez
f063391e41 Add missing thead & tbody tags on investments moderation index 2018-07-20 18:42:34 -04:00
Angel Perez
7f70106299 Fix page entries information positioning for investments moderation 2018-07-20 18:42:34 -04:00
Angel Perez
c64e93867a Allow moderators to moderate investments 2018-07-20 18:42:34 -04:00
Angel Perez
1990092fdf Allow moderators to hide inappropriate investments 2018-07-20 18:42:33 -04:00
Angel Perez
4a6313fed7 Add missing thead & tbody tags on moderation index views 2018-07-03 09:22:42 -04:00
Angel Perez
452d7dd252 Fix page entries information and filter positioning 2018-07-03 09:22:42 -04:00
iagirre
12ccf466f9 Add the index to moderate the notifications
Add the index for moderating the notifications. The tranlations needed
have also been added, along with the JS to make it disappear at that moment.
2018-07-02 18:18:01 +02:00
iagirre
f58bc5d886 Add the menu entry for prop. notifications
A new menu for the sidebar has been added, so that the moderator
can access to the index from the menu.
2018-07-02 18:17:56 +02:00
decabeza
156997d936 Removes old help on moderation dashboard 2018-06-08 18:32:26 +02:00
decabeza
0bf31bde6c Updates all active to is-active classes 2018-06-06 12:02:13 +02:00
Bertocq
089ccdae7c Fix html alignments 2018-02-10 16:58:00 +01:00
Sergio Castellano Herrera
2905b24ee7 Error to access hide comments 2018-01-29 16:48:48 +01:00
Angel Perez
ab9d612128 'Proposals' feature can be enabled/disabled
Fixes #1886
2017-11-17 13:10:55 -04:00
Manuel Ortega
0a2dae8672 Fixed link back from moderation dashboard to root_path
Passing the organization name to the locale yml file
2017-11-15 19:23:03 +01:00
Juanjo Bazán
7f01dbdca2 makes sure setting helper is used in views 2016-07-08 14:42:28 +02:00
Alberto Garcia Cabeza
31cb29d8c5 Fixes specs 2016-06-01 21:46:17 +02:00
Alberto Garcia Cabeza
b71c61e405 Improves styles for moderation section 2016-06-01 17:30:01 +02:00
Alberto Garcia Cabeza
3ec0971b37 Replaces icons i tags for span 2016-03-14 19:32:48 +01:00
Alberto Garcia Cabeza
3752f3a53b Adds foundation 6 🎉 2016-02-26 19:33:33 +01:00
Josep Jaume Rey Peroy
2d45828cad Feature-flag debates 2016-01-18 13:05:00 +01:00
Alberto Garcia Cabeza
8dd027d974 Updates admin and moderation texts 2015-09-25 09:40:51 +02:00
Alberto Garcia Cabeza
058d6f6ffc Fixes moderation tables 2015-09-24 12:55:39 +02:00
Alberto Garcia Cabeza
7dfdce8c07 Improves styles for admin buttons and selects 2015-09-24 12:40:16 +02:00
kikito
3b405f3e29 changes css style name to avoid conflicts 2015-09-22 14:23:11 +02:00
kikito
343025872b changes comment moderation to be similar to proposals moderation 2015-09-22 14:20:37 +02:00
kikito
69e74c4207 Style in comment moderation 2015-09-21 16:12:55 +02:00
kikito
12f1796e7b Merge branch 'master' into debates-moderation-530 2015-09-21 15:52:25 +02:00