You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2014/08/18 11:48:34 UTC

[4/6] fauxton commit: updated refs/heads/sidebar-fixes to 1ba9f1a

Reword add options and add extension for all docs and design


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/5892c95d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/5892c95d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/5892c95d

Branch: refs/heads/sidebar-fixes
Commit: 5892c95d8ab7bf80aba549e724b03a31058af40e
Parents: 1b84944
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Aug 13 12:33:15 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Mon Aug 18 11:36:09 2014 +0200

----------------------------------------------------------------------
 app/addons/documents/views-sidebar.js | 40 ++++++++++++++++++++----------
 1 file changed, 27 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/5892c95d/app/addons/documents/views-sidebar.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-sidebar.js b/app/addons/documents/views-sidebar.js
index 8699417..bfd921d 100644
--- a/app/addons/documents/views-sidebar.js
+++ b/app/addons/documents/views-sidebar.js
@@ -60,27 +60,41 @@ function(app, FauxtonAPI, Components, Documents, Databases) {
       };
     },
 
+    getNewButtonLinks: function () {
+      var database = this.collection.database,
+          newurlPrefix = "#" + database.url('app'),
+          addLinks = FauxtonAPI.getExtensions('sidebar:links');
 
-    beforeRender: function(manage) {
-      this.deleteDBModal = this.setView(
-        '#delete-db-modal',
-        new Views.DeleteDBModal({database: this.database})
-      );
+      return _.reduce(FauxtonAPI.getExtensions('sidebar:links'), function (menuLinks, link) {
 
-      var database = this.collection.database,
-          newurlPrefix = "#" + database.url('app');
+        menuLinks.push({
+          title: link.title,
+          url: newurlPrefix + "/" + link.url,
+          icon: 'fonticon-plus-circled'
+        });
 
-      var newLinks = [{
-        title: 'Add new',
-        links: [{
+        return menuLinks; 
+     }, [{
           title: 'New Doc',
           url: newurlPrefix + '/new',
           icon: 'fonticon-plus-circled'
         },{
-          title: 'New Design Doc',
+          title: 'New View',
           url: newurlPrefix + '/new_view',
           icon: 'fonticon-plus-circled'
-        }]
+        }]);
+    },
+
+
+    beforeRender: function(manage) {
+      this.deleteDBModal = this.setView(
+        '#delete-db-modal',
+        new Views.DeleteDBModal({database: this.database})
+      );
+
+      var newLinks = [{
+        title: 'Add new',
+        links: this.getNewButtonLinks()
       }];
 
       this.insertView("#new-all-docs-button", new Components.MenuDropDown({
@@ -175,7 +189,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) {
 
         return menuLinks; 
      }, [{
-      title: 'Secondary View',
+      title: 'New View',
       url: "#" + database.url('app') + "/new_view/" + docSafe,
       icon: 'fonticon-plus-circled'
      }]);