Adding images and seeds for the homepage

This commit is contained in:
Pierre Mesure
2018-06-15 14:26:29 +02:00
parent a8178a6ca8
commit 1ebcf04186
7 changed files with 52 additions and 2 deletions

View File

@@ -33,5 +33,6 @@ require_relative 'dev_seeds/communities'
require_relative 'dev_seeds/legislation_processes' require_relative 'dev_seeds/legislation_processes'
require_relative 'dev_seeds/newsletters' require_relative 'dev_seeds/newsletters'
require_relative 'dev_seeds/notifications' require_relative 'dev_seeds/notifications'
require_relative 'dev_seeds/widgets'
log "All dev seeds created successfuly 👍" log "All dev seeds created successfuly 👍"

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

50
db/dev_seeds/widgets.rb Normal file
View File

@@ -0,0 +1,50 @@
section "Creating header and cards for the homepage" do
def create_image_attachment(type)
{
cached_attachment: Rails.root.join("db/dev_seeds/images/#{type}_background.jpg"),
title: "#{type}_background.jpg",
user: User.first
}
end
Widget::Card.create!(
title: 'CONSUL',
description: 'Free software for citizen participation.',
link_text: 'More information',
link_url: 'help_path',
label: 'Welcome to',
header: TRUE,
image_attributes: create_image_attachment('header')
)
Widget::Card.create!(
title: 'How do debates work?',
description: 'Anyone can open threads on any subject, creating separate spaces where people can discuss the proposed topic. Debates are valued by everybody, to highlight the most important issues.',
link_text: 'More about debates',
link_url: 'https://youtu.be/zU_0UN4VajY',
label: 'Debates',
header: FALSE,
image_attributes: create_image_attachment('debate')
)
Widget::Card.create!(
title: 'How do citizen proposals work?',
description: "A space for everyone to create a citizens' proposal and seek supports. Proposals which reach to enough supports will be voted and so, together we can decide the issues that matter to us.",
link_text: 'More about proposals',
link_url: 'https://youtu.be/ZHqBpT4uCoM',
label: 'Citizen proposals',
header: FALSE,
image_attributes: create_image_attachment('proposal')
)
Widget::Card.create!(
title: 'How do participatory budgets work?',
description: " Participatory budgets allow citizens to propose and decide directly how to spend part of the budget, with monitoring and rigorous evaluation of proposals by the institution. Maximum effectiveness and control with satisfaction for everyone.",
link_text: 'More about Participatory budgets',
link_url: 'https://youtu.be/igQ8KGZdk9c',
label: 'Participatory budgets',
header: FALSE,
image_attributes: create_image_attachment('budget')
)
end

View File

@@ -10,5 +10,4 @@ namespace :homepage do
Setting['feature.homepage.widgets.feeds.processes'] = true Setting['feature.homepage.widgets.feeds.processes'] = true
end end
end end
end end