DG MS; only show applicable frames in the framer step
This commit is contained in:
parent
92cbcae9c3
commit
0e1c66f5b6
4 changed files with 23 additions and 6 deletions
|
|
@ -19,6 +19,10 @@ app.models.Post = Backbone.Model.extend(_.extend({}, app.models.formatDateMixin,
|
|||
this.set({frame_name : new app.models.Post.TemplatePicker(this).getFrameName()})
|
||||
},
|
||||
|
||||
applicableTemplates: function() {
|
||||
return new app.models.Post.TemplatePicker(this).applicableTemplates()
|
||||
},
|
||||
|
||||
interactedAt : function() {
|
||||
return this.timeOf("interacted_at");
|
||||
},
|
||||
|
|
@ -59,12 +63,7 @@ app.models.Post = Backbone.Model.extend(_.extend({}, app.models.formatDateMixin,
|
|||
headlineLimit : 118,
|
||||
|
||||
frameMoods : [
|
||||
// "Day",
|
||||
// "Night",
|
||||
"Wallpaper",
|
||||
// "Newspaper",
|
||||
|
||||
// NEW SHIT
|
||||
"Vanilla",
|
||||
"Typist",
|
||||
"Fridge"
|
||||
|
|
|
|||
|
|
@ -25,5 +25,11 @@ _.extend(app.models.Post.TemplatePicker.prototype, {
|
|||
|
||||
isWallpaper : function(){
|
||||
return this.model.get("photos").length == 1
|
||||
},
|
||||
|
||||
applicableTemplates : function(){
|
||||
/* don't show the wallpaper option if there is no image */
|
||||
var moods = app.models.Post.frameMoods;
|
||||
return (!this.isWallpaper() ? _.without(moods, "Wallpaper") : moods)
|
||||
}
|
||||
});
|
||||
|
|
@ -67,7 +67,7 @@ app.views.framerContent = app.views.Base.extend({
|
|||
|
||||
presenter : function() {
|
||||
var selectedFrame = this.model.get("frame_name")
|
||||
, templates = app.models.Post.frameMoods;
|
||||
, templates = this.model.applicableTemplates(); //new app.models.Post.TemplatePicker(this.model).frameMoods;
|
||||
|
||||
return _.extend(this.defaultPresenter(), {
|
||||
templates : _.map(templates, function(template) {
|
||||
|
|
|
|||
|
|
@ -41,4 +41,16 @@ describe("app.models.Post.TemplatePicker", function(){
|
|||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("applicableTemplates", function(){
|
||||
it("includes wallpaper if isWallpaper is true", function(){
|
||||
spyOn(this.templatePicker, "isWallpaper").andReturn(true)
|
||||
expect(_.include(this.templatePicker.applicableTemplates(), "Wallpaper")).toBeTruthy()
|
||||
})
|
||||
|
||||
it("does not include wallpaper if isWallpaper is false", function(){
|
||||
spyOn(this.templatePicker, "isWallpaper").andReturn(false)
|
||||
expect(_.include(this.templatePicker.applicableTemplates(), "Wallpaper")).toBeFalsy()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue