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">
|
||||||
<div class="right controls">
|
<!-- need access to post -->
|
||||||
<!-- need access to post -->
|
<% if(author.id === current_user.id) { %>
|
||||||
<% if(author.id === current_user.id) { %>
|
<a href="#" class="delete comment_delete" title="Delete">
|
||||||
<a href="#" class="delete comment_delete" title="Delete">
|
<img alt="Deletelabel" src="/images/deletelabel.png" />
|
||||||
<img alt="Deletelabel" src="/images/deletelabel.png" />
|
<a/>
|
||||||
<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>
|
</div>
|
||||||
|
</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>
|
|
||||||
|
|
|
||||||
|
|
@ -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="comments"> </ul>
|
||||||
<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>
|
<% 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) { %>
|
<p>
|
||||||
<div class="new_comment_form_wrapper <%= comments_count > 0 ? '' : 'hidden' %>">
|
<label for="comment_text_on_<%= id %>">Comment</label>
|
||||||
<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" />
|
||||||
<a href="/people/<%= current_user.id %>">
|
</p>
|
||||||
<img src="<%= current_user.avatar.small %>" class="avatar" data-person-id="<%= current_user.id %>"/>
|
<div class="submit_button">
|
||||||
</a>
|
<input class="button creation" id="comment_submit_<%= id %>" name="commit" type="submit" value="Comment" />
|
||||||
|
</div>
|
||||||
<p>
|
</form>
|
||||||
<label for="comment_text_on_<%= id %>">Comment</label>
|
</div>
|
||||||
<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>
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,21 @@
|
||||||
<div class="info">
|
<span class="post_scope">
|
||||||
<span class="post_scope">
|
<%= public ? "Public" : "Limited" %>
|
||||||
<%= public ? "Public" : "Limited" %>
|
</span>
|
||||||
</span>
|
–
|
||||||
–
|
|
||||||
|
|
||||||
<a href="#" class="like_action" rel='nofollow'>
|
<a href="#" class="like_action" rel='nofollow'>
|
||||||
<%= user_like ? "Unlike" : "Like" %>
|
<%= user_like ? "Unlike" : "Like" %>
|
||||||
|
</a>
|
||||||
|
·
|
||||||
|
|
||||||
|
<% if(public && author.id != current_user.id) { %>
|
||||||
|
<a href="#" class="reshare_action" rel='nofollow'>
|
||||||
|
Reshare
|
||||||
</a>
|
</a>
|
||||||
·
|
·
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<% if(public && author.id != current_user.id) { %>
|
<a href="#" class="focus_comment_textarea" rel="nofollow">
|
||||||
<a href="#" class="reshare_action" rel='nofollow'>
|
Comment
|
||||||
Reshare
|
</a>
|
||||||
</a>
|
|
||||||
·
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
<a href="#" class="focus_comment_textarea" rel="nofollow">
|
|
||||||
Comment
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,55 +1,53 @@
|
||||||
<div id="<%= guid %>" class="stream_element">
|
<div class="right controls">
|
||||||
<div class="right controls">
|
<% if(author.id != current_user.id) { %>
|
||||||
<% 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 %>" />
|
||||||
<img src="/images/icons/ignoreuser.png" alt="Ignoreuser" class="block_user control_icon" title= "Ignore" data-person_id="<%= author.id %>" />
|
<% } else { %>
|
||||||
<% } else { %>
|
<img src="/images/deletelabel.png" class="delete control_icon remove_post" title="Delete" />
|
||||||
<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">
|
<% if(text !== null && text.match(/#nsfw/)) { %>
|
||||||
|
|
||||||
<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>
|
</div>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<% if(text !== null && text.match(/#nsfw/)) { %>
|
<div class="feedback"> </div>
|
||||||
<div class="shield_wrapper">
|
<div class="likes"> </div>
|
||||||
<div class="shield">
|
<div class="comments"> </div>
|
||||||
This post has been flagged as NSFW by its author.
|
|
||||||
<a href="#">
|
|
||||||
show
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
<div class="post-content"> </div>
|
</div>
|
||||||
|
|
||||||
<% if(text !== null && text.match(/#nsfw/)) { %>
|
|
||||||
</div>
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
<div class="feedback"> </div>
|
|
||||||
<div class="likes"> </div>
|
|
||||||
<div class="comments"> </div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,20 @@ app.views.Comment = app.views.StreamObject.extend({
|
||||||
|
|
||||||
template_name: "#comment-template",
|
template_name: "#comment-template",
|
||||||
|
|
||||||
|
tagName : "li",
|
||||||
|
|
||||||
|
className : "comment loaded",
|
||||||
|
|
||||||
events : {
|
events : {
|
||||||
"click .comment_delete": "destroyModel"
|
"click .comment_delete": "destroyModel"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
initialize : function() {
|
||||||
|
$(this.el).attr("id", this.model.get("guid"));
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
postRenderTemplate : function(){
|
postRenderTemplate : function(){
|
||||||
this.$("time").timeago();
|
this.$("time").timeago();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ app.views.CommentStream = app.views.Base.extend({
|
||||||
|
|
||||||
template_name: "#comment-stream-template",
|
template_name: "#comment-stream-template",
|
||||||
|
|
||||||
|
className : "comment_stream",
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
"submit form": "createComment",
|
"submit form": "createComment",
|
||||||
"focus .comment_box": "commentTextareaFocused",
|
"focus .comment_box": "commentTextareaFocused",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
app.views.Feedback = app.views.StreamObject.extend({
|
app.views.Feedback = app.views.StreamObject.extend({
|
||||||
template_name: "#feedback-template",
|
template_name: "#feedback-template",
|
||||||
|
|
||||||
|
className : "info loaded",
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
"click .like_action": "toggleLike",
|
"click .like_action": "toggleLike",
|
||||||
"click .reshare_action": "resharePost"
|
"click .reshare_action": "resharePost"
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ app.views.Post = app.views.StreamObject.extend({
|
||||||
|
|
||||||
template_name: "#stream-element-template",
|
template_name: "#stream-element-template",
|
||||||
|
|
||||||
|
className : "stream_element loaded",
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
"click .focus_comment_textarea": "focusCommentTextarea",
|
"click .focus_comment_textarea": "focusCommentTextarea",
|
||||||
"click .shield a": "removeNsfwShield",
|
"click .shield a": "removeNsfwShield",
|
||||||
|
|
@ -22,6 +24,9 @@ app.views.Post = app.views.StreamObject.extend({
|
||||||
],
|
],
|
||||||
|
|
||||||
initialize : function() {
|
initialize : function() {
|
||||||
|
// set the guid
|
||||||
|
$(this.el).attr("id", this.model.get("guid"));
|
||||||
|
|
||||||
// commentStream view
|
// commentStream view
|
||||||
this.commentStreamView = new app.views.CommentStream({ model : this.model});
|
this.commentStreamView = new app.views.CommentStream({ model : this.model});
|
||||||
this.likesInfoView = new app.views.LikesInfo({ model : this.model});
|
this.likesInfoView = new app.views.LikesInfo({ model : this.model});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
app.views.StreamObject = app.views.Base.extend({
|
app.views.StreamObject = app.views.Base.extend({
|
||||||
className : "loaded",
|
|
||||||
|
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
this.model.bind('remove', this.remove, this);
|
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??
|
// do this manually because we've moved loadMore into render??
|
||||||
this.view.render();
|
this.view.render();
|
||||||
_.each(this.view.collection.models, function(post){
|
_.each(this.view.collection.models, function(post){
|
||||||
this.view.appendPost(post);
|
this.view.addPost(post);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.statusElement = $(this.view.$("#" + this.statusMessage.get("guid")));
|
this.statusElement = $(this.view.$("#" + this.statusMessage.get("guid")));
|
||||||
|
|
@ -25,7 +25,7 @@ describe("app.views.Stream", function(){
|
||||||
|
|
||||||
context("when rendering a Status Mesasage", function(){
|
context("when rendering a Status Mesasage", function(){
|
||||||
it("shows the status message in the content area", 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