Some institutions using CONSUL have expressed interest in this feature since some of their tenants might already have their own domains. We've considered many options for the user interface to select whether we're using a subdomain or a domain, like having two separate fields, using a check box, ... In the end we've chosen radio buttons because they make it easier to follow a logical sequence: first you decide whether you're introducing a domain or subdomain, and then you enter it. We've also considered hiding this option and assuming "if it's got a dot, it's a domain". However, this wouldn't work with nested subdomains and it wouldn't work with domains which are simply machine names. Note that a group of radio buttons (or check boxes) is difficult to style when the text of the label might expand over more than one line (as is the case here on small screens); in this case, most solutions result in the second line of the label appearing immediately under the radio button, instead of being aligned with the first line of the label. That's why I've added a container for the input+label combination.
111 lines
2.7 KiB
Ruby
111 lines
2.7 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 { Rack::Test::UploadedFile.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"
|
|
|
|
factory :i18n_content, class: "I18nContent" do
|
|
key { "debates.index.section_footer.description" }
|
|
value_es { "Texto en español" }
|
|
value_en { "Text in english" }
|
|
end
|
|
|
|
factory :tenant do
|
|
sequence(:name) { |n| "Tenant #{n}" }
|
|
sequence(:schema) { |n| "subdomain#{n}" }
|
|
|
|
trait :domain do
|
|
schema_type { :domain }
|
|
end
|
|
end
|
|
end
|