Modification of the page model

This commit is contained in:
chris2tof committed 2011-05-18 10:00:00 +08:00
1 parent 4399804e19
commit 3d97c5bfda
9 files changed
+71 -36

No files matched your search

+11 -3
View File
@@ -32,6 +32,8 @@ namespace :dev do
var_11 = I18nVariable.create!( :document_class => 'Page', :key => 'about', :en => 'About', :zh_tw => '關於我們' )
var_12 = I18nVariable.create!( :document_class => 'Link', :key => 'google', :en => 'Google', :zh_tw => 'Google' )
# TODO: modify for the new model
urm_1 = UserRoleModel.new( :key => 'teacher', :i18n_variable_id => var_1.id, :built_in => true )
urm_1.attribute_models.build( :key => 'discipline', :locale => true, :i18n_variable_id => var_2.id, :markup => 'text_field', :list_options => [], :built_in => true )
urm_1.attribute_models.build( :key => 'department', :locale => true, :i18n_variable_id => var_3.id, :markup => 'text_field', :list_options => [], :built_in => true )
@@ -45,11 +47,17 @@ namespace :dev do
uim_1.attribute_models.build( :key => 'first_name', :locale => true, :i18n_variable_id => var_9.id, :markup => 'text_field', :list_options => [], :built_in => true )
uim_1.save!
layout = Layout.create!( :name => 'root', :description => 'root', :content => File.open("#{RAILS_ROOT}/lib/template/root.layout").read )
home = Page.create!( :i18n_variable_id => var_10.id, :layout_id => layout.id, :name => 'home', :is_published => true, :content => File.open("#{RAILS_ROOT}/lib/template/root.home").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 => "<r:language_bar /><r:snippet name='nav' />" )
layout.layout_parts.create!( :name => 'main_content' )
layout.layout_parts.create!( :name => 'footer', :content => "<r:snippet name='footer' />" )
Page.create!( :i18n_variable_id => var_11.id, :layout_id => layout.id, :name => 'about', :is_published => true, :parent_id => home.id, :content => File.open("#{RAILS_ROOT}/lib/template/about.page").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 => "<r:locale en='This is the homepage' zh_tw='這是首頁' />" )
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 => "This is about" )
Link.create!( :i18n_variable_id => var_12.id, :name => 'google', :is_published => true, :parent_id => home.id, :url => 'www.google.com' )