mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Hexadecimal color changed to capital letters
The default colors in event_types and difficulty levels are in capital letters and the ones that comes from the color picker were not. Now colors are capitalized before saving the track, level or type. A rake task has also been created to capitalize color from old tracks, levels or types.
This commit is contained in:
parent
0deaf1abc7
commit
8d9bb56f06
11 changed files with 72 additions and 15 deletions
21
lib/tasks/capitalize_colors.rake
Normal file
21
lib/tasks/capitalize_colors.rake
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
namespace :data do
|
||||
desc 'Catitalize tracks, event types and difficult levels colors'
|
||||
|
||||
task capitalize_colors: :environment do
|
||||
capitalize_collection_colors(Track)
|
||||
puts "Tracks' colors capitalized"
|
||||
|
||||
capitalize_collection_colors(DifficultyLevel)
|
||||
puts "Difficulty levels' colors capitalized"
|
||||
|
||||
capitalize_collection_colors(EventType)
|
||||
puts "Event types' colors capitalized"
|
||||
end
|
||||
|
||||
def capitalize_collection_colors(model)
|
||||
model.all.each do |item|
|
||||
item.color = item.color.upcase
|
||||
item.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue