Commit Graph

771 Commits

Author SHA1 Message Date
Jeremy Ashkenas
5cab60be4f Defaulting remove:true for Collection#update 2012-12-11 11:20:19 -05:00
Brad Dunbar
6c0cda6707 Fix #1894, Collection#push should not sort. 2012-12-11 10:19:36 -05:00
Jeremy Ashkenas
a645760286 Change Collection#sort's event from 'reset' to 'sort', so you can optimize further if you wish. 2012-12-10 23:48:25 -05:00
Jeremy Ashkenas
d4d2daf891 Fixes #618 -- support for a simple version of PATCH 2012-12-10 16:31:02 -05:00
Jeremy Ashkenas
104e9baebb Merging in Collection#update -- revised implementation, some tweaks: models are retained by default, there's no new 'update' event. 2012-12-10 15:59:23 -05:00
Jeremy Ashkenas
d6d264bebd Merge branch 'collection-update' of https://github.com/caseywebdev/backbone 2012-12-10 14:47:35 -05:00
Jeremy Ashkenas
ec97a1cef9 Fixes #1468 -- add a 'request' event that allows folks to watch for spinners etc. Passes the XHR on which you can .then, .error, and so on. 2012-12-10 14:10:41 -05:00
Casey Foster
c6ca92850c Merge branch 'master' into collection-update 2012-12-10 08:02:43 -08:00
Casey Foster
764c38f112 Pass models in update trigger
Let `sort` trigger "sort" in an effort to phase out `reset`

Avoid unneccessary array rebuild in `update`
2012-12-10 08:02:15 -08:00
Jeremy Ashkenas
0991608f55 Rewriting comment. 2012-12-10 10:59:54 -05:00
Jeremy Ashkenas
4976b66652 Merge pull request #1889 from caseywebdev/global-events
Backbone extends Events
2012-12-10 07:58:01 -08:00
Casey Foster
a3da45efd5 Backbone extends Events 2012-12-10 07:46:00 -08:00
Jeremy Ashkenas
4da25a48a6 Passing a configured version of jshint 2012-12-10 10:31:28 -05:00
Jeremy Ashkenas
a389e81e71 removing accidental globals -- need to get lint hooked up. 2012-12-10 09:59:55 -05:00
Casey Foster
bee1296053 Update update to merge cleanly 2012-12-08 17:55:15 -08:00
Casey Foster
c51b9cc5fd Rebasing update
Reuse prepared model in Collection#update

Remove extra whitespace

Trigger `update` after Collection#update unless silent

Don't create new models in Collection#update

Remove `slice` call from Collection#update

It isn't necessary since the array isn't being modified. `add` and
`remove` both slice the arrays they are passed, so simply reading
and passing on the pristine array to those functions is harmless.

Simplify excessive ternary in Collection#update

`update` supports simple add/remove/merge options

Cleanup `update`, support for any combination of add/merge/remove

Save a potentially useless `slice` in `update`

Add comments and more tests for Collection#update

Avoid splice and slice, they're too slow!
2012-12-08 17:48:55 -08:00
Jeremy Ashkenas
7dbfecc6c1 Fixes #697 -- Add 'once' to backbone events, supporting event maps, off, and all that jazz 2012-12-07 17:56:56 -05:00
Jeremy Ashkenas
62b80bfc32 Fixes #1340 -- reset events include previous list of models, for added convenience. 2012-12-07 16:20:24 -05:00
Jeremy Ashkenas
6dadc92765 Merge branch 'encoded-fragments' of https://github.com/braddunbar/backbone 2012-12-07 15:24:55 -05:00
Tim Branyen
f416c5be6d bumping the version in master, reflecting the wip state 2012-12-07 09:57:59 -05:00
Jeremy Ashkenas
23cc302a51 Fixes #1477 -- Changing Backbone's internal logic so that validation always happens, even when silent: true. Defining a validate should never allow state to become invalid, even during a silent change. 2012-12-06 16:48:29 -05:00
Jeremy Ashkenas
362b91c8e4 Fixes #1456. Enhances Backbone.Events to support jQuery-style event maps, in 'on' and 'off'. 2012-12-06 16:12:19 -05:00
Jeremy Ashkenas
8711f3c781 Fixes #1870 -- allow empty bodies for difficult endpoints. 2012-12-06 15:43:25 -05:00
Casey Foster
aefd78f949 Merge branch 'master' into collection-update
Conflicts:
	test/collection.js
