Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MS DC framer shows rudimentary version of post

  • Loading branch information...
commit 358414371e1fdb70b066d38b7c770076f4c9f88d 1 parent 7ec1ef8
@denniscollective denniscollective authored
View
9 features/step_definitions/trumpeter_steps.rb
@@ -25,6 +25,12 @@ def finalize_frame
click_button "done"
end
+def within_frame_preview
+ within ".post-view .post" do
+ yield
+ end
+end
+
When /^I trumpet$/ do
visit new_post_path
end
@@ -84,6 +90,7 @@ def finalize_frame
find_post_by_text(post_text).all(".photo_attachments img").size.should == number_of_pictures.to_i
end
+
Then /^I should see "([^"]*)" in the framer preview$/ do |post_text|
- pending
+ within_frame_preview { page.should have_content(post_text) }
end
View
7 features/trumpeter.feature
@@ -40,10 +40,11 @@ Feature: Creating a new post
Then "check out these pictures" should have 2 pictures
Scenario: Framing your frame
- When I write "This shit is super customized"
+ When I write "This is hella customized"
And I upload a fixture picture with filename "button.gif"
And I start the framing process
- Then I should see "This shit is super customized" in the framer preview
+ Then I should see "This is hella customized" in the framer preview
When I finalize my frame
- Then "This is super skrunkle" should be the first post in my stream
+ And I go to "/stream"
+ Then "This is hella customized" should be post 1
View
1  public/javascripts/app/forms/post_form.js
@@ -29,7 +29,6 @@ app.forms.Post = app.forms.Base.extend({
this.model.set(_.inject(this.formAttrs, setValueFromField, {}))
//pass collections across
this.model.photos = this.pictureForm.photos
- this.model.trigger("setFromForm")
function setValueFromField(memo, attribute, selector){
var selectors = form.find(selector);
View
7 public/javascripts/app/models/status_message.js
@@ -3,10 +3,15 @@ app.models.StatusMessage = app.models.Post.extend({
return this.isNew() ? '/status_messages' : '/posts/' + this.get("id");
},
+ defaults : {
+ 'post_type' : 'StatusMessage',
+ 'author' : app.currentUser ? app.currentUser.attributes : {}
+ },
+
toJSON : function(){
return {
status_message : _.clone(this.attributes),
- 'aspect_ids' : this.get("aspect_ids").split(","),
+ aspect_ids : this.get("aspect_ids") && this.get("aspect_ids").split(","),
photos : this.photos && this.photos.pluck("id"),
services : mungeServices(this.get("services"))
}
View
24 public/javascripts/app/pages/framer.js
@@ -5,8 +5,28 @@ app.pages.Framer = app.views.Base.extend({
"click button.done" : "saveFrame"
},
+ subviews : {
+ ".post-view" : "postView"
+ },
+
+ initialize : function(){
+ this.model = app.frame
+
+ var templateType = "status"
+
+ this.model.authorIsNotCurrentUser = function(){ return false }
+
+ this.postView = new app.views.Post({
+ model : this.model,
+ className : templateType + " post loaded",
+ templateName : "post-viewer/content/" + templateType,
+ attributes : {"data-template" : templateType}
+ });
+
+ this.postView.feedbackView = new Backbone.View
+ },
+
saveFrame : function(){
- console.log(app.frame.toJSON(), app.frame)
- app.frame.save()
+ this.model.save()
}
})
View
3  public/javascripts/app/templates/framer.handlebars
@@ -1 +1,2 @@
-<button class="done btn-primary">done</button>
+<button class="done btn-primary">done</button>
+<div class="post-view"></div>
View
7 spec/javascripts/app/forms/post_form_spec.js
@@ -37,13 +37,6 @@ describe("app.forms.Post", function(){
expect(this.view.model.get("aspect_ids")).toBe("public")
expect(this.view.model.get("services").length).toBe(2)
})
-
- it("triggers a 'setFromForm' event", function(){
- var spy = jasmine.createSpy();
- this.view.model.bind("setFromForm", spy);
- this.view.$(".new-post").submit();
- expect(spy).toHaveBeenCalled();
- })
})
})
})
View
3  spec/javascripts/app/pages/framer_spec.js
@@ -1,6 +1,7 @@
describe("app.pages.Framer", function(){
beforeEach(function(){
- app.frame = new app.models.StatusMessage();
+ loginAs(factory.user())
+ app.frame = new factory.statusMessage();
this.page = new app.pages.Framer();
});
View
13 spec/javascripts/helpers/factory.js
@@ -52,8 +52,8 @@ factory = {
return _.extend(defaultAttrs, overrides)
},
- post : function(overrides) {
- var defaultAttrs = {
+ postAttrs : function(){
+ return {
"provider_display_name" : null,
"created_at" : "2012-01-03T19:53:13Z",
"interacted_at" : '2012-01-03T19:53:13Z',
@@ -61,7 +61,6 @@ factory = {
"public" : false,
"guid" : this.guid(),
"image_url" : null,
- "author" : this.author(),
"o_embed_cache" : null,
"photos" : [],
"text" : "jasmine is bomb",
@@ -73,10 +72,18 @@ factory = {
"likes_count" : 0,
"comments_count" : 0
}
+ },
+ post : function(overrides) {
+ defaultAttrs = _.extend(factory.postAttrs(), {"author" : this.author()})
return new app.models.Post(_.extend(defaultAttrs, overrides))
},
+ statusMessage : function(overrides){
+ //intentionally doesn't have an author to mirror creation process, maybe we should change the creation process
+ return new app.models.StatusMessage(_.extend(factory.postAttrs(), overrides))
+ },
+
comment: function(overrides) {
var defaultAttrs = {
"text" : "This is an awesome comment!",
Please sign in to comment.
Something went wrong with that request. Please try again.