diff --git a/.gitignore b/.gitignore index 4f354245..2e21b80c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .bundle +Gemfile.lock db/*.sqlite3 log/*.log tmp/**/* diff --git a/Gemfile b/Gemfile index 69ba8ae5..5d4587b4 100644 --- a/Gemfile +++ b/Gemfile @@ -2,12 +2,13 @@ source 'http://gemcutter.org' source 'http://gems.github.com' -gem 'rails', '3.0.0.beta3' +gem 'rails', '3.0.0.beta4' gem 'liquid', '2.0.0' gem 'bson_ext', '>= 1.0.1' gem 'mongo_ext' -gem 'mongoid', '2.0.0.beta6' +# gem 'mongoid', :git => 'git@github.com:did/mongoid.git' +gem 'mongoid-locomotive' gem 'mongoid_acts_as_tree', '0.1.5' gem 'mongo_session_store', '2.0.0.pre' gem 'warden' @@ -15,7 +16,6 @@ gem 'devise', '1.1.rc1' gem 'haml', '3.0.1' gem 'rmagick', '2.12.2' gem 'aws' -gem 'jeweler' gem 'mimetype-fu', :require => 'mimetype_fu' gem 'formtastic-rails3', :require => 'formtastic' gem 'carrierwave-rails3', :require => 'carrierwave' @@ -24,6 +24,7 @@ gem 'heroku' gem 'httparty', '0.6.0' gem 'RedCloth' gem 'inherited_resources', '1.1.2' +gem 'jeweler' # Development environment group :development do @@ -36,7 +37,7 @@ end group :test do gem 'rspec-rails', '2.0.0.beta.11' - gem 'factory_girl', :git => 'git://github.com/thoughtbot/factory_girl.git', :branch => 'rails3' + gem 'factory_girl_rails' gem 'capybara' gem 'cucumber' gem 'cucumber-rails' diff --git a/Rakefile b/Rakefile index 6d98dcbc..b22574f1 100644 --- a/Rakefile +++ b/Rakefile @@ -28,7 +28,7 @@ begin "{vendor}/**/*"] # other fields that would normally go in your gemspec # like authors, email and has_rdoc can also be included here - bundle = Bundler::Definition.from_gemfile('Gemfile') + bundle = Bundler::Definition.build('Gemfile', 'Gemfile.lock', false) bundle.dependencies.each do |dep| if dep.groups.include?(:default) gem.add_dependency(dep.name, dep.requirement.to_s) @@ -36,7 +36,7 @@ begin end end Jeweler::GemcutterTasks.new -rescue - puts "Jeweler or one of its dependencies is not installed." +rescue Exception => e + puts "Jeweler or one of its dependencies is not installed. #{e.inspect}" end diff --git a/app/models/asset_collection.rb b/app/models/asset_collection.rb index 0d744bcc..ca0bc48d 100644 --- a/app/models/asset_collection.rb +++ b/app/models/asset_collection.rb @@ -15,7 +15,7 @@ class AssetCollection liquid_methods :name, :ordered_assets ## callbacks ## - before_validate :normalize_slug + before_validation :normalize_slug before_save :store_asset_positions! ## validations ## diff --git a/app/models/content_type.rb b/app/models/content_type.rb index 3672db2a..ded3fbdd 100644 --- a/app/models/content_type.rb +++ b/app/models/content_type.rb @@ -20,7 +20,7 @@ class ContentType end ## callbacks ## - before_validate :normalize_slug + before_validation :normalize_slug before_save :set_default_values ## validations ## diff --git a/app/models/extensions/page/templatized.rb b/app/models/extensions/page/templatized.rb index b5a181cf..57906454 100644 --- a/app/models/extensions/page/templatized.rb +++ b/app/models/extensions/page/templatized.rb @@ -13,7 +13,7 @@ module Models field :content_type_visible_column - before_validate :set_slug_if_templatized + before_validation :set_slug_if_templatized end module InstanceMethods diff --git a/app/models/extensions/page/tree.rb b/app/models/extensions/page/tree.rb index 60e90a29..4a6fc54c 100644 --- a/app/models/extensions/page/tree.rb +++ b/app/models/extensions/page/tree.rb @@ -15,7 +15,7 @@ module Models acts_as_tree :order => ['position', 'asc'] ## callbacks ## - before_validate :reset_parent + before_validation :reset_parent before_save { |p| p.send(:write_attribute, :parent_id, nil) if p.parent_id.blank? } before_save :change_parent before_create { |p| p.send(:fix_position, false) } diff --git a/app/models/liquid_template.rb b/app/models/liquid_template.rb index 3568bb6f..ca234981 100644 --- a/app/models/liquid_template.rb +++ b/app/models/liquid_template.rb @@ -11,7 +11,7 @@ class LiquidTemplate belongs_to_related :site ## callbacks ## - before_validate :normalize_slug + before_validation :normalize_slug ## validations ## validates_presence_of :site, :name, :slug, :value diff --git a/app/models/page.rb b/app/models/page.rb index 8dced9d8..038ec064 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -21,7 +21,7 @@ class Page embeds_many :parts, :class_name => 'PagePart' ## callbacks ## - before_validate :normalize_slug + before_validation :normalize_slug before_save { |p| p.fullpath = p.fullpath(true) } before_destroy :do_not_remove_index_and_404_pages diff --git a/app/models/theme_asset.rb b/app/models/theme_asset.rb index d5ed29de..670e87b5 100644 --- a/app/models/theme_asset.rb +++ b/app/models/theme_asset.rb @@ -17,8 +17,8 @@ class ThemeAsset belongs_to_related :site ## callbacks ## - before_validate :sanitize_slug - before_validate :store_plain_text + before_validation :sanitize_slug + before_validation :store_plain_text before_save :set_slug ## validations ## diff --git a/app/views/admin/shared/_footer.html.haml b/app/views/admin/shared/_footer.html.haml index 859c6d13..8aabc5a5 100644 --- a/app/views/admin/shared/_footer.html.haml +++ b/app/views/admin/shared/_footer.html.haml @@ -1,2 +1,2 @@ %p.tcenter - = t('.who_is_behind', :development => nocoffee_tag) + = preserve(t('.who_is_behind', :development => nocoffee_tag)) diff --git a/app/views/admin/shared/_header.html.haml b/app/views/admin/shared/_header.html.haml index 5fd976d0..7badb10e 100644 --- a/app/views/admin/shared/_header.html.haml +++ b/app/views/admin/shared/_header.html.haml @@ -1,7 +1,7 @@ %h1= link_to current_site.name, '#' #global-actions-bar - = t('.welcome', :name => link_to(current_admin.name, edit_admin_my_account_url)) + = preserve(t('.welcome', :name => link_to(current_admin.name, edit_admin_my_account_url))) %span= '|' = link_to t('.see'), main_site_url %span= '|' diff --git a/config/locales/admin_ui_en.yml b/config/locales/admin_ui_en.yml index 307c1419..718fa150 100644 --- a/config/locales/admin_ui_en.yml +++ b/config/locales/admin_ui_en.yml @@ -11,7 +11,7 @@ en: shared: header: - welcome: Welcome, {{name}} + welcome: Welcome, %{name} see: See website logout: Log out menu: @@ -25,7 +25,7 @@ en: site: Site theme_assets: Theme files footer: - who_is_behind: "Service developed by {{development}} and designed by Sacha Greif" + who_is_behind: "Service developed by %{development} and designed by Sacha Greif" form_actions: back: Back without saving create: Create @@ -76,7 +76,7 @@ en: index: title: Listing pages help: "Pages are organized as a tree. You can order pages as well as folders" - no_items: "There are no pages for now. Just click here to create the first one." + no_items: "There are no pages for now. Just click here to create the first one." new: new page lastest_items: Lastest pages new: @@ -101,7 +101,7 @@ en: index: title: Listing layouts help: "Layouts give the look of a page (1, 2 or many columns)." - no_items: "There are no layouts for now. Just click here to create the first one." + no_items: "There are no layouts for now. Just click here to create the first one." new: new layout new: title: New layout @@ -117,7 +117,7 @@ en: index: title: Listing snippets help: "Snippets are portion of HTML code which can be found at different places within the site (such as a footer)." - no_items: "There are no snippets for now. Just click here to create the first one." + no_items: "There are no snippets for now. Just click here to create the first one." new: new snippet new: title: New snippet @@ -166,13 +166,13 @@ en: fonts: Fonts images: Images flashes: Flash - no_items: "There are no files for now. Just click here to create the first one." + no_items: "There are no files for now. Just click here to create the first one." new: title: New file help: "You have the choice to either upload any file or to copy/paste a stylesheet or a javascript in plain text." edit: - title: "Editing {{file}}" - help: "You can use it by copying/pasting the following url: {{url}}" + title: "Editing %{file}" + help: "You can use it by copying/pasting the following url: %{url}" form: picker_link: Insert a file into the code choose_file: Choose file @@ -186,7 +186,7 @@ en: title: Asset collections help: "The collection name can be updated by clicking it. You can customize assets in a collection by adding new fields." new: new collection - no_items: "There are no collections for now. Just click here to create the first one." + no_items: "There are no collections for now. Just click here to create the first one." new: title: New collection help: "For now, just type a name. Other settings will come once the form is sent." @@ -194,7 +194,7 @@ en: help: "The collection name can be updated by clicking it. You can customize assets in a collection by adding new fields." add_asset: add asset destroy: remove collection - no_items: "There are no assets for now. Just click here to create the first one." + no_items: "There are no assets for now. Just click here to create the first one." ask_for_name: "Please type the new name" assets: @@ -223,7 +223,7 @@ en: contents: index: - title: 'Listing "{{type}}"' + title: 'Listing "%{type}"' edit: edit model destroy: remove model download: download items @@ -232,11 +232,11 @@ en: lastest_items: "Lastest items" updated_at: "Updated at" list: - no_items: "There are no items for now. Just click here to create the first one." + no_items: "There are no items for now. Just click here to create the first one." new: - title: '{{type}} — new item' + title: '%{type} — new item' edit: - title: '{{type}} — editing item' + title: '%{type} — editing item' image_picker: link: Insert an image into the code diff --git a/config/locales/admin_ui_fr.yml b/config/locales/admin_ui_fr.yml index 04ab34e9..54e6a9f4 100644 --- a/config/locales/admin_ui_fr.yml +++ b/config/locales/admin_ui_fr.yml @@ -33,7 +33,7 @@ fr: shared: header: - welcome: Bonjour, {{name}} + welcome: Bonjour, %{name} see: Voir le site web logout: Se déconnecter menu: @@ -47,7 +47,7 @@ fr: site: Site theme_assets: Fichiers Thème footer: - who_is_behind: "Service développé par {{development}} et désigné par Sacha Greif" + who_is_behind: "Service développé par %{development} et désigné par Sacha Greif" form_actions: back: Retour sans sauvegarder create: Créer @@ -98,7 +98,7 @@ fr: index: title: Liste des pages help: "Les pages sont organisées sous forme d'un arbre. Vous pouvez classes les pages ainsi que les dossiers." - no_items: "Il n'existe pas de page. Vous pouvez commencer par créer une ici." + no_items: "Il n'existe pas de page. Vous pouvez commencer par créer une ici." new: nouvelle page lastest_items: Dernières pages new: @@ -123,7 +123,7 @@ fr: index: title: Liste gabarits help: "Les gabarits permettent de définir le squelette d'une page (1, 2 ou plusieurs colonnes)." - no_items: "Il n'existe pas de gabarit. Vous pouvez commencer par créer un ici." + no_items: "Il n'existe pas de gabarit. Vous pouvez commencer par créer un ici." new: nouveau gabarit new: title: Nouveau gabarit @@ -139,7 +139,7 @@ fr: index: title: Liste des snippets help: "Les snippets sont des bouts de code HTML qui se répetent à travers le site (tel que le bas-de-page par exemple)." - no_items: "Il n'existe pas de snippet. Vous pouvez commencer par créer un ici." + no_items: "Il n'existe pas de snippet. Vous pouvez commencer par créer un ici." new: nouveau snippet new: title: "Nouveau snippet" @@ -188,13 +188,13 @@ fr: images: Images flashes: Flash fonts: Polices - no_items: "Il n'existe pas de fichiers. Vous pouvez commencer par créer un ici." + no_items: "Il n'existe pas de fichiers. Vous pouvez commencer par créer un ici." new: title: Nouveau fichier help: "Vous avez le choix de soit uploader n'importe quel fichier ou bien soit de copier/coller du code css ou javascript." edit: - title: "Edition {{file}}" - help: "Vous pouvez utiliser ce fichier grâce a l'url suivante: {{url}}" + title: "Edition %{file}" + help: "Vous pouvez utiliser ce fichier grâce a l'url suivante: %{url}" form: choose_file: Choisir fichier choose_plain_text: Passer en mode texte @@ -207,7 +207,7 @@ fr: title: Collections help: "Le nom de la collection est modifiable en cliquant dessus. Vous pouvez personnaliser une collection en ajoutant d'autres champs à vos médias." new: nouvelle collection - no_items: "Il n'existe pas de collections. Vous pouvez commencer par créer une ici." + no_items: "Il n'existe pas de collections. Vous pouvez commencer par créer une ici." new: title: Nouvelle collection help: "Pour le moment, veuillez rentrer le nom. Les autres options viendront dans le formulaire suivant." @@ -215,7 +215,7 @@ fr: help: "Le nom de la collection est modifiable en cliquant dessus. Vous pouvez personnaliser une collection en ajoutant d'autres champs à vos médias." add_asset: ajouter média destroy: supprimer collection - no_items: "Il n'existe pas de médias. Vous pouvez commencer par créer un ici." + no_items: "Il n'existe pas de médias. Vous pouvez commencer par créer un ici." ask_for_name: "Veuillez entrer le nouveau nom" assets: @@ -244,7 +244,7 @@ fr: contents: index: - title: 'Liste des "{{type}}"' + title: 'Liste des "%{type}"' edit: éditer modèle destroy: supprimer modèle download: télécharger éléments @@ -253,11 +253,11 @@ fr: lastest_items: "Eléments récents" updated_at: "Mis à jour le" list: - no_items: "Il n'existe pas d'éléments. Vous pouvez commencer par créer un ici" + no_items: "Il n'existe pas d'éléments. Vous pouvez commencer par créer un ici" new: - title: '{{type}} — nouvel élément' + title: '%{type} — nouvel élément' edit: - title: '{{type}} — édition élément' + title: '%{type} — édition élément' image_picker: link: Insérer une image dans le code diff --git a/config/locales/default_en.yml b/config/locales/default_en.yml index 0a3057dd..4fe91408 100644 --- a/config/locales/default_en.yml +++ b/config/locales/default_en.yml @@ -5,13 +5,13 @@ en: errors: messages: - domain_taken: "{{value}} is already taken" - invalid_domain: "{{value}} is invalid" + domain_taken: "%{value} is already taken" + invalid_domain: "%{value} is invalid" missing_content_for_layout: "should contain 'content_for_layout' liquid tag" needs_admin_account: "One admin account is required at least" protected_page: "You can not remove index or 404 pages" extname_changed: "New file does not have the original extension" - array_too_short: "is too small (minimum element number is {{count}})" + array_too_short: "is too small (minimum element number is %{count})" liquid_syntax_error: "Syntax error in page parts, please check the syntax" attributes: diff --git a/config/locales/default_fr.yml b/config/locales/default_fr.yml index 36486c2e..f7586537 100644 --- a/config/locales/default_fr.yml +++ b/config/locales/default_fr.yml @@ -1,7 +1,7 @@ fr: errors: # The default format use in full error messages. - format: "{{attribute}} {{message}}" + format: "%{attribute} %{message}" # The values :model, :attribute and :value are always available for interpolation # The value :count is available when applicable. Can be used for pluralization. @@ -13,26 +13,26 @@ fr: accepted: "doit être accepté(e)" empty: "doit être rempli(e)" blank: "doit être rempli(e)" - too_long: "est trop long (pas plus de {{count}} caractères)" - too_short: "est trop court (au moins {{count}} caractères)" - wrong_length: "ne fait pas la bonne longueur (doit comporter {{count}} caractères)" + too_long: "est trop long (pas plus de %{count} caractères)" + too_short: "est trop court (au moins %{count} caractères)" + wrong_length: "ne fait pas la bonne longueur (doit comporter %{count} caractères)" taken: "n'est pas disponible" not_a_number: "n'est pas un nombre" - greater_than: "doit être supérieur à {{count}}" - greater_than_or_equal_to: "doit être supérieur ou égal à {{count}}" - equal_to: "doit être égal à {{count}}" - less_than: "doit être inférieur à {{count}}" - less_than_or_equal_to: "doit être inférieur ou égal à {{count}}" + greater_than: "doit être supérieur à %{count}" + greater_than_or_equal_to: "doit être supérieur ou égal à %{count}" + equal_to: "doit être égal à %{count}" + less_than: "doit être inférieur à %{count}" + less_than_or_equal_to: "doit être inférieur ou égal à %{count}" odd: "doit être impair" even: "doit être pair" - domain_taken: "{{value}} a été déjà pris" - invalid_domain: "{{value}} n'est pas valide" + domain_taken: "%{value} a été déjà pris" + invalid_domain: "%{value} n'est pas valide" missing_content_for_layout: "doit contenir le tag liquid 'content_for_layout'" needs_admin_account: "Un minimum d'un scompte admin est requis" protected_page: "Vous ne pouvez pas supprimer les pages index et 404" extname_changed: "Nouveau fichier n'a pas l'extension original" - array_too_short: "est trop petit (le nombre minimum d'éléments est {{count}})" + array_too_short: "est trop petit (le nombre minimum d'éléments est %{count})" liquid_syntax_error: "Erreur de syntaxe dans les sections de page, veuillez vérifier la syntaxe" attributes: @@ -133,35 +133,35 @@ fr: less_than_x_seconds: zero: "moins d'une seconde" one: "moins de 1 seconde" - other: "moins de {{count}} secondes" + other: "moins de %{count} secondes" x_seconds: one: "1 seconde" - other: "{{count}} secondes" + other: "%{count} secondes" less_than_x_minutes: zero: "moins d'une minute" one: "moins de 1 minute" - other: "moins de {{count}} minutes" + other: "moins de %{count} minutes" x_minutes: one: "1 minute" - other: "{{count}} minutes" + other: "%{count} minutes" about_x_hours: one: "environ une heure" - other: "environ {{count}} heures" + other: "environ %{count} heures" x_days: one: "1 jour" - other: "{{count}} jours" + other: "%{count} jours" about_x_months: one: "environ un mois" - other: "environ {{count}} mois" + other: "environ %{count} mois" x_months: one: "1 mois" - other: "{{count}} mois" + other: "%{count} mois" about_x_years: one: "environ un an" - other: "environ {{count}} ans" + other: "environ %{count} ans" over_x_years: one: "plus d'un an" - other: "plus de {{count}} ans" + other: "plus de %{count} ans" prompts: year: "Année" month: "Mois" diff --git a/doc/TODO b/doc/TODO index bd2a89c8..d8cb7b6d 100644 --- a/doc/TODO +++ b/doc/TODO @@ -27,6 +27,7 @@ NICE TO HAVE: - asset picker (content instance) - page with regexp url ? - page redirection (option) +- automatic update ! DONE: diff --git a/features/support/env.rb b/features/support/env.rb index d1af0cec..9c0315ed 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -34,7 +34,6 @@ Capybara.default_selector = :css ActionController::Base.allow_rescue = false require 'factory_girl' -require 'spec/factories' Before do Mongoid.master.collections.select { |c| c.name != 'system.indexes' }.each(&:drop) diff --git a/lib/locomotive/liquid/liquify_template.rb b/lib/locomotive/liquid/liquify_template.rb index ec9dfc44..b2434f25 100644 --- a/lib/locomotive/liquid/liquify_template.rb +++ b/lib/locomotive/liquid/liquify_template.rb @@ -21,7 +21,7 @@ module Locomotive def liquify_template(source = :value) field :serialized_template, :type => Binary - before_validate :store_template + before_validation :store_template class_eval <<-EOV def liquify_template_source diff --git a/lib/locomotive/mongoid/patches.rb b/lib/locomotive/mongoid/patches.rb index 354ab56d..d89338a6 100644 --- a/lib/locomotive/mongoid/patches.rb +++ b/lib/locomotive/mongoid/patches.rb @@ -2,67 +2,16 @@ require 'mongoid' ## various patches module Mongoid #:nodoc: - - # Enabling scope in validates_uniqueness_of validation - module Validations #:nodoc: - class UniquenessValidator < ActiveModel::EachValidator - def validate_each(document, attribute, value) - conditions = { attribute => value, :_id.ne => document._id } - - if options.has_key?(:scope) && !options[:scope].nil? - [*options[:scope]].each do |scoped_attr| - conditions[scoped_attr] = document.attributes[scoped_attr] - end - end - - return if document.class.where(conditions).empty? - - document.errors.add(attribute, :taken, :default => options[:message], :value => value) - end - end - end - - # FIX BUG #71 http://github.com/durran/mongoid/commit/47a97094b32448aa09965c854a24c78803c7f42e - module Associations - module InstanceMethods - def update_embedded(name) - association = send(name) - association.to_a.each { |doc| doc.save if doc.changed? || doc.new_record? } unless association.blank? - end - end - class EmbedsMany < Proxy - - def nested_build(attributes, options = {}) - deleted_indexes = [] - attributes.each do |index, attrs| - if document = detect { |document| document._index == index.to_i } - if options && options[:allow_destroy] && attrs['_destroy'] - deleted_indexes << document._index - @target.delete(document) - document.destroy - else - document.write_attributes(attrs) - document._index = index.to_i - deleted_indexes.collect { |i| i < index.to_i }.size - end - else - build(attrs) - end - end - end - - end - end - - # FIX BUG about accepts_nested_attributes_for module Document - module InstanceMethods - def remove(child) - name = child.association_name - @attributes.remove(name, child.raw_attributes) - end + + def update_child_with_noname(child, clear = false) + name = child.association_name + return if name.blank? # fix a weird bug with mongoid-acts-as-tree + update_child_without_noname(child, clear) end + + alias_method_chain :update_child, :noname + end - - end \ No newline at end of file diff --git a/spec/models/asset_collections_spec.rb b/spec/models/asset_collections_spec.rb index e5c77790..66d038fb 100644 --- a/spec/models/asset_collections_spec.rb +++ b/spec/models/asset_collections_spec.rb @@ -15,7 +15,7 @@ describe AssetCollection do @collection = Factory.build(:asset_collection, :site => site) @collection.asset_custom_fields.build :label => 'My Description', :_alias => 'description', :kind => 'Text' @collection.asset_custom_fields.build :label => 'Active', :kind => 'Boolean' - # AssetCollection.collection.logger = Logger.new($stdout) + # AssetCollection.logger = Logger.new($stdout) # AssetCollection.db.connection.instance_variable_set(:@logger, Logger.new($stdout)) end @@ -143,7 +143,7 @@ describe AssetCollection do context 'managing from hash' do - it 'should add new field' do + it 'adds new field' do @collection.asset_custom_fields.clear @collection.asset_custom_fields.build :label => 'Title' @collection.asset_custom_fields_attributes = { '0' => { 'label' => 'A title', 'kind' => 'String' }, '-1' => { 'label' => 'Tagline', 'kind' => 'String' } } @@ -152,12 +152,12 @@ describe AssetCollection do @collection.asset_custom_fields.last.label.should == 'Tagline' end - it 'should update/remove fields' do + it 'updates/removes fields' do @collection.asset_custom_fields.build :label => 'Title', :kind => 'String' @collection.save; @collection = AssetCollection.first @collection.update_attributes(:asset_custom_fields_attributes => { - '0' => { 'label' => 'My Description', 'kind' => 'Text', '_destroy' => "1" }, - '1' => { 'label' => 'Active', 'kind' => 'Boolean', '_destroy' => "0" }, + '0' => { 'label' => 'My Description', 'kind' => 'Text', '_destroy' => '1' }, + '1' => { 'label' => 'Active', 'kind' => 'Boolean', '_destroy' => '0' }, '2' => { 'label' => 'My Title !', 'kind' => 'String' }, 'new_record' => { 'label' => 'Published at', 'kind' => 'String' } }) diff --git a/spec/models/layout_spec.rb b/spec/models/layout_spec.rb index 379e21e5..96846686 100644 --- a/spec/models/layout_spec.rb +++ b/spec/models/layout_spec.rb @@ -22,7 +22,7 @@ describe Layout do it 'should have 2 parts' do @layout.send(:build_parts_from_value) - @layout.parts.count.should == 2 + @layout.parts.size.should == 2 @layout.parts.first.name.should == 'Body' @layout.parts.first.slug.should == 'layout' @@ -38,7 +38,7 @@ describe Layout do @layout.pages << page @layout.save end - + it 'should add parts to pages if layout changes' do @layout.value = @layout.value + "..." page = Factory.build(:page, :layout => @layout, :site => nil) diff --git a/vendor/plugins/custom_fields/Gemfile b/vendor/plugins/custom_fields/Gemfile index 25c71c3d..496122ec 100644 --- a/vendor/plugins/custom_fields/Gemfile +++ b/vendor/plugins/custom_fields/Gemfile @@ -2,8 +2,8 @@ source 'http://gemcutter.org' gem 'bson_ext', '>= 1.0.1' gem 'mongo_ext' -gem 'mongoid', '2.0.0.beta6' -gem 'activesupport', '3.0.0.beta3' +gem 'mongoid-locomotive' +gem 'activesupport', '~>3.0.0.beta' gem 'carrierwave-rails3', :require => 'carrierwave' group :test do diff --git a/vendor/plugins/custom_fields/lib/custom_fields.rb b/vendor/plugins/custom_fields/lib/custom_fields.rb index ae7d5480..b895326e 100644 --- a/vendor/plugins/custom_fields/lib/custom_fields.rb +++ b/vendor/plugins/custom_fields/lib/custom_fields.rb @@ -3,9 +3,9 @@ $:.unshift File.expand_path(File.dirname(__FILE__)) require 'active_support' require 'carrierwave/orm/mongoid' -require 'custom_fields/extensions/mongoid/document' +require 'custom_fields/extensions/mongoid/hierarchy' require 'custom_fields/extensions/mongoid/associations/proxy' -require 'custom_fields/extensions/mongoid/associations/has_many_related' +require 'custom_fields/extensions/mongoid/associations/references_many' require 'custom_fields/extensions/mongoid/associations/embeds_many' require 'custom_fields/types/default' require 'custom_fields/types/string' diff --git a/vendor/plugins/custom_fields/lib/custom_fields/custom_fields_for.rb b/vendor/plugins/custom_fields/lib/custom_fields/custom_fields_for.rb index 1d9e9fbb..0fe1f5a5 100644 --- a/vendor/plugins/custom_fields/lib/custom_fields/custom_fields_for.rb +++ b/vendor/plugins/custom_fields/lib/custom_fields/custom_fields_for.rb @@ -20,7 +20,7 @@ module CustomFields # # company.employee_custom_fields.build :label => 'His/her position', :_alias => 'position', :kind => 'String' # - # company.employees.build :name => 'Mickael Scott', :position => 'Regional manager' + # company.employees.build :name => 'Michael Scott', :position => 'Regional manager' # module ClassMethods diff --git a/vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/associations/has_many_related.rb b/vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/associations/references_many.rb similarity index 97% rename from vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/associations/has_many_related.rb rename to vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/associations/references_many.rb index d1bc92b9..fb18741a 100644 --- a/vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/associations/has_many_related.rb +++ b/vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/associations/references_many.rb @@ -3,7 +3,7 @@ module Mongoid #:nodoc: module Associations #:nodoc: # Represents an relational one-to-many association with an object in a # separate collection or database. - class HasManyRelated < Proxy + class ReferencesMany < Proxy def initialize_with_custom_fields(parent, options, target_array = nil) if custom_fields?(parent, options.name) diff --git a/vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/document.rb b/vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/hierarchy.rb similarity index 94% rename from vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/document.rb rename to vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/hierarchy.rb index fa36af2b..9ddc9dc8 100644 --- a/vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/document.rb +++ b/vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/hierarchy.rb @@ -1,6 +1,6 @@ # encoding: utf-8 -module Mongoid #:nodoc: - module Document +module Mongoid #:nodoc + module Hierarchy #:nodoc module InstanceMethods def parentize_with_custom_fields(object, association_name) diff --git a/vendor/plugins/custom_fields/spec/unit/custom_fields_for_spec.rb b/vendor/plugins/custom_fields/spec/unit/custom_fields_for_spec.rb index 29338785..31135dd3 100644 --- a/vendor/plugins/custom_fields/spec/unit/custom_fields_for_spec.rb +++ b/vendor/plugins/custom_fields/spec/unit/custom_fields_for_spec.rb @@ -30,7 +30,7 @@ describe CustomFields::CustomFieldsFor do before(:each) do @project = Project.new end - + it 'has custom fields for embedded collection' do @project.respond_to?(:task_custom_fields).should be_true end @@ -87,7 +87,7 @@ describe CustomFields::CustomFieldsFor do end it 'returns a new document whose Class is different from the original one' do - @person.class.should_not == Task + @person.class.should_not == Person end it 'returns a new document with custom field' do