diff options
Diffstat (limited to 'spec/dummy')
8 files changed, 47 insertions, 26 deletions
diff --git a/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb b/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb index c2dd42c..5061efa 100644 --- a/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb +++ b/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb @@ -4,7 +4,7 @@ class CreateRefinerycmsCoreSchema < ActiveRecord::Migration create_table ::Slug.table_name, :force => true do |t| t.string "name" t.integer "sluggable_id" - t.integer "sequence", :default => 1, :null => false + t.integer "sequence", :default => 1, :null => false t.string "sluggable_type", :limit => 40 t.string "scope", :limit => 40 t.datetime "created_at" diff --git a/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb b/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb index bdb0a43..1280e88 100644 --- a/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb +++ b/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb @@ -13,7 +13,9 @@ class TranslatePagePlugin < ActiveRecord::Migration :title => :string, :meta_keywords => :string, :meta_description => :text, - :browser_title => :string + :browser_title => :string, + :custom_slug => :string, + :menu_title => :string }, { :migrate_data => true }) diff --git a/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb b/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb index 2bcecc7..7d87d84 100644 --- a/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb +++ b/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb @@ -1,30 +1,30 @@ class TranslateCustomTitleOnPages < ActiveRecord::Migration def self.up - unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:custom_title) - add_column ::Refinery::Page.translation_class.table_name, :custom_title, :string + unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:menu_title) + add_column ::Refinery::Page.translation_class.table_name, :menu_title, :string - say_with_time("Re-save custom_title") do + say_with_time("Re-save menu_title") do ::Refinery::Page.all.each do |page| - say "updating custom_title field for page##{page.id}" - page.update_attribute(:custom_title, page.untranslated_attributes['custom_title']) + say "updating menu_title field for page##{page.id}" + page.update_attribute(:menu_title, page.untranslated_attributes['menu_title']) end end else - say "Nothing done, ::Refinery::Page.translation_class table already includes a custom_title field" + say "Nothing done, ::Refinery::Page.translation_class table already includes a menu_title field" end ::Refinery::Page.translation_class.reset_column_information end def self.down - say_with_time("Re-save custom_title") do + say_with_time("Re-save menu_title") do ::Refinery::Page.all.each do |page| - if page.attributes['custom_title'].nil? - say "Nothing done, page##{page.id} custom_title field is nil" + if page.attributes['menu_title'].nil? + say "Nothing done, page##{page.id} menu_title field is nil" else - say "updating custom_title field for page #{page.id}" + say "updating menu_title field for page #{page.id}" ::Refinery::Page.update_all({ - :custom_title => page.attributes['custom_title'] + :menu_title => page.attributes['menu_title'] }, { :id => page.id.to_s }) @@ -32,9 +32,9 @@ class TranslateCustomTitleOnPages < ActiveRecord::Migration end end - remove_column ::Refinery::Page.translation_class.table_name, :custom_title + remove_column ::Refinery::Page.translation_class.table_name, :menu_title - ::Refinery::Page.translated_attribute_names.delete(:custom_title) + ::Refinery::Page.translated_attribute_names.delete(:menu_title) ::Refinery::Page.translation_class.reset_column_information end diff --git a/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb b/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb new file mode 100644 index 0000000..2feb837 --- /dev/null +++ b/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb @@ -0,0 +1,11 @@ +class AddCustomSlugToRefineryPageTranslations < ActiveRecord::Migration + def up + if ::Refinery::Page::Translation.column_names.map(&:to_sym).exclude?(:custom_slug) + add_column ::Refinery::Page::Translation.table_name, :custom_slug, :string, :default => nil + end + end + + def down + remove_column ::Refinery::Page::Translation.table_name, :custom_slug + end +end diff --git a/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb b/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb new file mode 100644 index 0000000..0ce6cb2 --- /dev/null +++ b/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb @@ -0,0 +1,15 @@ +class RenameCustomTitleToMenuTitleInRefineryPages < ActiveRecord::Migration + def up + if ::Refinery::Page::Translation.column_names.map(&:to_sym).include?(:custom_title) + rename_column ::Refinery::Page::Translation.table_name, :custom_title, :menu_title + end + remove_column ::Refinery::Page.table_name, :custom_title_type + end + + def down + if ::Refinery::Page::Translation.column_names.map(&:to_sym).include?(:menu_title) + rename_column ::Refinery::Page::Translation.table_name, :menu_title, :custom_title + end + add_column ::Refinery::Page.table_name, :custom_title_type, :string + end +end diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index afb4ec6..f65cc81 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110803223529) do +ActiveRecord::Schema.define(:version => 20110812055013) do create_table "refinery_blog_categories", :force => true do |t| t.string "title" @@ -95,7 +95,8 @@ ActiveRecord::Schema.define(:version => 20110803223529) do t.integer "refinery_page_id" t.string "locale" t.string "title" - t.string "custom_title" + t.string "custom_slug" + t.string "menu_title" t.datetime "created_at" t.datetime "updated_at" end @@ -112,7 +113,7 @@ ActiveRecord::Schema.define(:version => 20110803223529) do t.string "link_url" t.string "menu_match" t.boolean "deletable", :default => true - t.string "custom_title_type", :default => "none" + t.string "custom_title" t.boolean "draft", :default => false t.boolean "skip_to_first_child", :default => false t.integer "lft" diff --git a/spec/dummy/db/seed/.gitkeep b/spec/dummy/db/seed/.gitkeep deleted file mode 100644 index e69de29..0000000 --- a/spec/dummy/db/seed/.gitkeep +++ /dev/null diff --git a/spec/dummy/db/seeds/pages.rb b/spec/dummy/db/seeds/pages.rb index 677f17d..62d4e8d 100644 --- a/spec/dummy/db/seeds/pages.rb +++ b/spec/dummy/db/seeds/pages.rb @@ -1,14 +1,6 @@ module Refinery ::Refinery::Page.reset_column_information - # Check whether all columns are applied yet by seo_meta. - unless !defined?(::SeoMeta) || ::SeoMeta.attributes.keys.all? { |k| - ::Refinery::Page.translation_class.instance_methods.include?(k) - } - # Make pages model seo_meta because not all columns are accessible. - ::Refinery::Page.translation_class.send :is_seo_meta - end - page_position = -1 unless ::Refinery::Page.where(:menu_match => "^/$").any? |