From c9556b4bb8845e0f0a0a6f8f49e4ff614f79f88e Mon Sep 17 00:00:00 2001
From: Neil Lalonde <neillalonde@gmail.com>
Date: Tue, 18 Jun 2013 14:34:28 -0400
Subject: [PATCH] Remove bookmark from top right of post; move its
 functionality to the post menu button

---
 .../javascripts/discourse/models/post.js      |  6 +-
 .../discourse/templates/post.js.handlebars    |  2 -
 .../discourse/views/post_menu_view.js         | 12 ++--
 .../application/topic-post.css.scss           | 66 ++++++-------------
 config/locales/client.cs.yml                  |  1 -
 config/locales/client.da.yml                  |  1 -
 config/locales/client.de.yml                  |  1 -
 config/locales/client.en.yml                  |  1 -
 config/locales/client.es.yml                  |  1 -
 config/locales/client.fr.yml                  |  1 -
 config/locales/client.id.yml                  |  1 -
 config/locales/client.it.yml                  |  1 -
 config/locales/client.nb_NO.yml               |  1 -
 config/locales/client.nl.yml                  |  1 -
 config/locales/client.pseudo.yml              |  1 -
 config/locales/client.pt.yml                  |  1 -
 config/locales/client.ru.yml                  |  1 -
 config/locales/client.sv.yml                  |  1 -
 config/locales/client.zh_CN.yml               |  1 -
 config/locales/client.zh_TW.yml               |  1 -
 20 files changed, 27 insertions(+), 75 deletions(-)

diff --git a/app/assets/javascripts/discourse/models/post.js b/app/assets/javascripts/discourse/models/post.js
index 622d19cf3..ec9e7c5fc 100644
--- a/app/assets/javascripts/discourse/models/post.js
+++ b/app/assets/javascripts/discourse/models/post.js
@@ -64,13 +64,15 @@ Discourse.Post = Discourse.Model.extend({
     } else {
       if (this.get('read')) {
         result += ' seen';
+      } else {
+        result += ' unseen';
       }
     }
     return result;
   }.property('read', 'topic.last_read_post_number', 'bookmarked'),
 
   // Custom tooltips for the bookmark icons
