Commit Graph

33 Commits

Author SHA1 Message Date
Javi Martín
08b12a78ff Directly delete the "organization is invalid" error
We were getting a warning since upgrading to Rails 6.1:

DEPRECATION WARNING: Calling `delete` to an ActiveModel::Errors messages
hash is deprecated. Please call `ActiveModel::Errors#delete` instead.

So we're deleting the error instead of deleting the message.
2023-09-11 23:40:37 +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
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
Angel Perez
a58f6a2662 Enable 'Recommended proposals' setting for users 2018-07-15 21:28:57 -04:00
Angel Perez
522c206f6d Enable 'Recommended debates' setting for users 2018-07-15 21:28:57 -04:00
Bertocq
118deb9fc4 Fix line lenght offenses at multiple controllers 2018-02-19 11:09:19 +01:00
BertoCQ
204ea13c85 Merge branch 'master' into followable 2017-07-11 11:30:49 +02:00
Bertocq
69f4e1c683 Fix all rubocop Metrics/LineLength issues (140+) 2017-07-10 13:22:49 +02:00
taitus
19820e4432 Add public interests validation and show interests on user profile 2017-07-07 13:34:43 +02: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
rgarcia
98040e191e fixes conflicts with fork 2016-06-20 21:33:34 +02:00
rgarcia
28d12fe55b removes sending individual proposal notifications via email 2016-06-15 10:43:02 +02:00
rgarcia
fd67294075 adds option to receive direct messages 2016-06-14 18:20:36 +02:00
rgarcia
9f19a5d143 adds option to receive email digest 2016-06-14 18:08:27 +02:00
rgarcia
ad697cd2c1 adds preference to receive proposal notifications 2016-06-06 12:55:33 +02:00
Julian Herrero
2049eb0455 rename column name to newsletter 2015-12-24 12:53:03 +01:00
Julian Herrero
e7314ac380 add option to subscribe/unsubscribe to website newsletter 2015-12-16 16:14:35 +01:00
Juanjo Bazán
f57eef4929 makes public activity toggleable 2015-11-04 13:51:31 +01:00
Juanjo Bazán
1e96bba262 refactors account's email config 2015-09-14 14:09:24 +02:00
Juanjo Bazán
d8c9974d1a adds responsible_name to org's account page 2015-09-12 18:16:40 +02:00
rgarcia
4897d5df4e makes spaces consistent 2015-09-03 01:29:46 +02:00
Juanjo Bazán
b396a3b415 refactors user's registration
Simplifies process and fields: 

* In: username
* Out: first_name, last_name, phone, nickname, use_nickname?

Closes #213
2015-08-21 16:41:08 +02:00
kikito
8ca546a431 merges master and fixes conflicts 2015-08-17 02:40:11 +02:00
kikito
543f718891 Adds phone_number to the regular user registration / account views 2015-08-17 01:16:08 +02:00
rgarcia
bea38226fe fixes spacing 2015-08-16 22:45:43 +02:00
Raimond Garcia
16183d9909 Merge pull request #116 from AyuntamientoMadrid/admin-77
Administrator and Moderator basic interface
2015-08-10 16:41:47 +02:00
kikito
51323fa891 Adds back missing authenticate_user! calls 2015-08-10 16:05:58 +02:00
kikito
ce27a6f2ea Adapts AccountController to new permissions system 2015-08-10 15:10:47 +02:00
Alberto Garcia Cabeza
c048f25941 Fixes conflicts 2015-08-08 13:28:29 +02:00
rgarcia
beb1a796f5 adds email sending preferences [#23] 2015-08-07 20:56:27 +02:00
rgarcia
a65396886a adds error messages to account edit 2015-08-07 17:47:53 +02:00
kikito
c4c764df38 Adds nickname and use_nickname to "my profile" 2015-08-06 19:19:45 +02:00
Juanjo Bazán
8f6e5ecfc8 adds basic 'my account' page
Fields related with authentication are not included
because the auth system will change to integrate with 
Madrid.es's Ciudadano360
ref: #22
2015-07-30 17:36:32 +02:00