Commit Graph

133 Commits

Author SHA1 Message Date
taitus
7fa594e3e3 Rename sdg_related_list to related_sdg_list
To maintain consistency with the current names in the database with fields:
:related_sdg_type and :related_sdg_id
2021-01-26 19:18:11 +01:00
taitus
e6bfeef58d Add SDG::RelatedListSelectorComponent to Debates 2021-01-22 16:04:40 +01:00
Javi Martín
b483d50d30 Remove unused tag filter
This filter was added in commit 4285ba4b, it was changed in commit
002d8688, and most of the code from the original commit has disappeared
without a trace (maybe due to a merge conflict?).

This filter could actually be useful if we started using it when users
click on a tag. Since we don't, I'm removing it. We might add it back if
we decide to actually use it.
2020-04-08 13:49:48 +02:00
Javi Martín
941fc76884 Remove unused query parameters in redirect
These actions are never called with query parameters in our application,
so there's no need to use these parameters in a redirect.

Note in the test I'm using the `get` method because the `patch` method
wouldn't send query parameters. This doesn't mean the action can be
accessed through GET requests, since controller tests don't check route
verbs.
2019-11-12 19:27:58 +01:00
Javi Martín
97e826f2a4 Don't use update_attribute
This method is ambiguous. Sometimes we use it to set invalid data in
tests (which can usually be done with `update_column`), and other times
we use it instead of `update!`.

I'm removing it because, even if sometimes it could make sense to use
it, it's too similar to `update_attributes` (which is an alias for
`update` and runs validations), making it confusing.

However, there's one case where we're still using it: in the
ActsAsParanoidAliases module, we need to invoke the callbacks, which
`update_column` skips, but tests related to translations fail if we use
`update!`. The reason for this is the tests check what happens if we
restore a record without restoring its translations. But that will make
the record invalid, since there's a validation rule checking it has at
least one translation.

I'm not blacklisting any other method which skips validations because we
know they skip validations and use them anyway (hopefully with care).
2019-10-25 23:17:50 +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
Javi Martín
b5b07bccd3 Apply PercentLiteralDelimiters rubocop rule 2019-09-10 20:02:15 +02:00
Senén Rodero Rodríguez
51cda51155 Add debates translation interface
Also fix broken spec after removing translatable attributes from
strong_parameters definition. Now we need to send these attributes
as nested translations attributes.

Use activerecord.yml title attribute label so form helper could load it
from default location.
2019-06-27 09:19:36 +02:00
Julian Herrero
d24376f6ad Use double quotes in controllers/ 2019-03-13 22:19:49 +01:00
Angel Perez
a143fa447b Ensure recommendations are only shown when enabled 2018-07-15 21:28:58 -04:00
Angel Perez
463c753880 Recommendations are automatically disabled if dismissed by user 2018-07-15 21:28:58 -04:00
Angel Perez
522c206f6d Enable 'Recommended debates' setting for users 2018-07-15 21:28:57 -04:00
decabeza
36a5ff39b8 Adds recommendations on debates index 2018-07-15 21:28:57 -04:00
decabeza
c4dc7bc831 Adds view mode on debates 2018-04-02 17:28:39 +02:00
María Checa
3836b73482 Added related contents to debates 2017-12-18 23:56:32 +01:00
taitus
fe3bb7a389 Add recommended tab on proposals and debates index. 2017-08-01 16:31:44 +02:00
decabeza
c76bd65b40 removes old proposals successful banner 2017-06-05 16:29:48 +02:00
rgarcia
87dd15b7bf includes search concern in commendable actions 2017-05-04 20:42:21 +02:00
rgarcia
37d8693049 extracts advanced search to controller concern 2017-05-04 04:23:53 +02:00
Juanjo Bazán
7b6713f8bb fixes typo in method call 2016-12-27 18:26:27 +01:00
kikito
f0b8cfd4a2 Time.now -> Time.current 2016-11-23 19:19:19 +01: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
Alberto Garcia Cabeza
7abd31e4bf Renames variable, updates text 2016-09-15 13:47:53 +02:00
Alberto Garcia Cabeza
db6f82fa4c Moves banner to a partial and includes it on debates index 2016-09-14 11:09:36 +02:00
kikito
9ac6e2d60b Uses invisible_captcha's default "foo fast" action 2016-04-28 12:47:04 +02:00
kikito
7adc706d23 Moves redirect_timestamp_spam to AppController 2016-04-27 16:13:49 +02:00
kikito
289182b145 Adds invisible_captcha to proposals, debates & sps 2016-04-27 16:12:32 +02:00
kikito
eedf02a186 Starts using invisible_captcha in the source code. Pending: tests, proper invisible_captcha gem in Gemfile 2016-04-27 16:07:48 +02:00
kikito
dea1a28a69 purges simple_captcha 2016-04-27 16:07:47 +02:00
Juanjo Bazán
54c1c581f9 uses index_customization in debates_controller 2016-04-21 12:00:48 +02:00
MaiteHdezRivas
f771a61a50 Refactoring method on debates controller 2016-04-21 11:13:58 +02:00
MaiteHdezRivas
3e7db9d1b5 Best practices code changes 2016-04-20 16:40:58 +02:00
MaiteHdezRivas
68f9a76cea Mark debates as featured 2016-03-20 13:56:05 +01:00
Raimond Garcia
2a4adc2e60 Merge pull request #817 from microweb10/friendly_urls
Friendly urls
2016-03-02 17:51:00 +01:00
rgarcia
f82a590e1e reverts debate links 2016-02-19 19:08:35 +01:00
palomahnhp
2ee90ac76e share links to debate 2016-02-08 10:32:57 +01:00
rgarcia
e4a49f802e removes duplication between debate and proposal suggestions 2016-02-03 19:57:37 +01:00
MaiteHdezRivas
5dd4633d6a Merge branch 'suggest_before_creating'
Conflicts:
	app/assets/javascripts/application.js
	app/controllers/debates_controller.rb
	app/controllers/proposals_controller.rb
	config/locales/es.yml
	config/routes.rb
	db/schema.rb
	spec/features/debates_spec.rb
	spec/features/proposals_spec.rb
2016-01-27 13:11:23 +01:00
MaiteHdezRivas
7406904c51 adding suggest with coffescript 2016-01-27 12:32:44 +01:00
rgarcia
21b9e31f11 uses geozones instead of district tags 2016-01-25 22:28:46 +01:00
Perisso
7d1d4cea4a filter by districts and categories 2016-01-25 22:28:17 +01:00
Juanjo Bazán
393388de71 Merge pull request #830 from AjuntamentdeBarcelona/feature_flags
Feature flags
2016-01-18 15:19:09 +01:00
Josep Jaume Rey Peroy
2d45828cad Feature-flag debates 2016-01-18 13:05:00 +01:00
Ana
48d6a76491 Advanced search added to debates 2016-01-13 19:25:47 +01:00
Julian Herrero
7c65b8555c redirect to frendly url for debates and proposals if needed 2016-01-10 13:38:22 +01:00
kikito
b89f39bfef Removes unused orders from debates controller 2016-01-05 19:37:56 +01:00
rgarcia
40ea3fcc58 displays relevance order in searches 2015-11-23 13:39:32 +01:00
kikito
73c306a673 Adds 3 orders for comments: most_voted, newest, oldest 2015-11-02 14:01:55 +01:00
kikito
da19d4d773 replace most_voted by confidence_score in comment views 2015-10-28 16:02:40 +01:00
kikito
e4bfc72649 Refactors design of comments order selector into a partial with i18n 2015-10-28 15:48:48 +01:00