stubbornella media and img dom structure FTW! major css deletion <3

This commit is contained in:
danielgrippi 2012-02-09 13:50:55 -08:00
parent 398ca3d97b
commit e6e49bbf1f
14 changed files with 231 additions and 957 deletions

View file

@ -3,15 +3,15 @@
-# the COPYRIGHT file. -# the COPYRIGHT file.
.stream_element{:id => person.id} .stream_element{:id => person.id}
.right .media
%div{:style => "float:right;margin-top:2px;"}
= render :partial => 'people/relationship_action', = render :partial => 'people/relationship_action',
:locals => { :person => person, :contact => contact, :locals => { :person => person, :contact => contact,
:current_user => current_user } :current_user => current_user }
.img
= person_image_link(person) = person_image_link(person)
.content .bd
%span.from
=person_link(person) =person_link(person)
.info .info

View file

@ -74,11 +74,5 @@
%p %p
#fileInfo #fileInfo
-if !aspect.nil? && aspect != :getting_started && current_user.person.has_photos?
%br
%br
%p
\...#{t('.or_select_one_existing', :photos => link_to(t('_photos'), person_photos_path(person))).html_safe}
#publisher_photo_upload #publisher_photo_upload

View file

@ -17,8 +17,8 @@ Feature: commenting
When I focus the comment field When I focus the comment field
And I fill in "text" with "is that a poodle?" And I fill in "text" with "is that a poodle?"
And I press "Comment" And I press "Comment"
Then I should see "is that a poodle?" within "li.comment div.content" Then I should see "is that a poodle?" within ".comment"
And I should see "less than a minute ago" within "li.comment time" And I should see "less than a minute ago" within ".comment time"
Scenario: comment on a photo from the photo page Scenario: comment on a photo from the photo page
When I sign in as "bob@bob.bob" When I sign in as "bob@bob.bob"
@ -27,8 +27,8 @@ Feature: commenting
And I focus the comment field And I focus the comment field
And I fill in "text" with "hahahah" And I fill in "text" with "hahahah"
And I press "Comment" And I press "Comment"
Then I should see "hahaha" within "li.comment div.content" Then I should see "hahaha" within ".comment"
And I should see "less than a minute ago" within "li.comment time" And I should see "less than a minute ago" within ".comment time"
Scenario: comment on your own photo from the photo page Scenario: comment on your own photo from the photo page
When I sign in as "alice@alice.alice" When I sign in as "alice@alice.alice"
@ -37,8 +37,8 @@ Feature: commenting
And I focus the comment field And I focus the comment field
And I fill in "text" with "hahahah" And I fill in "text" with "hahahah"
And I press "Comment" And I press "Comment"
Then I should see "hahaha" within "li.comment div.content" Then I should see "hahaha" within ".comment"
And I should see "less than a minute ago" within "li.comment time" And I should see "less than a minute ago" within ".comment time"
Scenario: delete a comment Scenario: delete a comment
When I sign in as "bob@bob.bob" When I sign in as "bob@bob.bob"

View file

