* Delete all things related to banner images and styles (in code) * Add a new test to check that the banner is showing correctly * Update the specs accordingly to match the changes Update dev_seed to set a random background_color and a font_color for banners (and remove everything about image and style) Add a rake task to migrate the banner style to backgroun_color and font_color (so that the banners have the same colors than before)
21 lines
523 B
Ruby
21 lines
523 B
Ruby
namespace :banners do
|
|
|
|
desc "Migrate styles to background_color and font_color"
|
|
task migrate_style: :environment do
|
|
|
|
Banner.all.each do |banner|
|
|
banner.font_color = '#FFFFFF'
|
|
case banner.style
|
|
when "banner-style banner-style-one"
|
|
banner.background_color = '#004a83'
|
|
when "banner-style banner-style-two"
|
|
banner.background_color = '#7e328a'
|
|
when "banner-style banner-style-three"
|
|
banner.background_color = '#33dadf'
|
|
end
|
|
banner.save
|
|
end
|
|
end
|
|
|
|
end
|