removed top-level element delcarations from app templates
This commit is contained in:
parent
64a90a30ef
commit
85b5974fa9
10 changed files with 137 additions and 128 deletions
|
|
@ -1,30 +1,28 @@
|
|||
<li id="<%= id %>" class="comment">
|
||||
<div class="right controls">
|
||||
<!-- need access to post -->
|
||||
<% if(author.id === current_user.id) { %>
|
||||
<a href="#" class="delete comment_delete" title="Delete">
|
||||
<img alt="Deletelabel" src="/images/deletelabel.png" />
|
||||
<a/>
|
||||
<% } %>
|
||||
<div class="right controls">
|
||||
<!-- need access to post -->
|
||||
<% if(author.id === current_user.id) { %>
|
||||
<a href="#" class="delete comment_delete" title="Delete">
|
||||
<img alt="Deletelabel" src="/images/deletelabel.png" />
|
||||
<a/>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
<a href="/people/<%= author.id %>">
|
||||
<img src="<%= author.avatar.small %>" class="avatar" data-person-id="<%= author.id %>"/>
|
||||
</a>
|
||||
|
||||
<div class="content">
|
||||
<span class="from">
|
||||
<a href="/people/<%= author.id %>">
|
||||
<%= author.name %>
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<p>
|
||||
<%= text %>
|
||||
</p>
|
||||
|
||||
<div class="comment_info">
|
||||
<time class="timeago" datetime="<%= created_at %>"/>
|
||||
</div>
|
||||
|
||||
<a href="/people/<%= author.id %>">
|
||||
<img src="<%= author.avatar.small %>" class="avatar" data-person-id="<%= author.id %>"/>
|
||||
</a>
|
||||
|
||||
<div class="content">
|
||||
<span class="from">
|
||||
<a href="/people/<%= author.id %>">
|
||||
<%= author.name %>
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<p>
|
||||
<%= text %>
|
||||
</p>
|
||||
|
||||
<div class="comment_info">
|
||||
<time class="timeago" datetime="<%= created_at %>"/>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,32 +1,29 @@
|
|||
<div class="comment_stream">
|
||||
<% if(typeof(all_comments_loaded) == 'undefined' || !all_comments_loaded) { %>
|
||||
<ul class="show_comments <%= comments_count <= 3 ? 'hidden' : '' %>">
|
||||
<li>
|
||||
<a href="/posts/<%= id %>/comments" class="toggle_post_comments">
|
||||
Show <%= comments_count - 3 %> more comments
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<% } %>
|
||||
|
||||
<% if(typeof(all_comments_loaded) == 'undefined' || !all_comments_loaded) { %>
|
||||
<ul class="show_comments <%= comments_count <= 3 ? 'hidden' : '' %>">
|
||||
<li>
|
||||
<a href="/posts/<%= id %>/comments" class="toggle_post_comments">
|
||||
Show <%= comments_count - 3 %> more comments
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<% } %>
|
||||
<ul class="comments"> </ul>
|
||||
|
||||
<ul class="comments"> </ul>
|
||||
<% if(current_user) { %>
|
||||
<div class="new_comment_form_wrapper <%= comments_count > 0 ? '' : 'hidden' %>">
|
||||
<form accept-charset="UTF-8" action="/posts/<%= id %>/comments" class="new_comment" id="new_comment_on_<%= id %>" method="post">
|
||||
<a href="/people/<%= current_user.id %>">
|
||||
<img src="<%= current_user.avatar.small %>" class="avatar" data-person-id="<%= current_user.id %>"/>
|
||||
</a>
|
||||
|
||||
<% if(current_user) { %>
|
||||
<div class="new_comment_form_wrapper <%= comments_count > 0 ? '' : 'hidden' %>">
|
||||
<form accept-charset="UTF-8" action="/posts/<%= id %>/comments" class="new_comment" id="new_comment_on_<%= id %>" method="post">
|
||||
<a href="/people/<%= current_user.id %>">
|
||||
<img src="<%= current_user.avatar.small %>" class="avatar" data-person-id="<%= current_user.id %>"/>
|
||||
</a>
|
||||
|
||||
<p>
|
||||
<label for="comment_text_on_<%= id %>">Comment</label>
|
||||
<textarea class="comment_box" id="comment_text_on_<%= id %>" name="text" rows="2" />
|
||||
</p>
|
||||
<div class="submit_button">
|
||||
<input class="button creation" id="comment_submit_<%= id %>" name="commit" type="submit" value="Comment" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
<p>
|
||||
<label for="comment_text_on_<%= id %>">Comment</label>
|
||||
<textarea class="comment_box" id="comment_text_on_<%= id %>" name="text" rows="2" />
|
||||
</p>
|
||||
<div class="submit_button">
|
||||
<input class="button creation" id="comment_submit_<%= id %>" name="commit" type="submit" value="Comment" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<% } %>
|
||||
|
|
|
|||
|
|
@ -1,23 +1,21 @@
|
|||
<div class="info">
|
||||
<span class="post_scope">
|
||||
<%= public ? "Public" : "Limited" %>
|
||||
</span>
|
||||
–
|
||||
<span class="post_scope">
|
||||
<%= public ? "Public" : "Limited" %>
|
||||
</span>
|
||||
–
|
||||
|
||||
<a href="#" class="like_action" rel='nofollow'>
|
||||
<%= user_like ? "Unlike" : "Like" %>
|
||||
<a href="#" class="like_action" rel='nofollow'>
|
||||
<%= user_like ? "Unlike" : "Like" %>
|
||||
</a>
|
||||
·
|
||||
|
||||
<% if(public && author.id != current_user.id) { %>
|
||||
<a href="#" class="reshare_action" rel='nofollow'>
|
||||
Reshare
|
||||
</a>
|
||||
·
|
||||
<% } %>
|
||||
|
||||
<% if(public && author.id != current_user.id) { %>
|
||||
<a href="#" class="reshare_action" rel='nofollow'>
|
||||
Reshare
|
||||
</a>
|
||||
·
|
||||
<% } %>
|
||||
|
||||
<a href="#" class="focus_comment_textarea" rel="nofollow">
|
||||
Comment
|
||||
</a>
|
||||
</div>
|
||||
<a href="#" class="focus_comment_textarea" rel="nofollow">
|
||||
Comment
|
||||
</a>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,55 +1,53 @@
|
|||
<div id="<%= guid %>" class="stream_element">
|
||||
<div class="right controls">
|
||||
<% if(author.id != current_user.id) { %>
|
||||
<img src="/images/icons/ignoreuser.png" alt="Ignoreuser" class="block_user control_icon" title= "Ignore" data-person_id="<%= author.id %>" />
|
||||
<% } else { %>
|
||||
<img src="/images/deletelabel.png" class="delete control_icon remove_post" title="Delete" />
|
||||
<div class="right controls">
|
||||
<% if(author.id != current_user.id) { %>
|
||||
<img src="/images/icons/ignoreuser.png" alt="Ignoreuser" class="block_user control_icon" title= "Ignore" data-person_id="<%= author.id %>" />
|
||||
<% } else { %>
|
||||
<img src="/images/deletelabel.png" class="delete control_icon remove_post" title="Delete" />
|
||||
<% } %>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="sm_body">
|
||||
|
||||
<a href="/people/<%= author.id %>">
|
||||
<img src="<%= author.avatar.small %>" class="avatar" data-person_id="<%= author.id %>"/>
|
||||
</a>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<div class="post_initial_info">
|
||||
<span class="from">
|
||||
<a href="/people/<%= author.id %>">
|
||||
<%= author.name %>
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<span class="details">
|
||||
-
|
||||
<a href="/posts/<%= id %>">
|
||||
<time class="timeago" datetime="<%= created_at %>"/>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<% if(text !== null && text.match(/#nsfw/)) { %>
|
||||
<div class="shield_wrapper">
|
||||
<div class="shield">
|
||||
This post has been flagged as NSFW by its author.
|
||||
<a href="#">
|
||||
show
|
||||
</a>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
</div>
|
||||
<div class="post-content"> </div>
|
||||
|
||||
<div class="sm_body">
|
||||
|
||||
<a href="/people/<%= author.id %>">
|
||||
<img src="<%= author.avatar.small %>" class="avatar" data-person_id="<%= author.id %>"/>
|
||||
</a>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<div class="post_initial_info">
|
||||
<span class="from">
|
||||
<a href="/people/<%= author.id %>">
|
||||
<%= author.name %>
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<span class="details">
|
||||
-
|
||||
<a href="/posts/<%= id %>">
|
||||
<time class="timeago" datetime="<%= created_at %>"/>
|
||||
</a>
|
||||
</span>
|
||||
<% if(text !== null && text.match(/#nsfw/)) { %>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
<% if(text !== null && text.match(/#nsfw/)) { %>
|
||||
<div class="shield_wrapper">
|
||||
<div class="shield">
|
||||
This post has been flagged as NSFW by its author.
|
||||
<a href="#">
|
||||
show
|
||||
</a>
|
||||
</div>
|
||||
<% } %>
|
||||
<div class="feedback"> </div>
|
||||
<div class="likes"> </div>
|
||||
<div class="comments"> </div>
|
||||
|
||||
<div class="post-content"> </div>
|
||||
|
||||
<% if(text !== null && text.match(/#nsfw/)) { %>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
<div class="feedback"> </div>
|
||||
<div class="likes"> </div>
|
||||
<div class="comments"> </div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,20 @@ app.views.Comment = app.views.StreamObject.extend({
|
|||
|
||||
template_name: "#comment-template",
|
||||
|
||||
tagName : "li",
|
||||
|
||||
className : "comment loaded",
|
||||
|
||||
events : {
|
||||
"click .comment_delete": "destroyModel"
|
||||
},
|
||||
|
||||
initialize : function() {
|
||||
$(this.el).attr("id", this.model.get("guid"));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
postRenderTemplate : function(){
|
||||
this.$("time").timeago();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ app.views.CommentStream = app.views.Base.extend({
|
|||
|
||||
template_name: "#comment-stream-template",
|
||||
|
||||
className : "comment_stream",
|
||||
|
||||
events: {
|
||||
"submit form": "createComment",
|
||||
"focus .comment_box": "commentTextareaFocused",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
app.views.Feedback = app.views.StreamObject.extend({
|
||||
template_name: "#feedback-template",
|
||||
|
||||
className : "info loaded",
|
||||
|
||||
events: {
|
||||
"click .like_action": "toggleLike",
|
||||
"click .reshare_action": "resharePost"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ app.views.Post = app.views.StreamObject.extend({
|
|||
|
||||
template_name: "#stream-element-template",
|
||||
|
||||
className : "stream_element loaded",
|
||||
|
||||
events: {
|
||||
"click .focus_comment_textarea": "focusCommentTextarea",
|
||||
"click .shield a": "removeNsfwShield",
|
||||
|
|
@ -22,6 +24,9 @@ app.views.Post = app.views.StreamObject.extend({
|
|||
],
|
||||
|
||||
initialize : function() {
|
||||
// set the guid
|
||||
$(this.el).attr("id", this.model.get("guid"));
|
||||
|
||||
// commentStream view
|
||||
this.commentStreamView = new app.views.CommentStream({ model : this.model});
|
||||
this.likesInfoView = new app.views.LikesInfo({ model : this.model});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
app.views.StreamObject = app.views.Base.extend({
|
||||
className : "loaded",
|
||||
|
||||
initialize: function(options) {
|
||||
this.model.bind('remove', this.remove, this);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ describe("app.views.Stream", function(){
|
|||
// do this manually because we've moved loadMore into render??
|
||||
this.view.render();
|
||||
_.each(this.view.collection.models, function(post){
|
||||
this.view.appendPost(post);
|
||||
this.view.addPost(post);
|
||||
}, this);
|
||||
|
||||
this.statusElement = $(this.view.$("#" + this.statusMessage.get("guid")));
|
||||
|
|
@ -25,7 +25,7 @@ describe("app.views.Stream", function(){
|
|||
|
||||
context("when rendering a Status Mesasage", function(){
|
||||
it("shows the status message in the content area", function(){
|
||||
expect(this.statusElement.find(".post-content p").text()).toContain("hella infos yo!")
|
||||
expect(this.statusElement.find(".post-content p").text()).toContain("you're gonna love this")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue