Commit Graph

73 Commits

Author SHA1 Message Date
Raúl Naveiras
db4b617697 add ignores comparator when at option is passed 2012-03-26 16:30:26 +02:00
Jeremy Ashkenas
7b6dbc8dcd Merge pull request #1021 from ahamid/reset_passes_options
small patch to allow passing options through reset to model initializer
2012-03-19 14:00:58 -07:00
Jeremy Ashkenas
de599c169d Fixes #991. Add Collection#where for simple filters 2012-03-19 16:34:53 -04:00
Brad Dunbar
9ffc84c9fe Fix #1112 - options.model sets collection.model. 2012-03-18 22:28:08 -04:00
Aidan Feldman
f49969014c clean up tests to use fresh object instances for each run, and don't set
globals within test files
2012-03-12 04:27:22 -04:00
Aaron Hamid
79045c11cb small patch to allow passing options through reset to model initializer 2012-02-17 04:03:30 -05:00
Jeremy Ashkenas
18fba57724 Much asked-for change. Instead of throwing an early error when adding duplicate models, Backbone will simply skip them instead. 2012-02-13 14:39:36 -05:00
Jeremy Ashkenas
2a92f71dcc Merge branch 'master' of github.com:documentcloud/backbone 2012-02-08 16:59:11 -05:00
Jeremy Ashkenas
e3ac6f8eaa Adding Collection#push, pop, shift, and unshift to the API, returning references to the model. Fixing a too-unescaped regex. 2012-02-08 16:58:37 -05:00
Brad Dunbar
522e090831 fixes #964 - collection.get has consistent return 2012-02-06 16:45:06 -05:00
Brad Dunbar
954da679ed Refactor some tests.
* Use object for lastRequest to prevent errors.
* Ensure setDOMLibrary tests are cleaned up.
2012-02-02 19:36:50 -05:00
Jeremy Ashkenas
a865aa41f1 removing obsolete error case. 2012-02-02 17:15:28 -05:00
Jeremy Ashkenas
aafbcb05e5 Fixes #917 -- reverts validate() behavior to never run on silent sets. 2012-02-02 15:40:06 -05:00
Brad Dunbar
ec61503c87 fixes #928 - Save sends correct attrs.
* Temporarily set model's attrs for `sync`.
* Remove cross-module (global) dependencies in
  Collection, Model, and sync test modules.
2012-02-02 08:57:47 -05:00
Brad Dunbar
50e8103fdf check for duplicate models/ids 2012-01-30 15:24:41 -05:00
Jeremy Ashkenas
ab164c450d Overhauling 'validate' -- Receives the computed new state of the attrs, not just the delta. Now runs on model create, raising an exception if you try to 'new' and invalid model ... also runs even if changed silently. 2012-01-23 18:16:20 -05:00
Jeremy Ashkenas
910ca3c190 Merge pull request #866 from braddunbar/add-tweaks
Collection#add tweaks
2012-01-17 22:50:17 -08:00
Brad Dunbar
09ab8cb17d Collection#add tweaks
* leave collection in a consistent state after throw
* correct indices
2012-01-17 23:53:02 -05:00
Brad Dunbar
397d11e340 equals is deprecated; use equal instead
http://docs.jquery.com/QUnit/equal#actualexpectedmessage
2012-01-17 23:52:12 -05:00
Jeremy Ashkenas
cea56e523a Fixes #563. Initial draft of 'wait: true' for pessimistic instead of optimistic save() create() and destroy(). Makes it easier to have your asynchronous UI and eat it too. 2012-01-17 15:26:26 -05:00
Jeremy Ashkenas
09110a6656 removing erroneous console.log 2012-01-17 11:18:17 -05:00
Jeremy Ashkenas
2d02a3cfb6 Fixes #861, better error message for adding invalid models to a collection. 2012-01-17 10:54:03 -05:00
Jeremy Ashkenas
7ba0275613 Fixes #574, clone 'models' before removing, so as to allow collection.remove(collection.models) 2012-01-17 10:29:01 -05:00
Jeremy Ashkenas
2dce413247 Adding options.index to Collection#add and #remove. 2012-01-13 17:20:15 -05:00
Jeremy Ashkenas
a8bd142b64 Fixes #714, assign model.collection early, so that those overriding set() can use it from the get-go. 2012-01-13 13:19:28 -05:00
Jeremy Ashkenas
a49bb4f3e1 Fixes #811 -- allow you to pass a context when unbinding events as well. 2012-01-12 17:09:15 -05:00
Jeremy Ashkenas
1d90bb9cfc binding the comparator function before using it, so that you can rely on properties of your collection within it. 2012-01-12 15:13:22 -05:00
Jeremy Ashkenas
8cfb243b8e Fixes #836, Fixes #708 -- going back to previous stance: two models with the same id can't be added to the same collection. 2012-01-11 17:03:30 -05:00
Jeremy Ashkenas
bf1ffbeb67 nice refactor. removed _add and _remove and moved 'em in to the public API. 2012-01-11 13:45:16 -05:00
Brad Dunbar
c8919c4b05 collection.add should not alter models array 2012-01-10 17:18:11 -05:00
Jeremy Ashkenas
1715c181ad Fixes #81 -- optimize for addition of large arrays of models, not for individual inserts. 2012-01-06 15:42:43 -05:00
Jeremy Ashkenas
6b3ff7b035 Fixes #9, Backbone comparators can now be either sort() or sortBy() iterators. 2012-01-06 14:53:43 -05:00
Jeremy Ashkenas
dd83f2057c Fixes #788 2011-12-19 11:20:37 -05:00
Magnus Holm
67f689df9c Col.fetch() should create models with parse:true:
This is done in two steps:

