Files
grecia/spec/factories/administration.rb
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

103 lines
2.6 KiB
Ruby

FactoryBot.define do
factory :setting do
sequence(:key) { |n| "Setting Key #{n}" }
sequence(:value) { |n| "Setting #{n} Value" }
end
factory :geozone do
sequence(:name) { |n| "District #{n}" }
sequence(:external_code, &:to_s)
sequence(:census_code, &:to_s)
trait :in_census do
census_code { "01" }
end
end
factory :banner do
sequence(:title) { |n| "Banner title #{n}" }
sequence(:description) { |n| "This is the text of Banner #{n}" }
target_url { ["/proposals", "/debates"].sample }
post_started_at { Date.current - 7.days }
post_ended_at { Date.current + 7.days }
background_color { "#FF0000" }
font_color { "#FFFFFF" }
end
factory :web_section do
name { "homepage" }
end
factory :banner_section, class: "Banner::Section" do
association :banner_id, factory: :banner
association :web_section, factory: :web_section
end
factory :site_customization_page, class: "SiteCustomization::Page" do
slug { "example-page" }
title { "Example page" }
subtitle { "About an example" }
content { "This page is about..." }
more_info_flag { false }
print_content_flag { false }
status { "draft" }
trait :published do
status { "published" }
end
trait :display_in_more_info do
more_info_flag { true }
end
end
factory :site_customization_content_block, class: "SiteCustomization::ContentBlock" do
name { "top_links" }
locale { "en" }
body { "Some top links content" }
end
factory :site_customization_image, class: "SiteCustomization::Image" do
image { File.new("spec/fixtures/files/logo_header.png") }
name { "logo_header" }
end
factory :map_location do
latitude { 51.48 }
longitude { 0.0 }
zoom { 10 }
trait :proposal_map_location do
proposal
end
trait :budget_investment_map_location do
association :investment, factory: :budget_investment
end
end
factory :widget_card, class: "Widget::Card" do
sequence(:title) { |n| "Title #{n}" }
sequence(:description) { |n| "Description #{n}" }
sequence(:link_text) { |n| "Link text #{n}" }
sequence(:link_url) { |n| "Link url #{n}" }
trait :header do
header { true }
end
after :create do |widget_card|
create(:image, imageable: widget_card)
end
end
factory :widget_feed, class: "Widget::Feed" do
end
factory :i18n_content, class: "I18nContent" do
key { "debates.index.section_footer.description" }
value_es { "Texto en español" }
value_en { "Text in english" }
end
end