Rename app.collections.Aspect{,Selection}s
This commit is contained in:
parent
ac2f161271
commit
d50ab83157
6 changed files with 13 additions and 12 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
||||||
|
|
||||||
app.collections.Aspects = Backbone.Collection.extend({
|
app.collections.AspectSelections = Backbone.Collection.extend({
|
||||||
model: app.models.AspectSelection,
|
model: app.models.AspectSelection,
|
||||||
|
|
||||||
selectedAspects: function(attribute){
|
selectedAspects: function(attribute){
|
||||||
|
|
@ -26,8 +26,8 @@ app.models.StreamAspects = app.models.Stream.extend({
|
||||||
|
|
||||||
fetchDone: function() {
|
fetchDone: function() {
|
||||||
this.triggerFetchedEvents();
|
this.triggerFetchedEvents();
|
||||||
if (app.aspects) {
|
if (app.aspectSelections) {
|
||||||
app.aspects.trigger('aspectStreamFetched');
|
app.aspectSelections.trigger("aspectStreamFetched");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -134,14 +134,15 @@ app.Router = Backbone.Router.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
aspects: function() {
|
aspects: function() {
|
||||||
app.aspects = app.aspects || new app.collections.Aspects(app.currentUser.get("aspects"));
|
app.aspectSelections = app.aspectSelections ||
|
||||||
this.aspectsList = this.aspectsList || new app.views.AspectsList({ collection: app.aspects });
|
new app.collections.AspectSelections(app.currentUser.get("aspects"));
|
||||||
|
this.aspectsList = this.aspectsList || new app.views.AspectsList({collection: app.aspectSelections});
|
||||||
this.aspectsList.render();
|
this.aspectsList.render();
|
||||||
this.aspects_stream();
|
this.aspects_stream();
|
||||||
},
|
},
|
||||||
|
|
||||||
aspects_stream : function(){
|
aspects_stream : function(){
|
||||||
var ids = app.aspects.selectedAspects("id");
|
var ids = app.aspectSelections.selectedAspects("id");
|
||||||
app.stream = new app.models.StreamAspects([], { aspects_ids: ids });
|
app.stream = new app.models.StreamAspects([], { aspects_ids: ids });
|
||||||
app.stream.fetch();
|
app.stream.fetch();
|
||||||
this._initializeStreamView();
|
this._initializeStreamView();
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
describe("app.collections.Aspects", function(){
|
describe("app.collections.AspectSelections", function(){
|
||||||
beforeEach(function(){
|
beforeEach(function(){
|
||||||
var my_aspects = [
|
var my_aspects = [
|
||||||
{ name: 'Work', selected: true },
|
{ name: 'Work', selected: true },
|
||||||
{ name: 'Friends', selected: false },
|
{ name: 'Friends', selected: false },
|
||||||
{ name: 'Acquaintances', selected: false }
|
{ name: 'Acquaintances', selected: false }
|
||||||
];
|
];
|
||||||
this.aspects = new app.collections.Aspects(my_aspects);
|
this.aspects = new app.collections.AspectSelections(my_aspects);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("#selectAll", function(){
|
describe("#selectAll", function(){
|
||||||
|
|
@ -41,7 +41,7 @@ describe("app.collections.Aspects", function(){
|
||||||
describe("#toSentence", function(){
|
describe("#toSentence", function(){
|
||||||
describe('without aspects', function(){
|
describe('without aspects', function(){
|
||||||
beforeEach(function(){
|
beforeEach(function(){
|
||||||
this.aspects = new app.collections.Aspects([{ name: 'Work', selected: false }]);
|
this.aspects = new app.collections.AspectSelections([{ name: 'Work', selected: false }]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns the name of the aspect", function(){
|
it("returns the name of the aspect", function(){
|
||||||
|
|
@ -51,7 +51,7 @@ describe("app.collections.Aspects", function(){
|
||||||
|
|
||||||
describe("with one aspect", function(){
|
describe("with one aspect", function(){
|
||||||
beforeEach(function(){
|
beforeEach(function(){
|
||||||
this.aspects = new app.collections.Aspects([{ name: 'Work', selected: true }]);
|
this.aspects = new app.collections.AspectSelections([{ name: 'Work', selected: true }]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns the name of the aspect", function(){
|
it("returns the name of the aspect", function(){
|
||||||
|
|
@ -39,7 +39,7 @@ describe('app.Router', function () {
|
||||||
|
|
||||||
it('hides the aspects list', function(){
|
it('hides the aspects list', function(){
|
||||||
setFixtures('<div id="aspects_list" />');
|
setFixtures('<div id="aspects_list" />');
|
||||||
aspects = new app.collections.Aspects([
|
aspects = new app.collections.AspectSelections([
|
||||||
factory.aspectAttrs({selected:true}),
|
factory.aspectAttrs({selected:true}),
|
||||||
factory.aspectAttrs()
|
factory.aspectAttrs()
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ describe("app.views.AspectsList", function(){
|
||||||
var aspects = [{ name: 'Work', selected: true },
|
var aspects = [{ name: 'Work', selected: true },
|
||||||
{ name: 'Friends', selected: false },
|
{ name: 'Friends', selected: false },
|
||||||
{ name: 'Acquaintances', selected: false }];
|
{ name: 'Acquaintances', selected: false }];
|
||||||
this.aspects = new app.collections.Aspects(aspects);
|
this.aspects = new app.collections.AspectSelections(aspects);
|
||||||
this.view = new app.views.AspectsList({ collection: this.aspects });
|
this.view = new app.views.AspectsList({ collection: this.aspects });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue