DEV: uses new addNavigationBarItem API

DEV: uses new addNavigationBarItem API

diff --git a/assets/javascripts/discourse/initializers/discourse-voting.js.es6 b/assets/javascripts/discourse/initializers/discourse-voting.js.es6
new file mode 100644
index 0000000..50871aa
--- /dev/null
+++ b/assets/javascripts/discourse/initializers/discourse-voting.js.es6
@@ -0,0 +1,58 @@
+import { withPluginApi } from "discourse/lib/plugin-api";
+
+function initialize(api) {
+  api.addPostClassesCallback(post => {
+    if (post.post_number === 1 && post.can_vote) {
+      return ["voting-post"];
+    }
+  });
+  api.includePostAttributes("can_vote");
+  api.addTagsHtmlCallback(
+    topic => {
+      if (!topic.can_vote) {
+        return;
+      }
+
+      var buffer = [];
+
+      let title = "";
+      if (topic.user_voted) {
+        title = ` title='${I18n.t("voting.voted")}'`;
+      }
+
+      let userVotedClass = topic.user_voted ? " voted" : "";
+      buffer.push(
+        `<span class='list-vote-count discourse-tag${userVotedClass}'${title}>`
+      );
+
+      buffer.push(I18n.t("voting.votes", { count: topic.vote_count }));
+      buffer.push("</span>");
+
+      if (buffer.length > 0) {
+        return buffer.join("");
+      }
+    },
+    { priority: -100 }
+  );
+}
+
+export default {
+  name: "discourse-voting",
+
+  initialize(api) {
+    withPluginApi("0.8.4", api => initialize(api));
+    withPluginApi("0.8.30", api => api.addCategorySortCriteria("votes"));
+    withPluginApi("0.8.32", api => {
+      api.addNavigationBarItem({
+        name: "votes",
+        customFilter: (category, args, router) => {
+          const siteSettings = api.container.lookup("site-settings:main");
+          return siteSettings.voting_enabled && category && category.can_vote;
+        },
+        customHref: (category, args, router) => {
+          return `${Discourse.BaseUri}/${args.filterMode}?order=votes`;
+        }
+      });
+    });
+  }
+};
diff --git a/assets/javascripts/discourse/pre-initializers/extend-category-for-voting.js.es6 b/assets/javascripts/discourse/pre-initializers/extend-category-for-voting.js.es6
index 0ab0b86..c2a94e8 100644
--- a/assets/javascripts/discourse/pre-initializers/extend-category-for-voting.js.es6
+++ b/assets/javascripts/discourse/pre-initializers/extend-category-for-voting.js.es6
@@ -2,53 +2,12 @@ import computed from "ember-addons/ember-computed-decorators";
 import Category from "discourse/models/category";
 import { withPluginApi } from "discourse/lib/plugin-api";
 
-function initialize(api) {
-  api.addPostClassesCallback(post => {
-    if (post.post_number === 1 && post.can_vote) {
-      return ["voting-post"];
-    }
-  });
-  api.includePostAttributes("can_vote");
-  api.addTagsHtmlCallback(
-    topic => {
-      if (!topic.can_vote) {
-        return;
-      }
-
-      var buffer = [];
-
-      let title = "";
-      if (topic.user_voted) {
-        title = ` title='${I18n.t("voting.voted")}'`;
-      }
-
-      let userVotedClass = topic.user_voted ? " voted" : "";
-      buffer.push(
-        `<span class='list-vote-count discourse-tag${userVotedClass}'${title}>`
-      );
-
-      buffer.push(I18n.t("voting.votes", { count: topic.vote_count }));
-      buffer.push("</span>");
-
-      if (buffer.length > 0) {
-        return buffer.join("");
-      }
-    },
-    { priority: -100 }
-  );
-}
-
 export default {
   name: "extend-category-for-voting",
+
   before: "inject-discourse-objects",
-  initialize(container) {
-    withPluginApi("0.8.4", api => {
-      initialize(api, container);
-    });
-    withPluginApi("0.8.30", api => {
-      api.addCategorySortCriteria("votes");
-    });
 
+  initialize() {
     Category.reopen({
       @computed("custom_fields.enable_topic_voting")
       enable_topic_voting: {
diff --git a/assets/javascripts/discourse/templates/connectors/extra-nav-item/votes.hbs b/assets/javascripts/discourse/templates/connectors/extra-nav-item/votes.hbs
deleted file mode 100644
index 46dfaf3..0000000
--- a/assets/javascripts/discourse/templates/connectors/extra-nav-item/votes.hbs
+++ /dev/null
@@ -1,3 +0,0 @@
-{{#if siteSettings.voting_enabled}}
-<a title="{{I18n "voting.votes_nav_help"}}" href="{{url}}">{{I18n "voting.vote_title_plural"}}</a>
-{{/if}}
diff --git a/assets/javascripts/discourse/templates/connectors/extra-nav-item/votes.js.es6 b/assets/javascripts/discourse/templates/connectors/extra-nav-item/votes.js.es6
deleted file mode 100644
index ed8624c..0000000
--- a/assets/javascripts/discourse/templates/connectors/extra-nav-item/votes.js.es6
+++ /dev/null
@@ -1,12 +0,0 @@
-export default {
-  setupComponent(args, component) {
-    component.set(
-      "url",
-      Discourse.BaseUri + "/" + args.filterMode + "?order=votes"
-    );
-  },
-  shouldRender(args, component) {
-    const category = component.get("category");
-    return !!(category && category.get("can_vote"));
-  }
-};
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index cd7f576..5b01cc6 100755
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -28,3 +28,4 @@ en:
     filters:
       votes:
         title: "Votes"
+        help: "topics with the most votes"

GitHub sha: 204bdc27