Commit Graph

57 Commits

Author SHA1 Message Date
Javi Martín
f8d06bcaf2 Move management investments search partial to a component
We're also moving it to the `management` subfolder, since it's only used
in the budget investments management.
2024-11-08 15:03:55 +01:00
Javi Martín
fc5103881d Use a switch to toggle visibility to valuators
Using a checkbox wasn't very intuitive because checkboxes are
checked/unchecked when clicked on even if there's an error in the
request. Usually, when checkboxes appear on a form, they don't send any
information to the server unless we click a button to send the form.

So we're using a switch instead of a checkbox, like we did to
enable/disable phases in commit 46d8bc4f0.

Note that, since we've got two switches that match the default
`dom_id(record) .toggle-switch` selector, we need to find a way to
differentiate them. We're adding the `form_class` option for that.

Also note that we're now using a separate action and removing the
JavaScript in the `update` action which assumed that AJAX requests to
this action were always related to updating the `visible_to_valuators`
attribute.
2024-10-28 13:41:55 +01:00
Javi Martín
02b6302f25 Focus the proposal selection switch after pressing it
Since this button is replaced by a new element in an AJAX call, nothing
was focused after pressing it.

So we're reusing the code we used to enable/disable budget phases, which
already dealt with this issue.
2024-10-25 17:15:40 +02:00
Javi Martín
629e208e9d Add and apply ArgumentAlignment rubocop rule
We're choosing the default `with_first_argument` style because it's the
one we use the most.
2023-08-18 14:56:16 +02:00
decabeza
d0534b78da Improve admin budgets form structure
Co-Authored-By: Javi Martín <javim@elretirao.net>
2021-02-23 16:11:13 +01:00
Javi Martín
5569663308 Use aria-expanded on column selector toggle button
This way screen reader users will be informed about what happens when
the button is clicked. We also simplify the HTML/JavaScript a little
bit.
2021-02-08 19:57:42 +01:00
Javi Martín
00dfa95902 Allow toggling the column selector with a keyboard
Using a button tag, it's possible for every user to "click" the element.
Besides, we don't need to call the `preventDefault` function, because
buttons with type "button" don't do anything by default.
2021-02-08 19:57:42 +01:00
Javi Martín
f864156b21 Add and apply ClosingErbTagIndent ERB Lint rule
Note this rule does still allow us to add new lines after opening tags;
it just makes sure that if we do, we also add it in closing tags.
Likewise, if we don't add it in the opening tag, it forces us not to add
it in the closing tag either.

I don't have a strong preference about either style; in these cases I've
chosen the latter because it seemed more common in our code.
2021-02-05 17:39:42 +01:00
Javi Martín
663fba53db Group admin search label translations together
Since there are two different labels/placeholders for poll officers and
also two different ones for users, we're only grouping one of each.
2020-12-21 18:25:45 +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
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
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
taitus
7b6294199c Include the searched term in the search input form 2020-12-04 19:57:05 +01:00
DenisNikolski
5627c8ccf4 add test for booths search 2019-09-21 16:25:20 +03:00
DenisNikolski
6f085b5696 add search form on admin booths 2019-09-12 23:02:39 +03:00
Javi Martín
29da91a082 Fix untranslated texts
I've also renamed the key for the settings title so the `<h1>` gets the
`title` key, as done in other sections in the admin.
2019-08-27 17:22:22 +02:00
Senén Rodero Rodríguez
b86c0d3c30 Delete unused file
This file was used at previous version of translation
interface.
2019-07-01 15:03:48 +02:00
Senén Rodero Rodríguez
01bb0b9c6b Move translation interface to views root shared folder
As we are going to call this partial from any application view it will
have more sense to place it at `app/views/shared`.
2019-07-01 14:49:43 +02:00
Raimond Garcia
259e05c3e0 Merge pull request #3410 from LextrendIT/report_generation
Report generation, download CSV
2019-06-12 11:45:59 +02:00
German Galia
9d1ca3bfd4 Report generation. Download csv 2019-06-12 10:17:31 +02:00
lalo
4740aeaddf Add columns selector JS component and change Rails view to use it 2019-06-11 14:33:40 +02:00
voodoorai2000
d0b8fef6b3 Delete spending proposals 2019-05-31 18:22:59 +02:00
Javi Martín
45a3d8daf0 Add option to enable advanced stats 2019-05-22 11:50:03 +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
eb13994999 Extract partial for form to show results and stats 2019-05-22 11:50:03 +02:00
decabeza
2c9d9b5de8 Remove admin shortcuts links to stats and settings
These links are already on sidebar and isn't necessary have them on header.
2019-05-17 17:48:49 +02:00
Julian Herrero
0bb2633c7a Use double quotes in app/views/admin 2019-03-19 12:16:50 +01:00
Javi Martín
1962fcc2a2 Hide locale selector for primary progress bars
These progress bars don't have any translatable attributes.
2019-01-24 17:34:55 +01:00
Javi Martín
70b4225542 Extract partial to display language tabs 2018-12-12 15:15:00 +01:00
decabeza
8f27398bd1 Fixes globalize tabs when there is a lot of available locales 2018-11-22 11:37:26 +01:00
Javi Martín
9105ac3a69 Prefix classes used in JavaScript with "js-"
The same way it's done in the rest of the application.
2018-10-22 16:36:18 +02:00
Javi Martín
dbea577062 Follow naming conventions for HTML classes and IDs
We use underscores for IDs and hyphens for classes.
2018-10-22 16:36:18 +02:00
Javi Martín
387b345f77 Refactor globalize_locales partials to increase DRYness 2018-10-22 16:35:01 +02:00
Javi Martín
3b5a12b0ab Don't force translations for the current locale
Globalize creates a translation for the current locale, and the only way
I've found to change this behaviour is to monkey-patch it.

