Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 11 commits
  • 30 files changed
  • 0 commit comments
  • 5 contributors
Showing with 321 additions and 220 deletions.
  1. +41 −21 app/assets/javascripts/app/pages/framer.js
  2. +1 −12 app/assets/javascripts/app/pages/profile.js
  3. +5 −1 app/assets/javascripts/app/pages/stream.js
  4. +1 −1 app/assets/javascripts/app/views.js
  5. +2 −1 app/assets/javascripts/app/views/comment_view.js
  6. +2 −1 app/assets/javascripts/app/views/post-viewer/reactions.js
  7. +5 −4 app/assets/javascripts/app/views/post/small_frame.js
  8. +10 −11 app/assets/javascripts/app/views/post/stream_frame.js
  9. +0 −7 app/assets/javascripts/app/views/post/stream_interactions_view.js
  10. +24 −0 app/assets/stylesheets/new_styles/_base.scss
  11. +28 −4 app/assets/stylesheets/new_styles/_canvas.scss
  12. +31 −34 app/assets/stylesheets/new_styles/_composer.scss
  13. +14 −3 app/assets/stylesheets/new_styles/_interactions.scss
  14. +2 −4 app/assets/templates/composer-controls.jst.hbs
  15. +3 −5 app/assets/templates/flow.jst.hbs
  16. +8 −0 app/assets/templates/framer-content.jst.hbs
  17. +4 −16 app/assets/templates/framer-controls.jst.hbs
  18. +8 −10 app/assets/templates/post-form.jst.hbs
  19. +21 −9 app/assets/templates/post-viewer/comment.jst.hbs
  20. +6 −19 app/assets/templates/profile.jst.hbs
  21. +7 −0 app/assets/templates/stream-frame.jst.hbs
  22. +55 −0 app/assets/templates/stream.jst.hbs
  23. +6 −1 app/presenters/user_presenter.rb
  24. +1 −1 app/views/sessions/new.html.erb
  25. +1 −0 config/initializers/load_analyitics.rb
  26. +2 −2 features/support/publishing_cuke_helpers.rb
  27. +0 −4 spec/javascripts/app/pages/framer_spec.js
  28. +0 −43 spec/javascripts/app/pages/profile_spec.js
  29. +22 −0 spec/javascripts/app/pages/stream_spec.js
  30. +11 −6 spec/javascripts/app/views/post/stream_frame_spec.js
