Skip to content
Extraits de code Groupes Projets
Valider 0e1c66f5 rédigé par danielgrippi's avatar danielgrippi
Parcourir les fichiers

DG MS; only show applicable frames in the framer step

parent 92cbcae9
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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)
}
});
\ No newline at end of file
......@@ -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()
})
})
})
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter