removed top-level element delcarations from app templates

This commit is contained in:
danielgrippi 2011-12-31 23:24:46 -05:00 committed by Dennis Collinson
parent 64a90a30ef
commit 85b5974fa9
10 changed files with 137 additions and 128 deletions

View file

@ -1,4 +1,3 @@
<li id="<%= id %>" class="comment">
<div class="right controls">
<!-- need access to post -->
<% if(author.id === current_user.id) { %>
@ -27,4 +26,3 @@
<time class="timeago" datetime="<%= created_at %>"/>
</div>
</div>
</li>

View file

@ -1,5 +1,3 @@
<div class="comment_stream">
<% if(typeof(all_comments_loaded) == 'undefined' || !all_comments_loaded) { %>
<ul class="show_comments <%= comments_count <= 3 ? 'hidden' : '' %>">
<li>
@ -29,4 +27,3 @@
</form>
</div>
<% } %>
</div>

View file

@ -1,4 +1,3 @@
<div class="info">
<span class="post_scope">
<%= public ? "Public" : "Limited" %>
</span>
@ -19,5 +18,4 @@
<a href="#" class="focus_comment_textarea" rel="nofollow">
Comment
</a>
</div>

View file

@ -1,4 +1,3 @@
<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 %>" />
@ -52,4 +51,3 @@
<div class="comments"> </div>
</div>
</div>

View file

@ -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();
}

View file

@ -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",

View file

@ -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"

View file

@ -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});

View file

@ -1,5 +1,4 @@
app.views.StreamObject = app.views.Base.extend({
className : "loaded",
initialize: function(options) {
this.model.bind('remove', this.remove, this);

View file

@ -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")
})
})
})