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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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