Commit Graph

37 Commits

Author SHA1 Message Date
Javi Martín
701378d02c Add padding to the whole header
Instead of adding the padding to each individual element inside the
container, why not adding padding to the container itself? The answer is
"because we want the background of the children elements to take the
width of the whole screen". But this generates either HTML cluttered
with elements to add padding or repetitive padding definitions in the
CSS.

So now we only define the padding once, and when an element requires a
full width background or border, we use the `full-width-background`
mixin.

In this case the code is a bit more complex because the header is also
used in the dashboard and admin layouts:

* In the public layout, the body has a margin, so we include the mixin
  to take margin into account
* In the dashboard layout, the header itself has a margin, so we include
  the same mixin
* In the admin layout, the headet doesn't have a margin but gets the
  whole width, so in this case we include the mixin which dosen't take
  the margin into account

In the future, the idea is to apply this principle to the <body>
element and remove the `@include grid-column-gutter` in the CSS as well
as the `small-12 column` classes in the HTML.

Note we use the `calc()` function inside the mixin instead of using it
in the `$full-width-margin` variable. That way we avoid nested `calc()`
operations, which don't work in Internet Explorer.

Also note we're using `flex-grow: 1` to make one element appear on the
left of the screen and the other one on the right. It would be easier to
use `justify-content: space-between` (which is actually the default for
the top-bar element). However, there's a bug in Internet Explorer and
old versions of Firefox; they include the absolutely-positioned
`::before` element we use to set the full width background when
calculating where to position the elements. The bug was fixed in Firefox
52 (released in 2017).

Finally, we're removing the padding from our logo. In order to allow
logos like the new one and at the same time provide backwards
compatibility to logos in existing CONSUL installations, we're relaxing
the validation rule for the logo width.
2021-07-09 03:45:55 +02:00
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
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
9fe8c47528 Apply Rails/SafeNavigation rubocop rule 2019-09-10 21:43:39 +02:00
decabeza
43dd3d2169 Include mailer header logo on custom images list 2019-05-21 11:22:04 +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
Alberto
bd4826b25e Merge branch 'master' into add_cards_to_custom_pages 2019-01-28 14:49:39 +01:00
decabeza
045c4eca64 Allow change map image from admin site customization
Also adds on site customization image.rb jpeg content type to allow replace this image.
2019-01-24 14:55:01 +01:00
Manu
5627d2cf23 added associations between cards and pages models 2019-01-18 09:54:43 -05:00
Raimond Garcia
e23fbc8d58 Merge pull request #2970 from PierreMesure/Remove-icon-png-from-settings
Removed icon_home and fixed corresponding test
2018-11-27 11:11:51 +01:00
Angel Perez
3574bf867c Add default image for investments without picture 2018-11-05 18:04:38 +01:00
decabeza
884580206a Fixes houndci-bot warnings 2018-10-31 14:22:10 +01: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
Pierre Mesure
f586190651 Removed icon_home and fixed corresponding test 2018-10-12 09:52:53 +02:00
Papaya Labs
914bfa645e Updates translatable custom pages 2018-09-27 13:46:17 +02:00
Alberto
21f36e6be5 Merge branch 'master' into feature/1-nav-content-blocks 2018-09-05 12:41:07 +02:00
decabeza
c15769ba48 Updates logo header sizes and images for specs 2018-07-30 19:55:43 +02:00
Ziyan Junaideen
a6bbf32b8e Content blocks - new keys 2018-07-26 22:55:49 +05:30
Ziyan Junaideen
5b6a6b5324 Changed keys for locations 2018-07-26 22:55:49 +05:30
Ziyan Junaideen
1c818850d2 Content blocks for navigation 2018-07-26 22:55:49 +05:30
decabeza
2844c03e43 adds consistency on social media filenames 2017-07-18 11:40:19 +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
Bertocq
21c6d1c4dd Cleanup Lint/AssignmentInCondition rubocop issues on code and remove it from ruboco_todo list 2017-06-19 10:45:18 +02:00
Bertocq
02524b164a Rubocop autocorrections (indentations, revers unless to if, extra spaces) 2017-06-08 12:14:35 +02:00
Amaia Castro
c1de2dced4 Custom content blocks for top_links and footer 2017-04-06 17:00:05 +02:00
Amaia Castro
ae3690ab5f Validate presence of page slug 2017-04-06 17:00:04 +02:00
Amaia Castro
8143fe1037 Site customization: images uploads 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