From 8d0cf9b83acf267c68024b6005d332806e1d7702 Mon Sep 17 00:00:00 2001 From: Sacha Greif Date: Fri, 8 Mar 2013 16:06:42 +0900 Subject: [PATCH] refactored share button code a bit --- client/sass/modules/_posts.scss | 36 --------------------------------- client/views/posts/post_item.js | 14 ++++++------- 2 files changed, 7 insertions(+), 43 deletions(-) diff --git a/client/sass/modules/_posts.scss b/client/sass/modules/_posts.scss index fb5297f8d..042bcf4b3 100644 --- a/client/sass/modules/_posts.scss +++ b/client/sass/modules/_posts.scss @@ -155,42 +155,6 @@ color:$light-text; font-size:36px; line-height:50px; - // @include background(linear-gradient(/*right top,*/ #f6f6f6, #e3e3e3)); - // @include box-shadow(inset 0 1px 0 white, 0 1px 1px black(0.15)); - // background:#fffce6; - // &.medium{ - // background-color:red(0.05); - // } - // &.hot{ - // background-color:red(0.2); - // } - // &.superhot{ - // background-color:red(0.3); - // } - // &.megahot{ - // background-color:red(0.5); - // } - // &.gigahot{ - // background-color:red(0.8); - // } - // &.low{ - // color:red(0.2); - // } - // &.medium{ - // color:red(0.3); - // } - // &.hot{ - // color:red(0.4); - // } - // &.superhot{ - // color:red(0.6); - // } - // &.megahot{ - // color:red(0.8); - // } - // &.gigahot{ - // color:red(1); - // } &.edit-link{ color:$red; } diff --git a/client/views/posts/post_item.js b/client/views/posts/post_item.js index c48af1328..c1c308733 100644 --- a/client/views/posts/post_item.js +++ b/client/views/posts/post_item.js @@ -101,14 +101,14 @@ Template.post_item.events = { trackEvent("post upvoted", {'_id': post._id}); }); } - , 'click .share-link': function(e){ - var $this = $(e.target); + var $this = $(e.target).parents('.post-share').find('.share-link'); + var $share = $this.parents('.post-share').find('.share-options'); e.preventDefault(); - $(".share-link").not($this).next().addClass("hidden"); - $this.next().toggleClass("hidden"); - console.log($this); - $this.next().find('.share-replace').sharrre(SharrreOptions); - // $(".overlay").toggleClass("hidden"); + $('.share-link').not($this).removeClass("active"); + $(".share-options").not($share).addClass("hidden"); + $this.toggleClass("active"); + $share.toggleClass("hidden"); + $share.find('.share-replace').sharrre(SharrreOptions); } }; \ No newline at end of file