2012-12-05 10:31:31 -08:00
Casey Foster
54ac6b0e4c Cleanup collection#update 2012-12-05 10:19:59 -08:00
Jeremy Ashkenas
a7be84ef37 merged. 2012-12-04 17:41:57 -05:00
Casey Foster
1b985790a4 Simplify conditional in Collection#update 2012-12-01 12:33:23 -08:00
Casey Foster
beffc15a0b Add Collection#update to better use collection events 2012-12-01 12:26:11 -08:00
Casey Foster
59850645e6 Only sort on add when it make sense 2012-11-30 15:40:01 -08:00
Tim Griesser
e5a3b0bba0 consistent 'parse' option on collection constructor & reset 2012-11-30 11:47:01 -05:00
Casey Foster
e841851d56 Fix global i leak in change 2012-11-28 23:21:51 -08:00
Jeremy Ashkenas
29dc8fc2bc initial merge of tgriesser's change cleanup 2012-11-28 17:04:27 -05:00
Jeremy Ashkenas
e27c86e8f7 indentation 2012-11-28 15:08:56 -05:00
Jeremy Ashkenas
942c19926d Merge pull request #1717 from davidgtonge/master
Stop Backbone throwing an error when an invalid model is added
2012-11-28 12:07:59 -08:00
Jeremy Ashkenas
2da7c73901 fixing the parse inconsistency in the original mmanner. 2012-11-28 14:39:59 -05:00
Jeremy Ashkenas
a0aabb405b Revert "Fixes #1843 -- reworks parsing behavior. It now always applies if you define it, and no longer passes xhr. (parsing should be a pure function of the data)"
This reverts commit fbbb2e675e.
2012-11-28 14:39:01 -05:00
Jeremy Ashkenas
fbbb2e675e Fixes #1843 -- reworks parsing behavior. It now always applies if you define it, and no longer passes xhr. (parsing should be a pure function of the data) 2012-11-28 14:26:49 -05:00
Jeremy Ashkenas
3de9f3504e Revert "tiny tweak"
This reverts commit e7d85efa9c.
2012-11-28 14:14:21 -05:00
Jeremy Ashkenas
e7d85efa9c tiny tweak 2012-11-28 14:00:06 -05:00
Adam Krebs
b34f4f38c7 use _.result for this.options 2012-11-27 10:44:01 -05:00
Adam George
be209e623d Pass options through to toJSON
This is useful if you have overriden toJSON with own implemention and
need to pass some options through
2012-11-21 14:34:15 +11:00
Al Urim
70ff93bdfc Update backbone.js
Remove unnecessary argument.
2012-11-20 12:47:53 -08:00
Jeremy Ashkenas
0b27091e5a fixes previous commit 2012-11-19 15:30:51 -05:00
Jeremy Ashkenas
c746c3c5c2 Fixes #1806, model.save(null, {wait: true}) with validation 2012-11-19 15:29:41 -05:00
Tim Griesser
a96fe08f92 allowing events to be passed in view's options 2012-11-16 14:21:59 -05:00
Brad Dunbar
39ff3870a7 Fix gh-1820 - Update comment, use global flag. 2012-11-14 17:00:17 -05:00
Brad Dunbar
b75c4c52ee Merge branch 'master' into emulate-options
Conflicts:
	backbone.js
	test/sync.js
2012-11-02 17:05:29 -04:00
Brad Dunbar
d196c25fe6 Strip trailing space from fragments. 2012-11-02 09:03:16 -04:00
Brian Erickson
8decce8d7d Issue #1793: Backbone.history.navigate should use this.getFragment instead of fragment to avoid routes getting triggered twice 2012-11-01 22:41:47 -06:00
Casey Foster
34ce37137e Fix #1791 reorder constructor so attributes is defined for parse 2012-11-01 17:02:37 -07:00