1. Col.fetch() now defaults to parse:true
2. Col.reset() and _prepareModel now passes along
   parse:true.

This means that Col.add() also accepts the
parse:true option.
2011-12-04 18:27:36 +01:00
Tim Branyen
9982e314cb Merge pull request #700 from iros/673
#673 - Adding index as a property on the options object that gets passed
2011-10-29 13:30:58 -07:00
Irene Ros
80769fcf99 #673 - Adding index as a property on the options object that gets passed when the add/remove callbacks get triggered on a collection. 2011-10-29 16:29:18 -04:00
Alex Graul
567e0a3c2d Fix for adding models with custom set methods to collections, issue #539 2011-10-29 13:23:01 -04:00
Jeremy Ashkenas
6d07d2f0e2 multiple models with the same ID should be allowed in a collection. 2011-07-05 16:40:23 -04:00
Niall Smart
0853866aab Collection.add should fail if duplicate id/cid exists 2011-06-13 18:11:04 -07:00
Jeremy Ashkenas
e01ad9dd5b Merging in #232. Allow destroy() to be called on non-persisted objects ... just in case. 2011-05-27 11:30:48 -04:00
Jeremy Ashkenas
cf3215139a initial draft of a 0.5.0 branch 2011-05-26 10:54:28 -04:00
Pablo A. Torres Navarrete
0f118ecb6e Add a failing test for Collection.create not running callbacks 2011-04-21 12:07:11 -05:00
Jacek Becela
223c4fb210 Add failing test for #319 2011-04-15 09:32:46 +02:00
Raimonds Simanovskis
5a89ed3272 destroy of non-persisted model should not call sync 2011-02-15 15:17:20 +02:00
Jeremy Ashkenas
c6d2c69d82 ditto 2011-02-07 14:49:56 -05:00
Kris Jordan
7442f826f1 Forcing Collection.create to run through validation before saving. 2011-02-06 01:13:52 -05:00
Joshua Peek
14000a8bb9 Improve multiple collection support
Preserve original model collection when adding/removing from another collection
Destroying a model removes it from all collections
2011-01-22 10:15:51 -06:00
Jeremy Ashkenas
6ea500b0dd Fixing un-released models from refresh'd collections. Issue #128 2010-12-08 16:38:33 -05:00
Jeremy Ashkenas
6a0ac93086 Fixing Issue #109 -- ignore 'add' and 'remove' events that originate from models shared with other collections. 2010-12-02 09:31:55 -05:00
Jeremy Ashkenas
6e4046df02 All Backbone events now pass through their options as the ffinal argument. 2010-11-30 16:04:55 -05:00