@ -1,30 +1,32 @@
{{#unless all_comments_loaded}} {{#unless all_comments_loaded}}
<ul class="show_comments {{#unless showExpandCommentsLink}} hidden {{/unless}}"> <div class="show_comments comment {{#unless showExpandCommentsLink}} hidden {{/unless}}">
<li> <div class="media">
<a href="/posts/{{id}}/comments" class="toggle_post_comments"> <a href="/posts/{{id}}/comments" class="toggle_post_comments">
{{t "stream.more_comments" count=moreCommentsCount}} {{t "stream.more_comments" count=moreCommentsCount}}
</a> </a>
</li> </div>
</ul> </div>
{{/unless}} {{/unless}}
<ul class="comments"> </ul> <div class="comments"> </div>
{{#if current_user}} {{#if current_user}}
<div class="new_comment_form_wrapper {{#unless comments_count}} hidden {{/unless}}"> <div class="comment no-border">
<form accept-charset="UTF-8" action="/posts/{{id}}/comments" class="new_comment" id="new_comment_on_{{id}}" method="post"> <div class="media new_comment_form_wrapper {{#unless comments_count}} hidden {{/unless}}">
{{#with current_user}} {{#with current_user}}
<a href="/people/{{guid}}"> <a href="/people/{{guid}}" class="img">
<img src="{{avatar.small}}" class="avatar" /> <img src="{{avatar.small}}" class="avatar" />
</a> </a>
{{/with}} {{/with}}
<p> <div class="bd">
<form accept-charset="UTF-8" action="/posts/{{id}}/comments" class="new_comment" id="new_comment_on_{{id}}" method="post">
<textarea class="comment_box" id="comment_text_on_{{id}}" name="text" rows="2" placeholder="{{t "stream.comment"}}" /> <textarea class="comment_box" id="comment_text_on_{{id}}" name="text" rows="2" placeholder="{{t "stream.comment"}}" />
</p>
<div class="submit_button"> <div class="submit_button">
<input class="button creation" id="comment_submit_{{id}}" name="commit" type="submit" value="{{t "stream.comment"}}" /> <input class="button creation" id="comment_submit_{{id}}" name="commit" type="submit" value="{{t "stream.comment"}}" />
</div> </div>
</form> </form>
</div> </div>
</div>
</div>
{{/if}} {{/if}}

View file

@ -1,27 +1,28 @@
<div class="right controls"> <div class="media">
{{#if canRemove}} {{#if canRemove}}
<div class="controls">
<a href="#" class="delete comment_delete" title="{{t "delete"}}"> <a href="#" class="delete comment_delete" title="{{t "delete"}}">
<img alt="Deletelabel" src="{{imageUrl "/images/deletelabel.png"}}" /> <img alt="Deletelabel" src="{{imageUrl "/images/deletelabel.png"}}" />
<a/> <a/>
{{/if}}
</div> </div>
{{/if}}
<a href="/people/{{author.guid}}"> <a href="/people/{{author.guid}}" class="img">
<img src="{{author.avatar.small}}" class="avatar" /> <img src="{{author.avatar.small}}" class="avatar" />
</a> </a>
<div class="content"> <div class="bd">
<span class="from"> <a href="/people/{{author.guid}}" class="author">
<a href="/people/{{author.guid}}">
{{author.name}} {{author.name}}
</a> </a>
</span>
<div class="collapsible"> <div class="collapsible">
{{{text}}} {{{text}}}
</div> </div>
<div class="comment_info"> <div class="info">
<time class="timeago" datetime="{{created_at}}"/> <time class="timeago" datetime="{{created_at}}"/>
</div> </div>
</div> </div>
</div>

View file

@ -1,4 +1,4 @@
<span class="post_scope"> <span class="post_scope grey">
{{#if public}} {{#if public}}
{{t "stream.public"}} {{t "stream.public"}}
{{else}} {{else}}
@ -10,8 +10,8 @@
via {{provider_display_name}} via {{provider_display_name}}
</strong> </strong>
{{/if}} {{/if}}
</span>
</span>
<a href="#" class="like_action" rel='nofollow'> <a href="#" class="like_action" rel='nofollow'>
{{#if user_like}} {{#if user_like}}

View file

@ -1,24 +1,28 @@
{{#if likes_count}} {{#if hasLikes}}
<div class="comment">
<div class="media">
<span class="img">
<img alt="Heart" src="/images/icons/pin.png" /> <img alt="Heart" src="/images/icons/pin.png" />
{{#unless likes.length}} </span>
<div class="bd">
{{#unless likes.length}}
<a href="#" class="expand_likes"> <a href="#" class="expand_likes">
{{t "stream.likes" count=likes_count}} {{t "stream.likes" count=likes_count}}
</a> </a>
{{else}} {{else}}
<span class="likes_list">
{{#each likes}} {{#each likes}}
{{#with attributes.author}} {{#with attributes.author}}
<a href="/people/{{guid}}"> <a href="/people/{{guid}}">
<img src="{{avatar.small}}" class="avatar" title="{{name}}"/> <img src="{{avatar.small}}" class="avatar micro" title="{{name}}"/>
</a> </a>
{{/with}} {{/with}}
{{/each}} {{/each}}
</span>
{{/unless}} {{/unless}}
</div>
</div>
</div>
{{/if}} {{/if}}

View file

@ -14,7 +14,5 @@
{{/each}} {{/each}}
{{/if}} {{/if}}
<div class="collapsible">
{{{text}}} {{{text}}}
{{{o_embed_html}}} {{{o_embed_html}}}
</div>

View file

@ -1,7 +1,12 @@
<div class="right controls"> <div class="media">
{{#if current_user}}
<div class="controls">
{{#if authorIsCurrentUser}} {{#if authorIsCurrentUser}}
<a href="#" rel=nofollow> <a href="#" rel=nofollow>
<img src="/images/icons/ignoreuser.png" alt="Ignoreuser" class="block_user control_icon" title="{{t "ignore"}}" /> <img src="/images/icons/ignoreuser.png" alt="Ignoreuser" class="block_user control_icon" title="{{t "ignore"}}" />
</a>
<a href="#" rel=nofollow>
<img src="/images/deletelabel.png" class="delete control_icon hide_post" title="{{t "stream.hide"}}" /> <img src="/images/deletelabel.png" class="delete control_icon hide_post" title="{{t "stream.hide"}}" />
</a> </a>
{{else}} {{else}}
@ -9,28 +14,24 @@
<img src="/images/deletelabel.png" class="delete control_icon remove_post" title="{{t "delete"}}" /> <img src="/images/deletelabel.png" class="delete control_icon remove_post" title="{{t "delete"}}" />
</a> </a>
{{/if}} {{/if}}
</div> </div>
{{/if}}
<div class="sm_body">
{{#with author}} {{#with author}}
<a href="/people/{{guid}}"> <a href="/people/{{guid}}" class="img">
<img src="{{avatar.small}}" class="avatar" /> <img src="{{avatar.small}}" class="avatar" />
</a> </a>
{{/with}} {{/with}}
<div class="content"> <div class="bd">
<div>
<div class="post_initial_info">
<span class="from">
{{#with author}} {{#with author}}
<a href="/people/{{guid}}"> <a href="/people/{{guid}}" class="author">
{{name}} {{name}}
</a> </a>
{{/with}} {{/with}}
</span>
<span class="details"> <span class="details grey">
- -
<a href="/posts/{{id}}"> <a href="/posts/{{id}}">
<time class="timeago" datetime="{{created_at}}" /> <time class="timeago" datetime="{{created_at}}" />
@ -53,7 +54,7 @@
</div> </div>
{{/if}} {{/if}}
<div class="post-content"> </div> <div class="post-content collapsible"> </div>
{{#if nsfw}} {{#if nsfw}}
</div> </div>

View file

@ -45,7 +45,7 @@ app.views.CommentStream = app.views.Base.extend({
// on post ownership in the Comment view. // on post ownership in the Comment view.
comment.set({parent : this.model.toJSON()}) comment.set({parent : this.model.toJSON()})
this.$("ul.comments").append(new app.views.Comment({ this.$(".comments").append(new app.views.Comment({
model: comment model: comment
}).render().el); }).render().el);
}, },

View file

@ -2,8 +2,6 @@ app.views.Comment = app.views.Content.extend({
templateName: "comment", templateName: "comment",
tagName : "li",
className : "comment", className : "comment",
events : { events : {

View file

@ -2,8 +2,6 @@ app.views.LikesInfo = app.views.StreamObject.extend({
templateName : "likes-info", templateName : "likes-info",
className : "likes_container",
events : { events : {
"click .expand_likes" : "showAvatars" "click .expand_likes" : "showAvatars"
}, },
@ -11,7 +9,14 @@ app.views.LikesInfo = app.views.StreamObject.extend({
tooltipSelector : ".avatar", tooltipSelector : ".avatar",
presenter : function() { presenter : function() {
return _.extend(this.defaultPresenter(), {likes : this.model.likes.models}) return _.extend(this.defaultPresenter(), {
likes : this.model.likes.models,
hasLikes : this.hasLikes()
})
},
hasLikes : function() {
return this.model.likes.models.length > 0
}, },
showAvatars : function(evt){ showAvatars : function(evt){

File diff suppressed because it is too large Load diff

View file

@ -3,9 +3,9 @@ describe("app.views.LikesInfo", function(){
loginAs({id : -1, name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}}); loginAs({id : -1, name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}});
Diaspora.I18n.loadLocale({stream : { Diaspora.I18n.loadLocale({stream : {
likes : { pins : {
zero : "<%= count %> Likes", zero : "<%= count %> Pins",
one : "<%= count %> Like"} one : "<%= count %> Pin"}
} }
}) })
@ -18,7 +18,9 @@ describe("app.views.LikesInfo", function(){
it("displays a the like count if it is above zero", function() { it("displays a the like count if it is above zero", function() {
this.view.render(); this.view.render();
expect($(this.view.el).text()).toContain(Diaspora.I18n.t('stream.likes', {count : this.view.model.get("likes_count")})) console.log($(this.view.el))
expect($(this.view.el).text()).toContain(Diaspora.I18n.t('stream.pins', {count : this.view.model.get("likes_count")}))
}) })
it("does not display the like count if it is zero", function() { it("does not display the like count if it is zero", function() {