-  bookmarkTooltip: (function() {
+  bookmarkTooltip: function() {
     var topic;
     if (this.get('bookmarked')) return Em.String.i18n('bookmarks.created');
     if (!this.get('read')) return "";
@@ -79,7 +81,7 @@ Discourse.Post = Discourse.Model.extend({
       return Em.String.i18n('bookmarks.last_read');
     }
     return Em.String.i18n('bookmarks.not_bookmarked');
-  }).property('read', 'topic.last_read_post_number', 'bookmarked'),
+  }.property('read', 'topic.last_read_post_number', 'bookmarked'),
 
   bookmarkedChanged: function() {
     var post = this;
diff --git a/app/assets/javascripts/discourse/templates/post.js.handlebars b/app/assets/javascripts/discourse/templates/post.js.handlebars
index 2ec818c61..019643427 100644
--- a/app/assets/javascripts/discourse/templates/post.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/post.js.handlebars
@@ -10,8 +10,6 @@
   <div class='row'>
     {{#if controller.multiSelect}}
       <button class='post-select' {{action selectPost this}}>{{view.selectText}}</button>
-    {{else}}
-      <div {{bindAttr class="bookmarkClass"}} {{bindAttr title="bookmarkTooltip"}} {{action toggleBookmark this}}></div>
     {{/if}}
 
     {{#if showUserReplyTab}}
diff --git a/app/assets/javascripts/discourse/views/post_menu_view.js b/app/assets/javascripts/discourse/views/post_menu_view.js
index acabb0cd7..f329258ae 100644
--- a/app/assets/javascripts/discourse/views/post_menu_view.js
+++ b/app/assets/javascripts/discourse/views/post_menu_view.js
@@ -38,7 +38,7 @@ Discourse.PostMenuView = Discourse.View.extend({
   // Trigger re-rendering
   needsToRender: function() {
     this.rerender();
-  }.observes('post.deleted_at', 'post.flagsAvailable.@each', 'post.url', 'post.bookmarked', 'post.reply_count', 'post.showRepliesBelow', 'post.can_delete'),
+  }.observes('post.deleted_at', 'post.flagsAvailable.@each', 'post.url', 'post.bookmarked', 'post.reply_count', 'post.showRepliesBelow', 'post.can_delete', 'post.read', 'post.topic.last_read_post_number'),
 
   // Replies Button
   renderReplies: function(post, buffer) {
@@ -152,13 +152,9 @@ Discourse.PostMenuView = Discourse.View.extend({
   renderBookmark: function(post, buffer) {
     if (!Discourse.User.current()) return;
 
-    var icon = 'bookmark';
-    if (!this.get('post.bookmarked')) {
-      icon += '-empty';
-    }
-    buffer.push("<button title=\"" +
-                (Em.String.i18n("post.controls.bookmark")) +
-                "\" data-action=\"bookmark\" class='bookmark'><i class=\"icon-" + icon + "\"></i></button>");
+    buffer.push("<button title=\"" + this.get('post.bookmarkTooltip') +
+                "\" data-action=\"bookmark\" class='bookmark'><div class='" + this.get('post.bookmarkClass') +
+                "'></div></button>");
   },
 
   clickBookmark: function() {
diff --git a/app/assets/stylesheets/application/topic-post.css.scss b/app/assets/stylesheets/application/topic-post.css.scss
index b3e1f07b2..6310d46af 100644
--- a/app/assets/stylesheets/application/topic-post.css.scss
+++ b/app/assets/stylesheets/application/topic-post.css.scss
@@ -74,11 +74,6 @@
     .gutter {
       width: 100px;
     }
-    article.boxed {
-      .read-icon {
-        left: 750px !important;
-      }
-    }
   }
 }
 
@@ -202,13 +197,6 @@
     }
   }
   @include hover {
-    .read-icon {
-      i {
-        &:before {
-          font-size: 25px;
-        }
-      }
-    }
     section.post-menu-area {
       display: block;
     }
@@ -282,6 +270,25 @@
         &.like, &.edit, &.flag, &.delete, &.share, &.bookmark, &.create {
           float: right;
         }
+        .read-icon {
+          &:before {
+            font-family: "FontAwesome";
+            content: "\f02e";
+          }
+          &.unseen {
+            &:before {
+              content: "\f097";
+            }
+          }
+          &.last-read {
+            color: $red;
+          }
+          &.bookmarked {
+            &:before {
+              color: $bookmarkColor;
+            }
+          }
+        }
       }
       button.create {
         color: $attention_fg;
@@ -484,11 +491,6 @@
     position: relative;
     font-size: 16px;
     line-height: 20px;
-    @include small-width {
-      .read-icon {
-        right: 365px !important;
-      }
-    }
     .post-select {
       @include border-radius-all(4px);
       background-color: $light_gray;
@@ -504,36 +506,6 @@
       padding: 2px 5px;
       z-index: 490;
     }
-    .read-icon {
-      @include transition(opacity 1s);
-      opacity: 0;
-      position: absolute;
-      top: -3px;
-      left: 800px;
-      width: 16px;
-      height: 22px;
-      z-index: 490;
-      font-size: 20px;
-      cursor: pointer;
-      &:before {
-        font-family: "FontAwesome";
-        content: "\f02e";
-      }
-      &.seen {
-        color: $gray;
-        opacity: 1;
-      }
-      &.last-read {
-        color: $red;
-        opacity: 1;
-      }
-      &.bookmarked {
-        &:before {
-          color: $bookmarkColor;
-        }
-        opacity: 1;
-      }
-    }
     img {
       max-width: 100%;
     }
diff --git a/config/locales/client.cs.yml b/config/locales/client.cs.yml
index 4abfa804c..24adae883 100644
--- a/config/locales/client.cs.yml
+++ b/config/locales/client.cs.yml
@@ -789,7 +789,6 @@ cs:
         delete: "smazat příspěvek"
         undelete: "obnovit příspěvek"
         share: "sdílet odkaz na tento příspěvek"
-        bookmark: "přidat záložku na tento příspěvek na vaši uživatelskou stránku"
         more: "Více"
 
       actions:
diff --git a/config/locales/client.da.yml b/config/locales/client.da.yml
index 7e14853cf..b1af5e529 100644
--- a/config/locales/client.da.yml
+++ b/config/locales/client.da.yml
@@ -553,7 +553,6 @@ da:
         delete: "slet dette indlæg"
         undelete: "annulér sletning"
         share: "del et link til dette indlæg"
-        bookmark: "bogmærk dette indlæg til din brugerside"
         more: "Mere"
 
       actions:
diff --git a/config/locales/client.de.yml b/config/locales/client.de.yml
index 2f554286d..d3b88c9fd 100644
--- a/config/locales/client.de.yml
+++ b/config/locales/client.de.yml
@@ -760,7 +760,6 @@ de:
         delete: "Diesen Beitrag löschen"
         undelete: "Diesen Beitrag wiederherstellen"
         share: "Link zu diesem Beitrag teilen"
-        bookmark: "Lesezeichen zu diesem Beitrag auf meiner Nutzerseite setzen"
         more: "Mehr"
 
       actions:
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 1224d019f..5e2bc9743 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -762,7 +762,6 @@ en:
         delete: "delete this post"
         undelete: "undelete this post"
         share: "share a link to this post"
-        bookmark: "bookmark this post to your user page"
         more: "More"
 
       actions:
diff --git a/config/locales/client.es.yml b/config/locales/client.es.yml
index 5d3417fe4..87f0e6568 100644
--- a/config/locales/client.es.yml
+++ b/config/locales/client.es.yml
@@ -649,7 +649,6 @@ es:
         delete: "elimina esta publicación"
         undelete: "deshace la eliminación de esta publicación"
         share: "comparte un enlace a esta publicación"
-        bookmark: "marca esta publicación como favorita en tu página de usuario"
         more: "Más"
 
       actions:
diff --git a/config/locales/client.fr.yml b/config/locales/client.fr.yml
index e3776e113..fa0cd29b5 100644
--- a/config/locales/client.fr.yml
+++ b/config/locales/client.fr.yml
@@ -686,7 +686,6 @@ fr:
         delete: "Supprimer ce message"
         undelete: "Annuler la suppression de ce message"
         share: "Partager un lien vers ce message"
-        bookmark: "Ajouter ce message à ma page utilisateur"
         more: "Plus"
 
       actions:
diff --git a/config/locales/client.id.yml b/config/locales/client.id.yml
index f276c7a71..73c4327eb 100644
--- a/config/locales/client.id.yml
+++ b/config/locales/client.id.yml
@@ -509,7 +509,6 @@ id:
         delete: "delete this post"
         undelete: "undelete this post"
         share: "share a link to this post"
-        bookmark: "bookmark this post to your user page"
         more: "More"
 
       actions:
diff --git a/config/locales/client.it.yml b/config/locales/client.it.yml
index f58d46130..34468b612 100644
--- a/config/locales/client.it.yml
+++ b/config/locales/client.it.yml
@@ -668,7 +668,6 @@ it:
         delete: "elimina post"
         undelete: "annulla eliminazione post"
         share: "condividi questo post"
-        bookmark: "aggiungilo ai tuoi segnalibri"
         more: "Di più"
 
       actions:
diff --git a/config/locales/client.nb_NO.yml b/config/locales/client.nb_NO.yml
index f52c6bbb8..365c6f514 100644
--- a/config/locales/client.nb_NO.yml
+++ b/config/locales/client.nb_NO.yml
@@ -688,7 +688,6 @@ nb_NO:
         delete: "delete this post"
         undelete: "undelete this post"
         share: "share a link to this post"
-        bookmark: "bookmark this post to your user page"
         more: "More"
 
       actions:
diff --git a/config/locales/client.nl.yml b/config/locales/client.nl.yml
index ccb8a20e6..7ff6149bb 100644
--- a/config/locales/client.nl.yml
+++ b/config/locales/client.nl.yml
@@ -764,7 +764,6 @@ nl:
         delete: verwijder dit bericht
         undelete: herstel dit bericht
         share: deel een link naar dit bericht
-        bookmark: voeg dit bericht toe aan de bladwijzers op je gebruikerspagina
         more: Meer
 
       actions:
diff --git a/config/locales/client.pseudo.yml b/config/locales/client.pseudo.yml
index 88684967e..25ecb826c 100644
--- a/config/locales/client.pseudo.yml
+++ b/config/locales/client.pseudo.yml
@@ -647,7 +647,6 @@ pseudo:
         delete: '[[ ďéłéťé ťĥíš ƿóšť ]]'
         undelete: '[[ ůɳďéłéťé ťĥíš ƿóšť ]]'
         share: '[[ šĥářé á łíɳǩ ťó ťĥíš ƿóšť ]]'
-        bookmark: '[[ ƀóóǩɱářǩ ťĥíš ƿóšť ťó ýóůř ůšéř ƿáǧé ]]'
         more: '[[ Ϻóřé ]]'
       actions:
         flag: '[[ Ƒłáǧ ]]'
diff --git a/config/locales/client.pt.yml b/config/locales/client.pt.yml
index ecb8753f3..994605fb5 100644
--- a/config/locales/client.pt.yml
+++ b/config/locales/client.pt.yml
@@ -477,7 +477,6 @@ pt:
         delete: "apagar este post"
         undelete: "desapagar este post"
         share: "partilhar um link para este post"
-        bookmark: "marcar este post na tua página de utilizador"
         more: "Mais"
 
       actions:
diff --git a/config/locales/client.ru.yml b/config/locales/client.ru.yml
index 1d5f54d48..61194fde4 100644
--- a/config/locales/client.ru.yml
+++ b/config/locales/client.ru.yml
@@ -733,7 +733,6 @@ ru:
         delete: удалить сообщение
         undelete: отменить удаление
         share: поделиться ссылкой на сообщение
-        bookmark: добавить сообщение в закладки
         more: Ещё
       actions:
         flag: Жалоба
diff --git a/config/locales/client.sv.yml b/config/locales/client.sv.yml
index 218c87c78..159bb0bfc 100644
--- a/config/locales/client.sv.yml
+++ b/config/locales/client.sv.yml
@@ -586,7 +586,6 @@ sv:
         delete: "radera detta inlägg"
         undelete: "återställ detta inlägg"
         share: "dela en länk till detta inlägg"
-        bookmark: "bokmärk detta inlägg till din användarsida"
         more: "Mer"
 
       actions:
diff --git a/config/locales/client.zh_CN.yml b/config/locales/client.zh_CN.yml
index 2dcf27ea9..154d0708b 100644
--- a/config/locales/client.zh_CN.yml
+++ b/config/locales/client.zh_CN.yml
@@ -727,7 +727,6 @@ zh_CN:
         delete: "删除本帖"
         undelete: "恢复本帖"
         share: "分享一个到本帖的链接"
-        bookmark: "给本帖做书签到你的用户页"
         more: "更多"
 
       actions:
diff --git a/config/locales/client.zh_TW.yml b/config/locales/client.zh_TW.yml
index 1c6e62b52..0a3534b33 100644
--- a/config/locales/client.zh_TW.yml
+++ b/config/locales/client.zh_TW.yml
@@ -668,7 +668,6 @@ zh_TW:
         delete: "刪除本帖"
         undelete: "恢複本帖"
         share: "分享一個到本帖的鏈接"
-        bookmark: "給本帖做書簽到你的用戶頁"
         more: "更多"
 
       actions: