Commit Graph

17 Commits

Author SHA1 Message Date
Javi Martín
ee29ca43a5 Make widget cards polymorphic
So now we'll be able to add them to other sections.

We're also adding a `dependent: :destroy` relation to models having
cards since it doesn't make sense to have cards around when their page
has been destroyed.
2021-01-14 17:37:58 +01:00
Javi Martín
8b5cca746c Apply rubocop rules to freeze constants
Added by popular demand among our team members.
2019-10-26 13:21:36 +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
57ef380379 Add and apply Layout/ExtraSpacing rubocop rule 2019-10-24 18:11:58 +02:00
Juanjo Bazán
7ab602175a makes models inherit from ApplicationRecord 2019-04-17 17:40:56 +02:00
decabeza
483182ceed Refactor scopes on site customization page model 2019-01-30 18:03:58 +01:00
decabeza
2695e19e2f Fix hound warnings 2019-01-29 17:54:02 +01:00
Manu
5627d2cf23 added associations between cards and pages models 2019-01-18 09:54:43 -05:00
Javi Martín
863b326142 Validate both the model and its translations
This way we guarantee there will be at least one translation for a model
and we keep compatibility with the rest of the application, which
ideally isn't aware of globalize.
2018-10-22 16:30:28 +02:00
Javi Martín
2ab49a1832 Refactor globalize models code using a concern
I've chosen the name "Globalizable" because "Translatable" already
existed.
2018-10-22 16:28:53 +02:00
Javi Martín
3c170f47d2 Update site customization pages translatable fields 2018-10-22 16:13:48 +02:00
Papaya Labs
914bfa645e Updates translatable custom pages 2018-09-27 13:46:17 +02:00
María Checa
8894ec4f7c Pages form improvements
Added `locale` validation to model and improved its form select tag performance.
2017-07-02 21:28:13 +02:00
María Checa
ed7b7f0361 Added scope to pages model
New scope to use when listing pages to show only the ones with current locale.
2017-07-02 14:54:11 +02:00
Amaia Castro
ae3690ab5f Validate presence of page slug 2017-04-06 17:00:04 +02:00
Amaia Castro
54fab919e5 Show custom pages in public site 2017-04-06 16:59:58 +02:00
Amaia Castro
255b57cc85 Admin for custom pages 2017-04-06 16:25:07 +02:00