Commit Graph

16 Commits

Author SHA1 Message Date
Javi Martín
2acaa14705 Make it possible to select proposals without JavaScript
This way, when JavaScript hasn't loaded (for whatever reason),
administrators can still use this functionality.
2024-10-25 17:12:47 +02:00
Javi Martín
4a2fc50c76 Use separate actions to select/deselect proposals
This is consistent to what we usually do. Also, we're applying the same
criteria mentioned in commit 72704d776:

> We're also making these actions idempotent, so sending many requests
> to the same action will get the same result, which wasn't the case
> with the `toggle` action. Although it's a low probability case, the
> `toggle` action could result in [selecting a proposal] when trying to
> [deselect] it if someone else has [deselected it] it between the time
> the page loaded and the time the admin clicked on the "[Selected]"
> button.
2024-10-25 17:12:47 +02:00
Javi Martín
11832cc07d Make it easier to customize allowed parameters
When customizing CONSUL, one of the most common actions is adding a new
field to a form.

This requires modifying the permitted/allowed parameters. However, in
most cases, the method returning these parameters returned an instance
of `ActionController::Parameters`, so adding more parameters to it
wasn't easy.

So customizing the code required copying the method returning those
parameters and adding the new ones. For example:

```
def something_params
  params.require(:something).permit(
    :one_consul_attribute,
    :another_consul_attribute,
    :my_custom_attribute
  )
end
```

This meant that, if the `something_params` method changed in CONSUL, the
customization of this method had to be updated as well.

So we're extracting the logic returning the parameters to a method which
returns an array. Now this code can be customized without copying the
original method:

```
alias_method :consul_allowed_params, :allowed_params

def allowed_params
  consul_allowed_params + [:my_custom_attribute]
end
```
2022-04-07 19:35:40 +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
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
German Galia
9d1ca3bfd4 Report generation. Download csv 2019-06-12 10:17:31 +02:00
Julian Herrero
ad5f7a06e1 Allow admins to select proposals and users to list them 2019-05-30 11:19:33 +02:00
Javi Martín
d3f11c3b55 Add search form to proposals admin index 2018-12-11 20:09:30 +01:00
Javi Martín
4770217373 Add proposals index in admin 2018-12-11 20:09:30 +01:00
Javi Martín
45a41a7528 Rename Admin::Proposals to Admin::HiddenProposals
The same way we do it with users and budget investments.
2018-11-30 18:04:55 +01:00
Bertocq
62d75af892 Fix line lenght offenses at multiple controllers 2018-02-19 11:09:19 +01:00
Angel Perez
ab9d612128 'Proposals' feature can be enabled/disabled
Fixes #1886
2017-11-17 13:10:55 -04:00
rgarcia
bb3c4c6399 adds consistency to ruby code style
Keep a blank line before and after private
Keep a blank line before and after protected
Remove extra empty line at class body end
Remove extra blank line
Add final newline
Use 2 (not 3) spaces for indentation
Use 2 (not 4) spaces for indentation
Remove space before comma
Add space after comma
Remove trailing whitespaces
Remove unnecessary spacing
Use snake_case for variable names
Do not use then for multi-line if
Remove unused block argument - i
Use the new Ruby 1.9 hash syntax
Remove unused assignment to variable
Indent when as deep as case
Align attributes
Align end with def
2016-11-15 11:18:43 +01:00
Juanjo Bazán
03342e164b ignores in moderation the admin restored proposals 2015-09-25 13:24:12 +02:00
Juanjo Bazán
02b1e30205 logs activity: restore admin actions
on User/Proposal/Debate/Comment
2015-09-22 17:24:13 +02:00
kikito
3df8fe59b3 implements /admin/proposals 2015-09-14 11:30:58 +02:00