socialforge/lib/tasks/first_page.rake

26 lines
1.0 KiB
Ruby

# -*coding:utf-8 -*-
desc "First Page Initialize"
task :first_page do
puts "first_page sync."
end
namespace :first_page do
desc "initialize first page"
task :initialize => :environment do
first_page = FirstPage.where("page_type = 'project'").first
first_page.description = "<div style='margin-top: 3px;'><span style='font-weight: bold; font-size: 18px; color: #e8770d;display:inline-block; margin-top: 5px;'>micROS多态智能集群机器人操作系统 </span><br />
<span style='font-weight:bold; font-size:18px;color:#15bccf; display:inline-block;margin-top:5px;''>中国开源社区 </span></div>"
first_page.image_width = 107;
first_page.image_height = 63;
course_page = FirstPage.where("page_type = 'course'").first
course_page.image_width = 75
course_page.image_height = 75
contest_page = FirstPage.where("page_type = 'contest'").first
contest_page.image_width = 75
contest_page.image_height = 75
first_page.save
course_page.save
contest_page.save
puts "initialized Successfully"
end
end