fix .avatar declaration in the header template; make socketing always return nil straight away (we are not using the websocket in this branch, and it makes everything faster when it's off)

This commit is contained in:
danielgrippi 2011-12-29 16:23:50 -05:00 committed by Dennis Collinson
parent 42276a73c8
commit 565a0b21f7
6 changed files with 13 additions and 112 deletions

View file

@ -65,6 +65,7 @@
Diaspora.Page = "#{params[:controller].camelcase}#{params[:action].camelcase}";
- if current_user
:javascript
app.user({
current_user: #{current_user.person.as_api_response(:backbone).to_json}
});

View file

@ -68,9 +68,7 @@
<div class="right">
</div>
<div class="avatar">
<img alt="<%= current_user.name %>" class="avatar" data-person_id="<%= current_user.id %>" src="<%= current_user.avatar.small %>" title="Bob Grimm">
</div>
<img alt="<%= current_user.name %>" class="avatar" data-person_id="<%= current_user.id %>" src="<%= current_user.avatar.small %>" title="<%= current_user.name %>" />
<a href="#"><%= current_user.name %></a>
</li>
<li><a href="/people/<%= current_user.id %>">Profile</a></li>

View file

@ -35,7 +35,7 @@ Feature: User manages contacts
Scenario: deleting an aspect from homepage
Given I am signed in
And I have an aspect called "People"
When I am on the home page
When I am on the aspects page
And I click on "People" aspect edit icon
And I wait for the ajax to finish
And I preemptively confirm the alert

View file

@ -1,38 +0,0 @@
(function() {
var Likes = function() {
var self = this;
this.subscribe("widget/ready", function(evt, likesContainer) {
$.extend(self, {
likesContainer: likesContainer,
likesList: likesContainer.find(".likes_list"),
loadingImage: $("<img/>", { src: "/images/ajax-loader.gif" }),
expander: likesContainer.find("a.expand_likes")
});
self.expander.click(self.expandLikes);
});
this.expandLikes = function(evt) {
evt.preventDefault();
if(self.likesList.children().length == 0) {
self.loadingImage.appendTo(self.likesContainer);
$.get(self.expander.attr('href'), function(data) {
self.loadingImage.fadeOut(100, function() {
self.expander.fadeOut(100, function(){
self.likesList.html(data)
.fadeToggle(100);
});
});
});
}
else {
self.likesList.fadeToggle(100);
}
};
};
Diaspora.Widgets.Likes = Likes;
})();

View file

@ -61,6 +61,12 @@ form
:display none
.avatar
:-webkit-box-shadow rgba(0,0,0,0.12) 0px 0px 5px inset
:-moz-box-shadow rgba(0,0,0,0.12) 0px 0px 5px inset
:background
:color #eee
:width 50px
:height 50px
@ -252,11 +258,11 @@ header
:border 1px solid #999
.avatar
:height 20px
:width 20px
:height 22px
:width 22px
:position absolute
:left 4px
:top 5px
:left 7px
:top 9px
:display block
header.ie-user-menu-active

View file

@ -1,66 +0,0 @@
describe("Diaspora.Widgets.Likes", function() {
var likes;
beforeEach(function() {
spec.readFixture("ajax_likes_on_post");
spec.loadFixture("aspects_index_with_a_post_with_likes");
likes = Diaspora.BaseWidget.instantiate("Likes", $(".stream_element .likes_container"));
jasmine.Ajax.useMock();
$.fx.off = true;
});
describe("integration", function() {
beforeEach(function() {
likes = new Diaspora.Widgets.Likes();
spyOn(likes, "expandLikes");
likes.publish("widget/ready", [$(".stream_element .likes_container")]);
});
it("calls expandLikes when you click on the expand likes link", function() {
$(".stream_element a.expand_likes").click();
expect(likes.expandLikes).toHaveBeenCalled();
});
});
describe("expandLikes", function() {
it("makes an ajax request if the list does not have children", function() {
spyOn($, "ajax");
likes.expandLikes($.Event());
expect($.ajax).toHaveBeenCalled();
});
it("does not make an ajax request if the list has children", function() {
spyOn($, "ajax");
$(".stream_element .likes_list").html("<span></span>");
likes.expandLikes($.Event());
expect($.ajax).not.toHaveBeenCalled();
});
it("makes the likes list's html the response of the request", function() {
spyOn($, "ajax").andCallThrough();
likes.expandLikes($.Event());
mostRecentAjaxRequest().response({
responseHeaders: {
"Content-type": "text/html"
},
responseText: spec.readFixture("ajax_likes_on_post"),
status: 200
});
expect($(".stream_element .likes_list").html()).toEqual(spec.readFixture("ajax_likes_on_post"));
});
});
afterEach(function() {
$.fx.off = false;
});
});