Commit Graph

23 Commits

Author SHA1 Message Date
Javi Martín
07202fea10 Add and apply Style/RedundantBegin rubocop rule
We're about to add code which might fall into the `RedundantBegin`
category, so we're adding the rule in order to prevent that.
2024-10-30 15:57:44 +01:00
decabeza
5b97e85dd7 Hide comments when allegations phase is closed
Co-Authored-By: Julian Nicolas Herrero <microweb10@gmail.com>
Co-Authored-By: Javi Martín <javim@elretirao.net>
2022-08-19 18:12:49 +02:00
Javi Martín
42d2e5b3ad Apply Rails/InverseOf rubocop rule
Not doing so has a few gotchas when working with relations, particularly
with records which are not stored in the database.

I'm excluding the related content file because it's got a very peculiar
relationship with itself: the `has_one :opposite_related_content` has no
inverse; the relation itself is its inverse. It's a false positive since
the inverse condition is true:

```
content.opposite_related_content.opposite_related_content.object_id ==
  content.object_id
```
2019-10-25 19:29:12 +02:00
Javi Martín
94d2496f8f Add missing has_many relations for users
Usually when we specify a `belongs_to` relations, we also specify its
equivalent `has_many`. That allows us to write, for example:
`topic.user.topics`.
2019-10-25 19:27:30 +02:00
Javi Martín
27ed26d6f2 Remove unnecessary class names in relations
Just like we do in the Budget module, and in some places in the Poll and
Legislation modules, we don't need to specify the class name when the
name of the relation matches the name of a class in the same module.
2019-10-25 19:03:14 +02:00
Javi Martín
fda53a0a2a Remove unnecessary foreign_key options
When we specify `belongs_to :author`, ActiveRecord automatically uses
`author_id` as the foreign key.
2019-10-25 19:03:10 +02:00
Javi Martín
f9ed186909 Add rubocop spacing rules
We were following these rules in most places; we just didn't define them
anywhere.
2019-09-10 21:04:56 +02:00
Juanjo Bazán
7ab602175a makes models inherit from ApplicationRecord 2019-04-17 17:40:56 +02:00
Julian Herrero
3ba961a2d7 Use double quotes in models 2019-03-14 17:25:43 +01:00
Bertocq
2888c20489 Fix all Style/RedundantSelf rubocop issues 2017-07-05 11:55:52 +02:00
Bertocq
f6fe9cc7d2 Fix all Layout/SpaceAroundOperators rubocop issues and remove file list from rubocop_todo list 2017-06-26 18:04:20 +02:00
Amaia Castro
854d51dd8e Calculate annotations weight and add weight css classes for color intensity 2017-03-02 14:25:23 +01:00
Amaia Castro
58b9135c71 Add context to annotation in index view 2017-02-13 11:18:33 +01:00
Amaia Castro
8e741a6b4f Refactor and use first node start + quote + last node end for the context 2017-02-13 09:53:36 +01:00
Amaia Castro
6737d6afdd Make annotation context work with multi-node annotations 2017-02-10 18:16:09 +01:00
Amaia Castro
4cb1bba5a7 Use range offsets instead of quote for substitution 2017-02-10 15:55:03 +01:00
Amaia Castro
b298fb7316 Show annotation context in annotation page
Only works with quotes within the same html node for now
2017-02-10 15:35:42 +01:00
Amaia Castro
53d13d8524 Create a new comment instead of a new annotation with the same ranges 2017-01-25 16:04:10 +01:00
Fernando Blat
e7c754a875 Limit to 5 the number of comments.
Strip comments length
2017-01-18 11:25:05 +01:00
Amaia Castro
49f4bf5bc5 Destroy object when their parent object is destroyed 2017-01-13 19:34:17 +01:00
Amaia Castro
f43f13e826 Create first comment automatically from the annotation 2017-01-09 17:03:00 +01:00
Amaia Castro
b8f034d896 Legislation annotations/comments page 2017-01-09 09:29:15 +01:00
Amaia Castro
ee9fa3db15 Base Legislation Annotations 2017-01-04 12:56:58 +01:00