View
62 app/assets/javascripts/app/pages/framer.js
@@ -4,7 +4,7 @@ app.pages.Framer = app.views.Base.extend({
id : "post-content",
subviews : {
- ".flow-content" : "postView",
+ ".flow-content" : "framerContent",
".flow-controls .controls" : "framerControls"
},
@@ -13,20 +13,16 @@ app.pages.Framer = app.views.Base.extend({
if(!this.model.get("frame_name")) this.model.setFrameName()
this.model.authorIsCurrentUser = function(){ return true }
- this.model.bind("change:frame_name", this.render, this)
this.model.bind("sync", this.navigateNext, this)
+ this.framerContent = new app.views.framerContent({model : this.model})
this.framerControls = new app.views.framerControls({model : this.model})
},
unbind : function(){
this.model.off()
},
- postView : function(){
- return new app.views.Post.SmallFrame({model : this.model})
- },
-
navigateNext : function(){
if(parent.location.pathname == '/new_bookmarklet') {
this.bookmarkletNavigation()
@@ -45,43 +41,67 @@ app.pages.Framer = app.views.Base.extend({
}
});
-app.views.framerControls = app.views.Base.extend({
- templateName : 'framer-controls',
+app.views.framerContent = app.views.Base.extend({
+ templateName : "framer-content",
events : {
- "click input.done" : "saveFrame",
- "click input.back" : "editFrame",
"change input" : "setFormAttrs"
},
- subviews:{
- ".template-picker":'templatePicker',
- ".aspect-selector":"aspectsDropdown",
- ".service-selector":"servicesSelector"
+ subviews : {
+ ".preview" : "smallFrameView",
+ ".template-picker" : 'templatePicker'
},
formAttrs : {
- "input.mood:checked" : "frame_name",
- "input.aspect_ids" : "aspect_ids[]",
- "input.services" : "services[]"
+ "input.mood:checked" : "frame_name"
},
initialize : function(){
- this.aspectsDropdown = new app.views.AspectsDropdown({model:this.model});
- this.servicesSelector = new app.views.ServicesSelector({model:this.model});
+ this.model.bind("change:frame_name", this.render, this)
+ },
+
+ smallFrameView : function() {
+ return new app.views.Post.SmallFrame({model : this.model})
},
presenter : function() {
var selectedFrame = this.model.get("frame_name")
- , templates = app.models.Post.frameMoods //subtract re-implemented templates
+ , templates = app.models.Post.frameMoods;
+
return _.extend(this.defaultPresenter(), {
- templates :_.map(templates, function(template) {
+ templates : _.map(templates, function(template) {
return {
name : template,
checked : selectedFrame === template
}
})
})
+ }
+});
+
+app.views.framerControls = app.views.Base.extend({
+ templateName : 'framer-controls',
+
+ events : {
+ "click input.done" : "saveFrame",
+ "click input.back" : "editFrame",
+ "change input" : "setFormAttrs"
+ },
+
+ subviews:{
+ ".aspect-selector" : "aspectsDropdown",
+ ".service-selector" : "servicesSelector"
+ },
+
+ formAttrs : {
+ "input.aspect_ids" : "aspect_ids[]",
+ "input.services" : "services[]"
+ },
+
+ initialize : function(){
+ this.aspectsDropdown = new app.views.AspectsDropdown({model:this.model});
+ this.servicesSelector = new app.views.ServicesSelector({model:this.model});
},
saveFrame : function(){
View
13 app/assets/javascripts/app/pages/profile.js
@@ -51,9 +51,7 @@ app.pages.Profile = app.views.Base.extend({
var bio = this.model.get("bio") || ''
return _.extend(this.defaultPresenter(),
- {text : this.model && app.helpers.textFormatter(bio, this.model),
- showFollowButton : this.showFollowButton()
- })
+ {text : this.model && app.helpers.textFormatter(bio, this.model) })
},
pulsateNewPostControl : function() {
@@ -115,13 +113,4 @@ app.pages.Profile = app.views.Base.extend({
if(!confirm("Are you sure you want to log out?"))
evt.preventDefault();
},
-
- followingEnabled : function() {
- var user = app.currentUser
- return user.get("following_count") != 0 && user.get("diaspora_id") !== undefined
- },
-
- showFollowButton : function() {
- return this.followingEnabled() && !this.model.get("is_own_profile")
- }
});
View
6 app/assets/javascripts/app/pages/stream.js
@@ -22,8 +22,12 @@ app.pages.Stream = app.views.Base.extend({
this.streamView = new app.views.NewStream({ model : this.stream })
var interactions = this.interactionsView = new app.views.StreamInteractions()
- this.on("frame:interacted", function(post){
+ this.stream.on("frame:interacted", function(post){
interactions.setInteractions(post)
})
+ },
+
+ postRenderTemplate : function() {
+ this.$("#header").css("background-image", "url(" + app.currentUser.get("wallpaper") + ")")
}
});
View
2 app/assets/javascripts/app/views.js
@@ -122,7 +122,7 @@ app.views.InfScroll = app.views.Base.extend({
},
createPostView : function(post){
- var postView = new this.postClass({ model: post });
+ var postView = new this.postClass({ model: post, stream: this.stream });
this.postViews.push(postView)
return postView
},
View
3 app/assets/javascripts/app/views/comment_view.js
@@ -9,7 +9,8 @@ app.views.Comment = app.views.Content.extend({
});
},
- initialize : function(){
+ initialize : function(options){
+ this.templateName = options.templateName || this.templateName
this.model.on("change", this.render, this)
},
View
3 app/assets/javascripts/app/views/post-viewer/reactions.js
@@ -38,7 +38,8 @@ app.views.PostViewerReactions = app.views.Base.extend({
this.$("#post-comments").append(new app.views.Comment({
model: comment,
- className : "post-comment media"
+ className : "post-comment media",
+ templateName : "post-viewer/comment"
}).render().el);
}
});
View
9 app/assets/javascripts/app/views/post/small_frame.js
@@ -13,6 +13,11 @@ app.views.Post.SmallFrame = app.views.Post.extend({
'.embed-frame' : "oEmbedView"
},
+ initialize : function(options) {
+ this.stream = options.stream;
+ this.addStylingClasses()
+ },
+
oEmbedView : function(){
return new app.views.OEmbed({model : this.model})
},
@@ -28,10 +33,6 @@ app.views.Post.SmallFrame = app.views.Post.extend({
})
},
- initialize : function() {
- this.addStylingClasses()
- },
-
postRenderTemplate : function() {
this.addStylingClasses()
},
View
21 app/assets/javascripts/app/views/post/stream_frame.js
@@ -1,25 +1,24 @@
app.views.Post.StreamFrame = app.views.Base.extend({
-
className : "stream-frame",
templateName : "stream-frame",
subviews : {
- ".small-frame" : "smallFrameView"
+ ".small-frame" : "smallFrameView",
+ '.stream-frame-feedback' : 'feedbackView'
},
- initialize : function() {
+ initialize : function(options) {
+ this.stream = options.stream
this.smallFrameView = new app.views.Post.SmallFrame({model : this.model})
+ this.feedbackView = new app.views.FeedbackActions({ model: this.model })
},
- events : _.extend({
+ events : {
'click .content' : 'triggerInteracted'
- }, app.views.Post.SmallFrame.prototype.events),
-
- triggerInteracted : function() {
- app.page.trigger("frame:interacted", this.model)
},
- // this is some gross shit.
- goToPost : $.noop
-});
+ triggerInteracted : function() {
+ this.stream.trigger("frame:interacted", this.model)
+ }
+});
View
7 app/assets/javascripts/app/views/post/stream_interactions_view.js
@@ -1,9 +1,7 @@
app.views.StreamInteractions = app.views.Base.extend({
-
id : "post-info",
subviews:{
- ".feedback" : "feedback",
".comments" : "comments",
".new-comment" : "newCommentView"
},
@@ -16,12 +14,7 @@ app.views.StreamInteractions = app.views.Base.extend({
this.render()
}, this));
- this.feedback = new app.views.FeedbackActions({ model: model })
this.comments = new app.views.PostViewerReactions({ model: model.interactions })
this.newCommentView = new app.views.PostViewerNewComment({ model : model })
- },
-
- postRenderTemplate : function(){
- console.log(this.$el)
}
});
View
24 app/assets/stylesheets/new_styles/_base.scss
@@ -281,6 +281,30 @@ $bring-dark-accent-forward-color: #DDD;
}
}
+#header {
+ position : fixed;
+ top : 0;
+ width : 100%;
+ padding : 15px;
+ z-index : 30;
+
+ -webkit-box-shadow : inset 0 -10px 10px -8px rgba(0,0,0,0.8);
+ -moz-box-shadow : inset 0 -10px 10px -8px rgba(0,0,0,0.8);
+
+ border-bottom : 1px solid #333;
+
+ color : #fff;
+ background : {
+ color : #333;
+ size : cover;
+ attachment : fixed;
+ }
+
+ h1 {
+ @include opacity(0.4);
+ }
+}
+
/* bootstrap label fixes for Roboto */
.label {
padding : 2px 5px;
View
32 app/assets/stylesheets/new_styles/_canvas.scss
@@ -369,16 +369,40 @@
/* new stream overrides */
#stream {
color : #fff;
- background-color : #333;
-}
+ background-color : #222;
+
+ .background {
+ @include box-shadow(-2px, 0, 7px, rgba(0,0,0,0.8));
+ position : fixed;
+ height : 100%;
+ width : 100%;
+
+ background : {
+ color : #333;
+ image : image_url("hatched-bg-dark.png");
+ }
+ }
+
+ #stream-interactions,
+ #stream-content {
+ padding-top : 90px;
+ }
+}
#stream-content {
.stream-frame {
margin-bottom : 40px;
- .info {
- display : none;
+ .stream-frame-feedback {
+ float : right;
+ margin-top : 8px;
+ }
+
+ .canvas-frame {
+ .info {
+ display : none;
+ }
}
/* a media box object */
View
65 app/assets/stylesheets/new_styles/_composer.scss
@@ -43,6 +43,36 @@
padding : 10px;
}
+ .template-picker {
+ margin-bottom : 1em;
+
+ input {
+ display : none;
+ }
+
+ label {
+ @include transition(background-color);
+ @include border-radius();
+
+ cursor : pointer;
+
+ margin-right: 11px;
+ padding: 7px;
+ color: #999;
+ font-size: 14px;
+ line-height: 2em;
+
+ &:hover {
+ background-color: #222;
+ text-decoration: none;
+ }
+ }
+
+ input:checked + label {
+ background-color: #222;
+ }
+ }
+
.flow-controls {
padding: 20px 0;
max-height: 68px;
@@ -84,45 +114,12 @@
}
.service-selector {
- margin-left: 100px;
display : inline-block;
}
.dropdown-menu {
text-align: left;
}
-
- .template-picker {
- margin-bottom : 1em;
-
- input {
- display : none;
- }
-
- label {
- @include transition(background-color);
- @include border-radius();
-
- cursor : pointer;
-
- display: inline;
- margin-right: 11px;
- padding: 7px;
- color: #999;
- font-size: 14px;
- line-height: 2em;
-
- &:hover {
- background-color: #222;
- text-decoration: none;
- }
- }
-
- input:checked + label {
- background-color: #222;
- }
- }
-
}
// this is about the service toggle icons, there is a jasmine test that tests this in service_selector spec
@@ -171,7 +168,7 @@ input[type="image"] {
}
}
-#controls-wrapper {
+.flow-controls {
text-align : center;
}
View
17 app/assets/stylesheets/new_styles/_interactions.scss
@@ -227,6 +227,7 @@
}
}
+.permalink-wrapper,
#user-controls {
height: 30px;
@@ -236,10 +237,9 @@
width: 27px;
}
- .label {
+ a {
@include opacity(0.6);
@include transition(opacity, 0.3s);
- @include box-shadow(0, 0, 2px, rgba(255,255,255,0.9));
position: relative;
@@ -257,9 +257,13 @@
margin: 0;
}
- background-color: #000;
color: #fff;
+ &.label {
+ @include box-shadow(0, 0, 2px, rgba(255,255,255,0.9));
+ background-color: #000;
+ }
+
&.comment {
padding-right: 5px;
margin-right: 0;
@@ -325,4 +329,11 @@
#user-controls {
padding : 7px;
}
+}
+
+.permalink-wrapper {
+ float : right;
+ margin-top : 9px;
+ margin-right : -5px;
+ margin-left : 4px;
}
View
6 app/assets/templates/composer-controls.jst.hbs
@@ -1,4 +1,2 @@
-<div id='controls-wrapper'>
- <input type="image" src="{{imageUrl "buttons/close@2x.png"}}" class="cancel" />
- <input type="image" src="{{imageUrl "buttons/next_hov@2x.png"}}" class="next"/>
-</div>
+<input type="image" src="{{imageUrl "buttons/close@2x.png"}}" class="cancel" />
+<input type="image" src="{{imageUrl "buttons/next_hov@2x.png"}}" class="next" />
View
8 app/assets/templates/flow.jst.hbs
@@ -1,15 +1,13 @@
<div id="framer">
<div class="container">
<div class="row">
- <div class="span8 offset2">
+ <div class="span6 offset3">
<div class="row">
<div class="flow-content"/>
</div>
<div class="row">
- <div class="span8">
- <div class="flow-controls">
- <div class="controls"/>
- </div>
+ <div class="flow-controls">
+ <div class="controls"/>
</div>
</div>
</div>
View
8 app/assets/templates/framer-content.jst.hbs
@@ -0,0 +1,8 @@
+<div class="preview"> </div>
+
+<div class='template-picker'>
+ {{#each templates}}
+ <input id='frame_name_{{name}}' name="frame_name" type="radio" class="mood" value={{name}} {{#if checked}}checked=checked{{/if}} />
+ <label for='frame_name_{{name}}'>{{name}}</label>
+ {{/each}}
+</div>
View
20 app/assets/templates/framer-controls.jst.hbs
@@ -1,16 +1,4 @@
-<div>
- <div class='template-picker'>
- {{#each templates}}
- <input id='frame_name_{{name}}' name="frame_name" type="radio" class="mood" value={{name}} {{#if checked}}checked=checked{{/if}} />
- <label for='frame_name_{{name}}'>{{name}}</label>
- {{/each}}
- </div>
-
- <div class="aspect-selector"/>
- <div class="service-selector"/>
-</div>
-
-<div id='controls-wrapper'>
- <input type="image" src="{{imageUrl "buttons/back_hov@2x.png"}}" class="back"/>
- <input type="image" src="{{imageUrl "buttons/done_hov@2x.png"}}" class="done" />
-</div>
+<input type="image" src="{{imageUrl "buttons/back_hov@2x.png"}}" class="back" />
+<div class="aspect-selector"/>
+<div class="service-selector"/>
+<input type="image" src="{{imageUrl "buttons/done_hov@2x.png"}}" class="done" />
View
18 app/assets/templates/post-form.jst.hbs
@@ -1,14 +1,12 @@
-<h3 class="span8">
+<h3>
Make something!
</h3>
-<div class="span8 new_picture"/>
+<div class="new_picture"/>
-<div class='span8'>
- <form class="new-post">
- <fieldset>
- <textarea name="text" id='post_text' class="text span8" placeholder="Add Text">{{text}}</textarea>
- <textarea id="text_with_markup" style="display:none;"/>
- </fieldset>
- </form>
-</div>
+<form class="new-post">
+ <fieldset>
+ <textarea name="text" id='post_text' class="text span8" placeholder="Add Text">{{text}}</textarea>
+ <textarea id="text_with_markup" style="display:none;"/>
+ </fieldset>
+</form>
View
30 app/assets/templates/post-viewer/comment.jst.hbs
@@ -1,15 +1,27 @@
+{{#if canRemove}}
+<div class="controls">
+ <a href="#" class="delete comment_delete" title="{{t "delete"}}">
+ <img alt="Deletelabel" src="{{imageUrl "deletelabel.png"}}" />
+ <a/>
+</div>
+{{/if}}
+
<div class="img">
- {{#linkToPerson author}}
- {{{personImage this "small" "small"}}}
- {{/linkToPerson}}
+ {{#linkToPerson author}}
+ <div class="profile-image-container smaller" style="background-image : url('{{avatar.large}}')"></div>
+ {{/linkToPerson}}
</div>
<div class="bd">
- {{#linkToPerson author}}
- {{name}}
- {{/linkToPerson}}
+ <a href="/people/{{author.guid}}" class="author author-name">
+ {{author.name}}
+ </a>
+
+ <div class="collapsible comment-content">
+ {{{text}}}
+ </div>
- <div class="comment-content">
- {{{text}}}
- </div>
+ <div class="info">
+ <time class="timeago" datetime="{{created_at}}"/>
+ </div>
</div>
View
25 app/assets/templates/profile.jst.hbs
@@ -4,17 +4,6 @@
<div class="container">
<div id="top-right-nav">
- {{#if showFollowButton}}
- <a href="#" onClick="alert('Not yet implemented!')" id="follow-button">
- <span class="label label-inverse">
- <i class="icon-plus icon-white"></i>
- <span>
- FOLLOW
- </span>
- </span>
- </a>
- {{/if}}
-
{{#if current_user.guid}}
<a href="/" id="home-button">
<span class="label label-inverse">
@@ -24,6 +13,12 @@
</span>
</span>
</a>
+
+ <a href="/users/sign_out" title="Log out" id="logout-button">
+ <span class="label label-inverse">
+ <i class="icon-off icon-white"></i>
+ </span>
+ </a>
{{else}}
<a href="/" id="home-button">
<span class="label label-inverse">
@@ -33,14 +28,6 @@
</span>
</a>
{{/if}}
-
- {{#if is_own_profile}}
- <a href="/users/sign_out" title="Log out" id="logout-button">
- <span class="label label-inverse">
- <i class="icon-off icon-white"></i>
- </span>
- </a>
- {{/if}}
</div>
<section id="profile-info"/>
View
7 app/assets/templates/stream-frame.jst.hbs
@@ -1,3 +1,10 @@
+<div class="permalink-wrapper info">
+ <a href="/p/{{guid}}">
+ <i class="icon-zoom-in icon-white"></i>
+ </a>
+</div>
+<div class='stream-frame-feedback'></div>
+
<div class="media author">
{{#linkToPerson author}}
<div class="img">
View
55 app/assets/templates/stream.jst.hbs
@@ -1,6 +1,61 @@
+<div id="header">
+ <div class="container" style="position:relative;">
+
+ <div id="top-right-nav">
+ {{#if current_user.guid}}
+ <a href="/notifications" title="Notifications" id="notifications-button">
+ <span class="label label-inverse">
+ {{current_user.notifications_count}}
+ </span>
+ </a>
+
+ <a href="/people/{{current_user.guid}}?ex=true" id="profile-button">
+ <span class="label label-inverse">
+ <i class="icon-user icon-white"></i>
+ <span>
+ PROFILE
+ </span>
+ </span>
+ </a>
+
+ <a href="/" id="home-button">
+ <span class="label label-inverse">
+ <i class="icon-home icon-white"></i>
+ <span>
+ HOME
+ </span>
+ </span>
+ </a>
+
+ <a href="/users/sign_out" title="Log out" id="logout-button">
+ <span class="label label-inverse">
+ <i class="icon-off icon-white"></i>
+ </span>
+ </a>
+ {{else}}
+ <a href="/" id="home-button">
+ <span class="label label-inverse">
+ <span>
+ DIASPORA
+ </span>
+ </span>
+ </a>
+ {{/if}}
+ </div>
+
+ <h1>
+ DIASPORA
+ </h1>
+ </div>
+</div>
+
<div id="stream">
<div class="container">
<div class="row">
+ <div class="background offset5"></div>
+ </div>
+
+ <div class="row">
<section id="stream-content" class="span4 offset1"/>
<!--Since stream-interactions is fixed, we need a double span5 declaration here :(-->
View
7 app/presenters/user_presenter.rb
@@ -13,7 +13,8 @@ def to_json(options = {})
:aspects => aspects,
:services => services,
:following_count => self.user.contacts.receiving.count,
- :configured_services => self.configured_services
+ :configured_services => self.configured_services,
+ :wallpaper => self.wallpaper
}
).to_json(options)
end
@@ -26,6 +27,10 @@ def configured_services
user.services.map{|service| service.provider }
end
+ def wallpaper
+ user.person.profile.wallpaper.url
+ end
+
def aspects
AspectPresenter.as_collection(user.aspects)
end
View
2 app/views/sessions/new.html.erb
@@ -15,7 +15,7 @@
</label>
<div class="controls">
- <%= f.text_field :username, :required => true, :pattern => "[A-Za-z0-9_]+", :autocapitalize => "off", :autocorrect => "off" %>
+ <%= f.text_field :username, :required => true, :pattern => "[A-Za-z0-9_.@\-]+", :autocapitalize => "off", :autocorrect => "off" %>
</div>
</div>
View
1 config/initializers/load_analyitics.rb
@@ -6,6 +6,7 @@
if Rails.env == 'production'
Diaspora::Application.configure do
if AppConfig[:piwik_url].present?
+ require 'rack/piwik'
config.gem 'rack-piwik', :lib => 'rack/piwik'
config.middleware.use Rack::Piwik, :piwik_url => AppConfig[:piwik_url], :piwik_id => AppConfig[:piwik_id]
end
View
4 features/support/publishing_cuke_helpers.rb
@@ -38,11 +38,11 @@ def first_post_text
end
def frame_numbers_content(position)
- find(".canvas-frame:nth-child(#{position}) .content")
+ find(".stream-frame:nth-child(#{position}) .content")
end
def find_frame_by_text(text)
- find(".canvas-frame:contains('#{text}')")
+ find(".stream-frame:contains('#{text}')")
end
def stream_element_numbers_content(position)
View
4 spec/javascripts/app/pages/framer_spec.js
@@ -8,10 +8,6 @@ describe("app.pages.Framer", function(){
expect(this.model).toBe(app.frame) //uses global state of app.frame :/
});
- it("passes the model down to the post view", function(){
- expect(this.page.postView().model).toBe(app.frame)
- });
-
describe("navigation on save", function(){
it("navigates to the current user's profile page", function(){
spyOn(app.router, "navigate")
View
43 spec/javascripts/app/pages/profile_spec.js
@@ -63,18 +63,6 @@ describe("app.pages.Profile", function(){
this.page.render()
expect(this.page.$("#profile-controls .control").length).toBe(2)
})
-
- it("shows a follow button if showFollowButton returns true", function() {
- spyOn(this.page, "showFollowButton").andReturn(true)
- this.page.render()
- expect(this.page.$("#follow-button").length).toBe(1)
- })
-
- it("doesn't show a follow button if showFollowButton returns false", function() {
- spyOn(this.page, "showFollowButton").andReturn(false)
- this.page.render()
- expect(this.page.$("#follow-button").length).toBe(0)
- })
})
context("clicking fav", function(){
@@ -170,35 +158,4 @@ describe("app.pages.Profile", function(){
})
})
});
-
- describe("followingEnabled", function(){
- /* for legacy beta testers */
- it("returns false if following_count is zero", function(){
- loginAs({following_count : 0})
- expect(this.page.followingEnabled()).toBeFalsy()
- })
-
- it("returns false if the user is not signed in", function(){
- logout()
- expect(this.page.followingEnabled()).toBeFalsy()
- })
-
- it("returns false if following_count is zero", function(){
- loginAs({following_count : 1})
- expect(this.page.followingEnabled()).toBeTruthy()
- })
- })
-
- describe("followingEnabled", function(){
- /* for legacy beta testers */
- it("returns false if following_count is zero", function(){
- app.currentUser.set({following_count : 0})
- expect(this.page.followingEnabled()).toBeFalsy()
- })
-
- it("returns false if following_count is zero", function(){
- app.currentUser.set({following_count : 1})
- expect(this.page.followingEnabled()).toBeTruthy()
- })
- })
});
View
22 spec/javascripts/app/pages/stream_spec.js
@@ -0,0 +1,22 @@
+describe("app.Pages.Stream", function(){
+ beforeEach(function(){
+ app.setPreload("stream", [factory.post().attributes])
+ this.page = new app.pages.Stream()
+ this.post = this.page.model.items.models[0]
+ expect(this.post).toBeTruthy()
+ })
+
+ describe("rendering", function(){
+ beforeEach(function(){
+ this.page.render()
+ })
+
+ context("clicking the content", function(){
+ it("triggers frame interacted", function(){
+ spyOn(this.post.interactions, "fetch").andReturn(new $.Deferred)
+ this.page.$('.canvas-frame:first .content').click()
+ expect(this.post.interactions.fetch).toHaveBeenCalled()
+ })
+ })
+ })
+});
View
17 spec/javascripts/app/views/post/stream_frame_spec.js
@@ -1,18 +1,23 @@
describe("app.views.Post.StreamFrame", function(){
beforeEach(function(){
this.post = factory.post()
- this.view = new app.views.Post.StreamFrame({model : this.post})
- app.page = new app.pages.Stream({model : new app.models.Stream()})
+ this.stream = new Backbone.Model
+ this.view = new app.views.Post.StreamFrame({model : this.post, stream: this.stream })
})
describe("rendering", function(){
+ beforeEach(function(){
+ this.view.render()
+ })
+
context("clicking the content", function(){
- it("fetches the interaction pane", function(){
- spyOn(this.post.interactions, "fetch").andReturn(new $.Deferred)
- this.view.render()
+ it("triggers frame interacted", function(){
+ var spy = jasmine.createSpy()
+ this.stream.on("frame:interacted", spy)
this.view.$('.content').click()
- expect(this.post.interactions.fetch).toHaveBeenCalled()
+ expect(spy).toHaveBeenCalledWith(this.post)
})
+
})
})
});

No commit comments for this range

Something went wrong with that request. Please try again.