new post types. remove old ones. yeah.

This commit is contained in:
danielgrippi 2012-05-21 18:44:51 -07:00
parent 2059fea656
commit 64a73fb665
9 changed files with 127 additions and 77 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View file

@ -59,9 +59,14 @@ app.models.Post = Backbone.Model.extend(_.extend({}, app.models.formatDateMixin,
headlineLimit : 118, headlineLimit : 118,
frameMoods : [ frameMoods : [
"Day", // "Day",
"Night", // "Night",
"Wallpaper", "Wallpaper",
"Newspaper" // "Newspaper",
// NEW SHIT
"Vanilla",
"Typist",
"Fridge"
] ]
}); });

View file

@ -9,11 +9,11 @@ _.extend(app.models.Post.TemplatePicker.prototype, {
var frameName var frameName
if(this.isNewspaper()){ if(this.isNewspaper()){
frameName = "Newspaper" frameName = "Typist"
} else if(this.isWallpaper()) { } else if(this.isWallpaper()) {
frameName = "Wallpaper" frameName = "Wallpaper"
} else { } else {
frameName = "Day" frameName = "Vanilla"
} }
return frameName return frameName

View file

@ -52,3 +52,15 @@ app.views.Post.Wallpaper = app.views.Post.Mood.extend({
}) })
} }
}) })
app.views.Post.Typist = app.views.Post.Mood.extend({
mood : "typist"
})
app.views.Post.Vanilla = app.views.Post.Mood.extend({
mood : "vanilla"
})
app.views.Post.Fridge = app.views.Post.Mood.extend({
mood : "fridge"
})

View file

