diff --git a/app/views/templates/status_message.ujs b/app/views/templates/status_message.ujs index bda05eab34abd6291ed4de86a112008d78c955f0..313d1e2bc023b604d8b04b0ceeac942872f8df9a 100644 --- a/app/views/templates/status_message.ujs +++ b/app/views/templates/status_message.ujs @@ -1,6 +1,6 @@ <% if(photos_count > 0) { %> <div class="photo_attachments"> - <img src="<%= photos[0].sizes.large %>" class="stream-photo big_stream_photo"> + <img src="<%= photos[0].sizes.large %>" class="stream-photo big_stream_photo" data-small-photo="<%= photos[0].sizes.small %>"> <% for(photo in photos) { if(photo == 0){ continue; } if(photo == 8){ break; } %> diff --git a/app/views/templates/stream_element.ujs b/app/views/templates/stream_element.ujs index 1aebed96c1ba26d1c2aa2813a3c9369b32c831f4..894c04a9489239fbd5e2cbc16006c0eed8e79628 100644 --- a/app/views/templates/stream_element.ujs +++ b/app/views/templates/stream_element.ujs @@ -2,9 +2,10 @@ <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" /> <% } %> - <img src="/images/deletelabel.png" class="delete control_icon remove_post" title="Delete" /> - <img src="/images/ajax-loader.gif" class="hide_loader hidden"/> + </div> <div class="sm_body"> diff --git a/public/javascripts/app/views/feedback_view.js b/public/javascripts/app/views/feedback_view.js index 27c9932f3317c5fdbbdd108f3964c48ba3b46441..041bb80977d032ef8dcfc7c81f5c8b08efd3733a 100644 --- a/public/javascripts/app/views/feedback_view.js +++ b/public/javascripts/app/views/feedback_view.js @@ -9,9 +9,9 @@ app.views.Feedback = app.views.StreamObject.extend({ var user_like = this.model.get("user_like") this.like = user_like && this.model.likes.get(user_like.id); - this.model.likes.bind("change", this.render, this); - this.model.likes.bind("remove", this.render, this); - this.model.likes.bind("add", this.render, this); + _.each(["change", "remove", "add"], function(listener) { + this.model.likes.bind(listener, this.render, this); + }, this) }, presenter : function(){ diff --git a/public/javascripts/app/views/header_view.js b/public/javascripts/app/views/header_view.js index 6bf42bd3d67553360060a1d42edf840780bf68fd..eeb6f03d16a119e12e05e6c5ae218b83f3533462 100644 --- a/public/javascripts/app/views/header_view.js +++ b/public/javascripts/app/views/header_view.js @@ -1,39 +1,33 @@ -app.views.Header = Backbone.View.extend({ +app.views.Header = app.views.Base.extend({ + + template_name : "#header-template", events : { "click ul.dropdown li:first-child" : "toggleDropdown" }, initialize : function(options) { - this.menuElement = this.$("ul.dropdown"); - - _.bindAll(this, "toggleDropdown", "hideDropdown"); - this.menuElement.find("li a").slice(1).click(function(evt) { evt.stopPropagation(); }); - $(document.body).click(this.hideDropdown); - + $(document.body).click($.proxy(this.hideDropdown, this)); return this; }, - render : function(){ - this.template = _.template($("#header-template").html()); - $(this.el).html(this.template(app.user())); - return this; + menuElement : function() { + return this.$("ul.dropdown"); }, toggleDropdown : function(evt) { - evt.preventDefault(); - evt.stopPropagation(); + if(evt){ evt.preventDefault(); } - this.$("ul.dropdown").toggleClass("active"); + this.menuElement().toggleClass("active"); - if ( $.browser.msie ) { - this.$('header').toggleClass('ie-user-menu-active'); + if($.browser.msie) { + this.$("header").toggleClass('ie-user-menu-active'); } }, hideDropdown : function(evt) { - if(this.$("ul.dropdown").hasClass("active") && !$(evt.target).parents("#user_menu").length) { - this.$("ul.dropdown").removeClass("active"); + if(this.menuElement().hasClass("active") && !$(evt.target).parents("#user_menu").length) { + this.menuElement().removeClass("active"); } } }); diff --git a/public/javascripts/app/views/post_view.js b/public/javascripts/app/views/post_view.js index f41e947199deffbd9c3d0ef875830c709f87368a..1dbece577e88fcfb0797b35b45e07ed0984272cc 100644 --- a/public/javascripts/app/views/post_view.js +++ b/public/javascripts/app/views/post_view.js @@ -15,6 +15,12 @@ app.views.Post = app.views.StreamObject.extend({ ".comments" : "commentStreamView" }, + tooltips : [ + ".delete", + ".block_user", + ".post_scope" + ], + initialize : function() { this.feedbackView = new app.views.Feedback({model : this.model}); this.commentStreamView = new app.views.CommentStream({ model : this.model}); @@ -50,16 +56,13 @@ app.views.Post = app.views.StreamObject.extend({ }, initializeTooltips: function(){ - $([ - this.$(".delete"), - this.$(".block_user"), - this.$(".post_scope") - ]).map(function() { this.twipsy(); }); + _.each(this.tooltips, function(selector){ + this.$(selector).twipsy(); + }, this); return this; }, - expandLikes: function(evt){ if(evt) { evt.preventDefault(); } diff --git a/public/javascripts/pages/multis-index.js b/public/javascripts/pages/multis-index.js index 5bbb2532124f4feb568ad9f3f639ce555cbcc870..84ec296b0f61de95fb0f4277a6628d3bd5a2ecb7 100644 --- a/public/javascripts/pages/multis-index.js +++ b/public/javascripts/pages/multis-index.js @@ -3,5 +3,6 @@ Diaspora.Pages.MultisIndex = function() { this.subscribe("page/ready", function(evt, document) { self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav")); + self.stream = self.instantiate("Stream", document.find("#aspect_stream_container")); }); }; diff --git a/public/javascripts/pages/tag-followings-index.js b/public/javascripts/pages/tag-followings-index.js index 71dc24aa89e28a03a8b5f4097309a8201e3caefe..3eaf10d27d661a69bbede3c6a930faf263e0a8f4 100644 --- a/public/javascripts/pages/tag-followings-index.js +++ b/public/javascripts/pages/tag-followings-index.js @@ -3,5 +3,7 @@ Diaspora.Pages.TagFollowingsIndex = function() { this.subscribe("page/ready", function(evt, document) { self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav")); + + self.stream = self.instantiate("Stream", document.find("#aspect_stream_container")); }); }; diff --git a/public/javascripts/stream.js b/public/javascripts/stream.js index 3fe102f3c4719c307e01e2991fc7282ed75daddf..84a01b6e04f0f203489c4d100aa1dce5ac176c6a 100644 --- a/public/javascripts/stream.js +++ b/public/javascripts/stream.js @@ -5,11 +5,9 @@ var Stream = { selector: "#main_stream", - nsfw_links: ".shield a", initialize: function() { Diaspora.page.directionDetector.updateBinds(); - Stream.setUpAudioLinks(); }, @@ -27,14 +25,6 @@ var Stream = { box.toggle(); } }); - - }, - - setUpNsfwLinks:function(){ - $(this.nsfw_links).click(function(e){ - e.preventDefault(); - $(this).parent().fadeOut(); - }); }, setUpAudioLinks: function() { diff --git a/public/javascripts/widgets/stream-element.js b/public/javascripts/widgets/stream-element.js index 7935fdb537d79fb5c4a78f5c25c5c1651e7103ac..19305bb6453265cbb7cfae5da7583bb2a5f7779a 100644 --- a/public/javascripts/widgets/stream-element.js +++ b/public/javascripts/widgets/stream-element.js @@ -15,22 +15,11 @@ timeAgo: self.instantiate("TimeAgo", element.find(".timeago a abbr.timeago")), content: element.find(".content .collapsible"), - blockUserLink: element.find(".block_user"), - deletePostLink: element.find(".remove_post"), - focusCommentLink: element.find("a.focus_comment_textarea"), hidePostLoader: element.find("img.hide_loader"), hidePostUndo: element.find("a.stream_element_hide_undo"), - post: element, - postScope: element.find("span.post_scope") + post: element }); - // twipsy tooltips - $([ - self.blockUserLink, - self.deletePostLink, - self.postScope - ]).map(function() { this.twipsy(); }); - // collapse long posts self.content.expander({ slicePoint: 400, @@ -52,12 +41,6 @@ } ); }); - self.focusCommentLink.click(function(evt) { - evt.preventDefault(); - - self.commentForm.commentInput.focus(); - }); - self.hidePostUndo.click(function(evt) { evt.preventDefault();