Clean code for layout and modifications in dev.rake
This commit is contained in:
1 parent
e74f2931b1
commit
7a4ad240a8
22 files changed
+226
-159
No files matched your search
+42
-14
@@ -10,8 +10,8 @@ namespace :dev do
|
||||
puts 'Dropping ' + collection.name if include
|
||||
include
|
||||
end.each(&:drop)
|
||||
|
||||
Site.create!( :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ] )
|
||||
|
||||
Site.create( :school => 'The Best School', :department => 'Awesome', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
||||
|
||||
user = User.new( :email => 'chris@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :active_roles => ['teacher'])
|
||||
user.user_roles.build(:key => 'teacher', :discipline_en => 'Database', :discipline_zh_tw => '資料庫' )
|
||||
@@ -50,22 +50,50 @@ namespace :dev do
|
||||
uim_1.save!
|
||||
|
||||
|
||||
layout = Layout.create!( :name => 'root', :description => 'root', :content => File.open("#{Rails.root}/lib/template/root.layout").read )
|
||||
layout.layout_parts.create!( :name => 'header', :content => File.open("#{Rails.root}/lib/template/nav.snippet").read )
|
||||
layout.layout_parts.create!( :name => 'main_content', :editable => true )
|
||||
layout.layout_parts.create!( :name => 'footer', :content => File.open("#{Rails.root}/lib/template/footer.snippet").read )
|
||||
# layout = Layout.create!( :name => 'root', :description => 'root', :content => File.open("#{Rails.root}/lib/template/root.layout").read )
|
||||
# layout.layout_parts.create!( :name => 'header', :content => File.open("#{Rails.root}/lib/template/nav.snippet").read )
|
||||
# layout.layout_parts.create!( :name => 'main_content', :editable => true )
|
||||
# layout.layout_parts.create!( :name => 'footer', :content => File.open("#{Rails.root}/lib/template/footer.snippet").read )
|
||||
#
|
||||
# home = Page.create!( :i18n_variable_id => var_10.id, :layout_id => layout.id, :name => 'home', :is_published => true )
|
||||
# home.page_parts.create!( :name => 'main_content', :content => File.open("#{Rails.root}/lib/template/home.page").read, :kind => 'text', :i18n_variable_id => var_13.id )
|
||||
#
|
||||
# about = Page.create!( :i18n_variable_id => var_11.id, :layout_id => layout.id, :name => 'about', :is_published => true, :parent_id => home.id )
|
||||
# about.page_parts.create!( :name => 'main_content', :content => File.open("#{Rails.root}/lib/template/about.page").read, :kind => 'text', :i18n_variable_id => var_14.id )
|
||||
|
||||
home = Page.create!( :i18n_variable_id => var_10.id, :layout_id => layout.id, :name => 'home', :is_published => true )
|
||||
home.page_parts.create!( :name => 'main_content', :content => File.open("#{Rails.root}/lib/template/home.page").read, :kind => 'text', :i18n_variable_id => var_13.id )
|
||||
# Link.create!( :i18n_variable_id => var_12.id, :name => 'google', :is_published => true, :parent_id => home.id, :url => 'www.google.com' )
|
||||
#
|
||||
# ["nav", "footer"].each do |page_name|
|
||||
# Snippet.create!( :name => page_name, :parent_id => home.id, :content => File.open("#{Rails.root}/lib/template/#{page_name}.snippet").read )
|
||||
# end
|
||||
|
||||
about = Page.create!( :i18n_variable_id => var_11.id, :layout_id => layout.id, :name => 'about', :is_published => true, :parent_id => home.id )
|
||||
about.page_parts.create!( :name => 'main_content', :content => File.open("#{Rails.root}/lib/template/about.page").read, :kind => 'text', :i18n_variable_id => var_14.id )
|
||||
design = Design.new(:title => "Fraisier", :author => "Paul", :intro => "Strawberry cake")
|
||||
|
||||
Link.create!( :i18n_variable_id => var_12.id, :name => 'google', :is_published => true, :parent_id => home.id, :url => 'www.google.com' )
|
||||
design.structure_css = File.open("#{Rails.root}/lib/fraisier/structure.css")
|
||||
|
||||
["nav", "footer"].each do |page_name|
|
||||
Snippet.create!( :name => page_name, :parent_id => home.id, :content => File.open("#{Rails.root}/lib/template/#{page_name}.snippet").read )
|
||||
end
|
||||
# image = design.images.build(:file => File.open("#{Rails.root}/lib/fraisier/img/buttons.gif"))
|
||||
#
|
||||
# js = design.javascripts.build(:file => File.open("#{Rails.root}/lib/fraisier/inettuts.js"))
|
||||
#
|
||||
# theme = design.themes.build(:file => File.open("#{Rails.root}/lib/fraisier/inettuts.js.css"))
|
||||
|
||||
design.build_layout
|
||||
design.layout.file = File.open("#{Rails.root}/lib/fraisier/layout.html")
|
||||
|
||||
design.layout.save
|
||||
# theme.save
|
||||
# image.save
|
||||
# js.save
|
||||
|
||||
design.save
|
||||
|
||||
design.layout.layout_parts.create!( :name => 'header_1')
|
||||
design.layout.layout_parts.create!( :name => 'header_2')
|
||||
design.layout.layout_parts.create!( :name => 'block_1')
|
||||
design.layout.layout_parts.create!( :name => 'footer_1')
|
||||
|
||||
home = Page.create!( :i18n_variable_id => var_10.id, :design_id => design.id, :name => 'home', :is_published => true )
|
||||
home.page_parts.create!( :name => 'header_1', :kind => 'text')
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user