@ -47,24 +47,22 @@ app.views.Post.SmallFrame = app.views.Post.extend({
colorClass : function() { colorClass : function() {
var text = this.model.get("text") var text = this.model.get("text")
, baseClass = $.trim(text).length == 0 ? "no-text" : 'has-text'; , baseClass = $.trim(text).length == 0 ? "no-text" : "has-text";
if(this.model.get("photos").length > 0 || this.model.get("o_embed_cache"))
baseClass += " has-media";
if(baseClass == "no-text" || this.model.get("photos").length > 0 || this.model.get("o_embed_cache")) { return baseClass } if(baseClass == "no-text" || this.model.get("photos").length > 0 || this.model.get("o_embed_cache")) { return baseClass }
var randomColor = _.first(_.shuffle(['cyan', 'green', 'yellow', 'purple', 'lime-green', 'orange', 'red', 'turquoise', 'sand'])); var randomColor = _.first(_.shuffle(['cyan', 'green', 'yellow', 'purple', 'lime-green', 'orange', 'red', 'turquoise', 'sand']));
var textClass; var textClass = randomColor;
if(text.length > 240) {
textClass = "blog-text x2 width" if(text.length < 40) {
} else if(text.length > 140) { textClass += " big-text"
textClass = randomColor
} else if(text.length > 40) {
textClass = randomColor
} else {
textClass = "big-text " + randomColor
} }
return [baseClass, textClass, "sticky-note"].join(" ") return [baseClass, textClass].join(" ")
}, },
dimensionsClass : function() { dimensionsClass : function() {

View file

@ -27,6 +27,15 @@
cursor : -webkit-zoom-in; cursor : -webkit-zoom-in;
} }
.content {
/* default height to be overridden */
min-height : $column-width + px;
}
&.has-media .content {
min-height : 0;
}
.content { .content {
@include transition(-webkit-transform); @include transition(-webkit-transform);
@include box-shadow(0, 8px, 50px, rgba(0,0,0,0.9)); @include box-shadow(0, 8px, 50px, rgba(0,0,0,0.9));
@ -190,55 +199,23 @@
font-size : 1.5em; font-size : 1.5em;
line-height : 1.2em; line-height : 1.2em;
/* I'D DO ANYTHING FOR TEXT, BUT I WON'T DO THAT (see: http://www.youtube.com/watch?v=9GNhdQRbXhc) */
max-height : 485.5px;
img { img {
max-width: 100%; max-width: 100%;
width: 100%; width: 100%;
} }
p {
word-break : break-word;
}
p:last-child { p:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
} }
&.sticky-note {
.content{
min-height : $column-width + px;
.text-content {
margin: 30px 20px;
}
}
&.big-text {
display : table;
.text-content {
display : table-cell;
position : absolute;
margin : 0;
margin-top : 20%;
height : 100%;
width : 100%;
top : 0;
left : 0;
}
p {
font-family : "Noteworthy", "Marker Felt", "Comic Sans";
font-style : italic;
text-align : center;
font-weight : bold;
padding: 0 20px;
}
}
}
&.sticky-note .text-content {
color : #555;
}
&.cyan .background-color { background-color : rgba($cyan, 0.2); } &.cyan .background-color { background-color : rgba($cyan, 0.2); }
&.green .background-color { background-color : rgba($green, 0.2); } &.green .background-color { background-color : rgba($green, 0.2); }
&.yellow .background-color { background-color : rgba($yellow, 0.2); } &.yellow .background-color { background-color : rgba($yellow, 0.2); }
@ -272,15 +249,13 @@
} }
} }
&.day:not(.sticky-note), &:not(.wallpaper) {
&.has-text:not(.sticky-note):not(.wallpaper),
&.night:not(.sticky-note) {
img { img {
border-bottom : 1px solid #ddd; border-bottom : 1px solid #ddd;
} }
.text-content { .text-content {
padding : 10px 20px; padding : 20px;
font-size : 14px; font-size : 14px;
line-height : 18px; line-height : 18px;
color : #444; color : #444;
@ -289,7 +264,14 @@
&.big-text { &.big-text {
.text-content { .text-content {
display : table;
height : 225px;
width : 225px;
p { p {
display : table-cell;
vertical-align : middle;
font-size : 2.0em; font-size : 2.0em;
line-height : 1.1em; line-height : 1.1em;
text-align : center; text-align : center;
@ -297,9 +279,12 @@
} }
} }
&.x2.big-text .text-content {
width : $two-column-width - 40 + px;
}
/* larger declarations */ /* larger declarations */
&.x2.width .content { @include wide(); } &.x2.width .content { @include wide(); }
&.sticky-note.x2.height .content { &.sticky-note.x2.height .content {
min-height : $two-row-height + px; min-height : $two-row-height + px;
@ -325,8 +310,58 @@
@include centered-frame(); @include centered-frame();
font-size: 2em; font-size: 2em;
color: white; color: white;
@include opacity(1);
p {
text-shadow : none;
padding : 0 10px;
}
}
}
/* new styles go! */
&.typist {
.content {
background : {
image : image_url("typist_texture.png");
color : transparent;
}
}
.background-color {
display : none;
}
p {
font-family : "American Typewriter", "Courier";
letter-spacing : 1.5px;
font-size : 0.9em;
color : #111;
}
}
&.fridge {
p {
font : {
family : "Noteworthy", "Marker Felt", "Comic Sans";
style : italic;
}
font-size : 2em;
line-height : 1.4em;
}
}
&.vanilla {
.background-color {
display : none;
}
p {
color : #111;
text-shadow : none; text-shadow : none;
font : {
weight : normal;
family : Roboto-Light;
}
} }
} }
} }

View file

@ -54,8 +54,8 @@ Feature: Creating a new post
Then it should be a wallpaper small frame with the background "button.gif" Then it should be a wallpaper small frame with the background "button.gif"
Then I should see "This is hella customized" in the framer preview Then I should see "This is hella customized" in the framer preview
When I select the mood "Newspaper" When I select the mood "Typist"
Then the post's mood should be "Newspaper" Then the post's mood should be "Typist"
And "button.gif" should be in the post's small frame And "button.gif" should be in the post's small frame
And I should see "This is hella customized" in the framer preview And I should see "This is hella customized" in the framer preview
@ -63,7 +63,7 @@ Feature: Creating a new post
And I go back to the composer And I go back to the composer
And I write "It sure is a beautiful Day" And I write "It sure is a beautiful Day"
And I start the framing process And I start the framing process
Then the post's mood should be "Newspaper" Then the post's mood should be "Typist"
And I should see "It sure is a beautiful Day" in the framer preview And I should see "It sure is a beautiful Day" in the framer preview
When I finalize my frame When I finalize my frame
@ -72,7 +72,7 @@ Feature: Creating a new post
When I click into the "It sure is a beautiful Day" post When I click into the "It sure is a beautiful Day" post
#on show page #on show page
And the post's mood should still be "Newspaper" And the post's mood should still be "Typist"
Scenario: The Wallpaper mood Scenario: The Wallpaper mood
When I write "This is a pithy status" with body "And this is a long body" When I write "This is a pithy status" with body "And this is a long body"

View file

@ -10,8 +10,8 @@ describe("app.models.Post.TemplatePicker", function(){
this.post.set({text : window.hipsterIpsumFourParagraphs }) this.post.set({text : window.hipsterIpsumFourParagraphs })
}) })
it("returns Wallpaper", function(){ it("returns Typist", function(){
expect(this.templatePicker.getFrameName()).toBe("Newspaper") expect(this.templatePicker.getFrameName()).toBe("Typist")
}) })
}) })
@ -31,13 +31,13 @@ describe("app.models.Post.TemplatePicker", function(){
this.post.set({photos : [factory.photoAttrs(), factory.photoAttrs()]}) this.post.set({photos : [factory.photoAttrs(), factory.photoAttrs()]})
}) })
it("returns Day", function(){ it("returns Vanilla", function(){
expect(this.templatePicker.getFrameName()).toBe("Day") expect(this.templatePicker.getFrameName()).toBe("Vanilla")
}) })
}) })
it("returns 'Day' by default", function(){ it("returns 'Vanilla' by default", function(){
expect(this.templatePicker.getFrameName()).toBe("Day") expect(this.templatePicker.getFrameName()).toBe("Vanilla")
}) })
}) })
}) })