The original code uses `translation.locale` instead of
`Globalize.locale`. Since `translation.locale` loads the translation
with empty attributes. It both makes the record invalid if there are
validations and it makes it almost impossible to create a record with
translations which don't include the current locale.

See also the following convertations:

https://github.com/globalize/globalize/pull/328
https://github.com/globalize/globalize/issues/468
https://github.com/globalize/globalize/pull/578
https://github.com/shioyama/mobility/wiki/Migrating-from-Globalize#blank-translations
2018-10-22 16:28:53 +02:00
Javi Martín
124b8496de Simplify methods defining translation styles
This refactor is going to be useful when we change these rules within
the next few commits.
2018-10-22 16:28:53 +02:00
Marko Lovic
c7fcdd9b0e Use standard locale names for Globalize
It turns out it is not necessary to downcase and underscore
locale names to use the globalize-accessor gem. The gem
will automatically underscore the locale name when defining and
calling the accessor methods.
2018-09-11 18:48:14 +02:00
Marko Lovic
bfd9032e9d Extract translation partial to be shared within admin
Refactor: behaviour should be 100% the same
2018-08-27 18:24:24 +02:00
decabeza
2e8fe65b3d Cleans and improves management views layout 2018-07-02 17:41:39 +02:00
decabeza
804fabdc25 Fixes admin menu toggle 2018-06-22 13:56:25 +02:00
decabeza
9ba96becd2 Merge branch 'master' into admin-profiles 2017-10-25 18:29:01 +02:00
decabeza
5b40696f4f shows admin shortcuts menu only to admin users 2017-10-21 17:34:45 +02:00
decabeza
3c20ba0688 improve styles for admin officials views 2017-10-19 19:56:22 +02:00
decabeza
5ffac1d1fb remove extra line break 😅 2017-09-20 01:38:32 +02:00
decabeza
3e2c639137 moves stats and setting links to header into a partial 2017-09-20 01:38:32 +02:00
Juanjo Bazán
b1a5a324c7 adds missing checkbox label for unfeasible investments 2017-01-26 13:15:43 +01:00
kikito
748fd8becf Makes all tests pass in bi management 2016-12-07 19:16:37 +01:00
kikito
a962b2dfa7 i18n shared.search 2016-12-07 17:46:33 +01:00
kikito
2bc9e7be78 started working on budget manatement 2016-09-12 12:11:47 +02:00
Alberto Garcia Cabeza
5bd7bbee4f Improves styles for management section 2016-06-01 18:07:58 +02:00