Commit Graph

94 Commits

Author SHA1 Message Date
Julian Herrero
b1cb981980 Add help text in budgets admin index
Co-authored-by: decabeza <alberto@decabeza.es>
2021-02-18 23:40:40 +01:00
Senén Rodero Rodríguez
9b2d349e21 Create SDG stats page 2021-01-23 12:23:29 +01:00
Senén Rodero Rodríguez
4c2d918bb5 Create component to render goal stats 2021-01-23 12:23:29 +01:00
Javi Martín
1e7517d1f6 Extract components to edit and add cards
This way we'll be able to reuse it in the SDG Management section while
reusing the `title` method to set the page title.
2021-01-14 17:38:01 +01:00
Javi Martín
c66a5a30ef Allow using table actions in different namespaces
This way we can reuse it in sections like SDGManagement and URLs will be
automatically generated as expected.
2021-01-14 17:35:38 +01:00
Javi Martín
1f6ca4980f Extract method in cards table component 2021-01-12 14:50:37 +01:00
Javi Martín
5148919c17 Remove duplication in cards tables
We were using the same code in two places, so we're extracting the code
into a component in order to share it.
2021-01-12 14:50:37 +01:00
Javi Martín
c9362ffeb4 Add filter by goal 2020-12-21 18:27:27 +01:00
taitus
6d5333fc7a Add generic method for header
Unify Header to be able to use it from the admin as from the seg_management.
2020-12-16 13:16:48 +01:00
taitus
d64518d173 Add sdg manager section to admin profile section 2020-12-16 13:16:48 +01:00
taitus
9fe24aec9d Add sdg manager section to admin
Allow a user to become an sdg manager
2020-12-16 13:16:45 +01:00
Javi Martín
0c482ae418 Fix active class for proposals in admin menu 2020-12-07 19:28:12 +01:00
Javi Martín
1046ec5e78 Move link methods from view to component
This way the view is not as hard to read as it was.
2020-12-07 15:28:56 +01: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
a9427f5971 Allow custom options in search form component
So we keep the same API as the form_tag method.
2020-12-04 19:57:05 +01:00
Javi Martín
9b073599f0 Allow different labels in admin search component 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
49c22b880c Use CSS to style the search component
We simplify the view, and so make it easier to customize.
2020-12-04 19:57:05 +01:00
Javi Martín
b453ed6c14 Add ARIA role and ARIA label to admin search form
This way screen reader users will have an easier access to it.
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
9a24a8efe2 Use form_tag in search form
This form does not depend on an object at all, so we can use a generic
tag which is model-independent.
2020-12-04 19:57:05 +01:00
Javi Martín
2cf49b28de Extract users search view to a component
We're going to make this search component more generic, but for now,
we're keeping the exact same behavior we had.
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
d99ca9bd34 Use CSS to make items bold in the admin menu
From a semantic point of view, there's no reason to add a strong
emphasis to the menu items.

Besides, using CSS simplifies the code and is less error-prone. For
instance, the "stats" section didn't have a <strong> tag, and so it was
the only one which wasn't bold.
2020-11-26 20:04:08 +01:00
Javi Martín
615bb050e8 Remove unnecessary section-title class
It isn't used anywhere, and we could achieve the same result using the
CSS child selector `> li`.
2020-11-26 20:04:08 +01:00
Javi Martín
e3bca85321 Extract methods in admin menu component
Now that there's no naming confict with the helper method used in the
ProposalsDashboardHelper, we can easily simplify the view, moving the
logic to the Ruby class.
2020-11-26 20:04:08 +01:00
Javi Martín
60b3ca000a Fix typos in admin menu classes
The HTML `class` attribute was declared twice and so the second one was
being ignored.

In the case of messages, it was "working" properly because the
`class=is-active` part is not used on `<li>` tags when they've got a
`<ul>` inside them.
2020-11-26 20:04:08 +01:00
Javi Martín
f9e110aa9b Simplify method names in admin menu component
We no longer need to use the `menu_` prefix, since now these methods
aren't helper methods anymore, and so their names won't collide with
other helpers.
2020-11-26 12:15:07 +01:00
Javi Martín
d501915954 Extract admin menu to a component
This way adding new methods will be easier.
2020-11-26 12:15:07 +01:00
Javi Martín
8c1140a1bf Use semantic HTML classes in table actions
Note the CSS could probably be improved to avoid duplication with other
button style definitions. However, that's fine because we're going to
change the style of the links soon.

For the same reason, I haven't bothered to style every single link the
way it was until now.
2020-11-03 14:58:02 +01:00
Javi Martín
ccb7695056 Use a custom link_to method for table actions
This way we'll be able to change the behavior of these links without
changing the view nor affecting the rest of the application.
2020-11-03 14:58:02 +01:00
Javi Martín
7cb0a4135b Extract component for admin officers table
This way we can remove duplication and simplify the code in the view.

Note we're not using the "within" method in the tests to access a row,
because it doesn't seem to work in components tests when passing the
`text:` option.
2020-10-21 13:19:52 +02:00
Javi Martín
08c2bfc255 Extract component to add/remove admin/mod/manager
We remove some duplication by doing so.
2020-10-21 13:19:52 +02:00
Javi Martín
02e27e13dc Extract component for budget actions
We can omit passing a parameter to the helper method thanks to that, and
we group related code together.
2020-10-21 13:19:52 +02:00
Javi Martín
1537f25739 Extract component for organization actions
We remove duplication by doing so, and now we only need to add the call
do render Admin::TableActionsComponent once.
2020-10-21 13:19:52 +02:00
Javi Martín
eb3f2bc2ca Extract component for restore and hide actions
By doing so, we remove a lot of duplication.
2020-10-21 13:19:52 +02:00
Javi Martín
64b0cc741b Improve table actions layout
In the past we were using some <div> tags surrounding table action
links in order to guarantee these links wouldn't be wider that their
cell's space and wouldn't expand over two lines.

However, while these links didn't expand over two lines, at certain
resolutions the width of their text exceeded the width of the links,
causing part of the text to be outside their borders.

This behavior was also inconsistent: some tables had these <div> tags,
and some tables didn't.

Since we've now introduced the table actions component, the code is more
consistent and we're getting rid of these <div> tags. So now we're again
facing the issue where links could expand over two lines.

Using a flex layout solves this issue and considerably improves the
layout at lower resolutions.
2020-10-21 13:19:52 +02:00
Javi Martín
fb23df2e5b Allow additional links in table actions component
This way we'll be able to make these links consistent.
2020-10-21 13:19:49 +02:00
Javi Martín
e3753b1ad9 Allow custom options in links to actions
Some links were using options like `remote: true`.
2020-10-19 18:56:02 +02:00
Javi Martín
497963817c Allow different confirmation texts in destroy link 2020-10-19 18:56:02 +02:00
Javi Martín
b1f9ca4ad5 Allow custom URLs in links to actions
There were a couple of cases where these links didn't point to the
default actions.
2020-10-19 18:56:02 +02:00
Javi Martín
738646a565 Allow different texts in links to actions
The texts were different for a few models, so the component needs to be
updated.
2020-10-19 18:56:02 +02:00
Javi Martín
10c095d821 Move table actions partial to a component
This partial was going to get too complex since in some places we've got
different texts, different URLs or different confirmation messages.
While we should probably try to be more consistent and that would make
the partial work in most cases, there'll always be some exceptions, and
using a partial (with, perhaps, some helper methods) will become messy
really quickly.
2020-10-19 18:56:02 +02:00