View file

@ -30,8 +30,8 @@ describe("app.pages.Framer", function(){
expect(this.model.setFrameName).toHaveBeenCalled() expect(this.model.setFrameName).toHaveBeenCalled()
}) })
it("sets the frame_name of the model to 'Day' by default", function(){ //jasmine integration test, arguably unnecessary it("sets the frame_name of the model to 'Vanilla' by default", function(){ //jasmine integration test, arguably unnecessary
expect(this.model.get("frame_name")).toBe("Day") expect(this.model.get("frame_name")).toBe("Vanilla")
}) })
}) })
@ -50,9 +50,9 @@ describe("app.pages.Framer", function(){
describe("setting the model's attributes from the various form fields", function(){ describe("setting the model's attributes from the various form fields", function(){
beforeEach(function(){ beforeEach(function(){
this.page.$("input.mood").attr("checked", false) //radio button hax this.page.$("input.mood").attr("checked", false) //radio button hax
expect(app.frame.get("frame_name")).not.toBe("Night") expect(app.frame.get("frame_name")).not.toBe("Typist")
this.page.$("input.aspect_ids").val("public") this.page.$("input.aspect_ids").val("public")
this.page.$("input[value='Night']").attr("checked", "checked") this.page.$("input[value='Typist']").attr("checked", "checked")
this.page.$("input.services[value=facebook]").attr("checked", "checked") this.page.$("input.services[value=facebook]").attr("checked", "checked")
this.page.$("input.services[value=twitter]").attr("checked", "checked") this.page.$("input.services[value=twitter]").attr("checked", "checked")
}) })
@ -60,13 +60,13 @@ describe("app.pages.Framer", function(){
it("instantiates a post on form submit", function(){ it("instantiates a post on form submit", function(){
this.page.$("input").trigger("change") //runs setFormAttrs this.page.$("input").trigger("change") //runs setFormAttrs
waitsFor(function(){ waitsFor(function(){
return this.page.model.get("frame_name") == "Night" return this.page.model.get("frame_name") == "Typist"
}) })
runs(function(){ runs(function(){
expect(this.page.model.get("aspect_ids")).toEqual(["public"]) expect(this.page.model.get("aspect_ids")).toEqual(["public"])
expect(this.page.model.get("services")).toEqual(["facebook", "twitter"]) expect(this.page.model.get("services")).toEqual(["facebook", "twitter"])
expect(this.page.model.get("frame_name")).toBe("Night") expect(this.page.model.get("frame_name")).toBe("Typist")
}) })
}) })
}); });