Skip to content

Commit 5f29591

Browse files
committed
update to latest Spine
1 parent ef942cc commit 5f29591

File tree

11 files changed

+34
-36
lines changed

11 files changed

+34
-36
lines changed

app/javascripts/controllers/assets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(function($){
55

66
window.Assets = Spine.Controller.create({
7-
scoped: ["drop"],
7+
proxied: ["drop"],
88

99
handle: $("meta[name=handle]").attr("content"),
1010

app/javascripts/controllers/messages.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
window.MessagesItem = Spine.Controller.create({
44
tag: "li",
55

6-
scoped: ["render", "remove"],
6+
proxied: ["render", "remove"],
77

88
template: function(data){
99
return $("#messageTemplate").tmpl(data);
@@ -40,7 +40,7 @@ window.Messages = Spine.Controller.create({
4040
"keydown .new textarea": "checkCreate",
4141
},
4242

43-
scoped: ["changeChannel", "addNew", "addOne", "render"],
43+
proxied: ["changeChannel", "addNew", "addOne", "render"],
4444

4545
handle: $("meta[name=handle]").attr("content"),
4646

app/javascripts/controllers/searches.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ window.Searches = Spine.Controller.create({
1010
"click .item": "click"
1111
},
1212

13-
scoped: ["render", "query", "checkActive"],
13+
proxied: ["render", "query", "checkActive"],
1414

1515
template: function(data){
1616
return $("#searchTemplate").tmpl(data);

app/javascripts/controllers/settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var Channels = Spine.Controller.create({
44
tag: "li",
55

6-
scoped: ["render", "remove"],
6+
proxied: ["render", "remove"],
77

88
events: {
99
"click .destroy": "destroy",
@@ -64,7 +64,7 @@ window.Settings = Spine.Controller.create({
6464
"submit .createChannel form": "create"
6565
},
6666

67-
scoped: ["addAll", "addOne", "active"],
67+
proxied: ["addAll", "addOne", "active"],
6868

6969
init: function(){
7070
Channel.bind("refresh", this.addAll);

app/javascripts/controllers/sidebar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ window.Sidebar = Spine.Controller.create({
99
"#channels": "channels"
1010
},
1111

12-
scoped: ["change", "render"],
12+
proxied: ["change", "render"],
1313

1414
template: function(item){
1515
return $("#channelsTemplate").tmpl(item);

app/javascripts/juggernaut.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
jQuery(function($){
44
if (typeof Juggernaut == "undefined") return;
55

6-
var JuggernautApp = Spine.Klass.create({
6+
var JuggernautApp = Spine.Class.create({
77
init: function(){
88
this.socket = new Juggernaut;
99
this.offline = $("<div></div>")

app/javascripts/lib/spine.controller.manager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function(Spine, $){
22

3-
var Manager = Spine.Controller.Manager = Spine.Klass.create();
3+
var Manager = Spine.Controller.Manager = Spine.Class.create();
44
Manager.include(Spine.Events);
55

66
Manager.include({

app/javascripts/lib/spine.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494

9595
var moduleKeywords = ["included", "extended", "setup"];
9696

97-
var Klass = Spine.Klass = {
97+
var Class = Spine.Class = {
9898
initializer: function(){},
9999
init: function(){},
100100

@@ -159,8 +159,8 @@
159159
}
160160
};
161161

162-
Klass.prototype.proxy = Klass.proxy;
163-
Klass.prototype.proxyAll = Klass.proxyAll;
162+
Class.prototype.proxy = Class.proxy;
163+
Class.prototype.proxyAll = Class.proxyAll;
164164

165165
// Models
166166

@@ -171,7 +171,7 @@
171171
}).toUpperCase();
172172
};
173173

174-
var Model = Spine.Model = Klass.create();
174+
var Model = Spine.Model = Class.create();
175175

176176
Model.extend(Events);
177177

@@ -400,6 +400,10 @@
400400
toJSON: function(){
401401
return(this.attributes());
402402
},
403+
404+
exists: function(){
405+
return(this.id && this.id in this.parent.records);
406+
},
403407

404408
// Private
405409

@@ -433,7 +437,7 @@
433437

434438
// Controllers
435439

436-
var Controller = Spine.Controller = Klass.create({
440+
var Controller = Spine.Controller = Class.create({
437441
tag: "div",
438442

439443
initializer: function(options){
@@ -450,7 +454,7 @@
450454

451455
if (this.events) this.delegateEvents();
452456
if (this.elements) this.refreshElements();
453-
if (this.scoped) this.proxyAll.apply(this, this.scoped);
457+
if (this.proxied) this.proxyAll.apply(this, this.proxied);
454458
},
455459

456460
render: function(){},

app/javascripts/lib/spine.model.ajax.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,24 @@ var ajaxSync = function(method, record){
2626
};
2727

2828
if (Spine.Model._noSync) return;
29-
30-
params.url = getUrl(record);
29+
30+
if (method == "create" && record.model)
31+
params.url = getUrl(record.parent);
32+
else
33+
params.url = getUrl(record);
34+
3135
if (!params.url) throw("Invalid URL");
3236

3337
if (method == "create" || method == "update")
34-
params.data = JSON.stringify(record);
38+
params.data = JSON.stringify(record);
3539

3640
if (method == "read")
3741
params.success = function(data){
3842
(record.refresh || record.load).call(record, data);
3943
};
4044

41-
params.error = function(e){
42-
record.trigger("error", e);
45+
params.error = function(xhr, s, e){
46+
record.trigger("ajaxError", xhr, s, e);
4347
};
4448

4549
$.ajax(params);

app/javascripts/models/search.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var Search = Spine.Klass.create();
1+
var Search = Spine.Class.create();
22
Search.include(Spine.Events);
33

44
Search.models = [];
@@ -9,7 +9,7 @@ Search.Model = {
99
}
1010
};
1111

12-
Search.Record = Spine.Klass.create({
12+
Search.Record = Spine.Class.create({
1313
init: function(value, record){
1414
this.value = value;
1515
this.record = record;

0 commit comments

Comments
 (0)