couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From benk...@apache.org
Subject fauxton commit: updated refs/heads/master to 07fe073
Date Tue, 25 Nov 2014 18:48:19 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master f4fbeec10 -> 07fe0738a


Move Helpers.docs into constants.js

This is a house cleaning ticket. It does a couple of things:
1. Moves the list of URLs stored in Helpers.docs into constants.js
2. Refactors constants to group the (now growing) list into appropriate
groups.

Now there are a lot less hardcoded "magic" strings throughout our
code, yay!

Closes COUCHDB-2474


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

Branch: refs/heads/master
Commit: 07fe0738af9d60ce19fc7507059031b705675a97
Parents: f4fbeec
Author: Benjamin Keen <ben.keen@gmail.com>
Authored: Fri Nov 21 16:57:15 2014 -0800
Committer: Benjamin Keen <ben.keen@gmail.com>
Committed: Tue Nov 25 09:38:44 2014 -0800

----------------------------------------------------------------------
 app/addons/activetasks/resources.js             |  7 ++--
 app/addons/config/resources.js                  |  4 +--
 app/addons/databases/resources.js               | 10 +++---
 app/addons/documents/resources.js               | 12 +++----
 app/addons/documents/routes-documents.js        |  6 ++--
 app/addons/documents/templates/ddoc_info.html   |  6 ++--
 .../templates/design_doc_selector.html          |  2 +-
 .../templates/query_options_main_fields.html    |  2 +-
 app/addons/documents/templates/view_editor.html |  6 ++--
 app/addons/fauxton/components.js                | 16 ++++-----
 app/addons/fauxton/templates/api_bar.html       |  2 +-
 app/addons/fauxton/templates/nav_bar.html       |  6 ++--
 app/addons/permissions/templates/section.html   |  2 +-
 app/addons/replication/resources.js             |  2 +-
 app/addons/replication/templates/form.html      |  2 +-
 app/constants.js                                | 35 +++++++++++++++++---
 app/helpers.js                                  | 28 +++-------------
 17 files changed, 77 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/activetasks/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/resources.js b/app/addons/activetasks/resources.js
index b8c59c6..ebb4dd6 100644
--- a/app/addons/activetasks/resources.js
+++ b/app/addons/activetasks/resources.js
@@ -11,10 +11,11 @@
 // the License.
 
 define([
-  'app'
+  'app',
+  'api'
 ],
 
-function (app) {
+function (app, FauxtonAPI) {
   app.taskSortBy = 'type';
 
   var Active = {};
@@ -49,7 +50,7 @@ function (app) {
       return item.get(value);
     },
 
-    documentation: '_active_tasks',
+    documentation: FauxtonAPI.constants.DOC_URLS.ACTIVE_TASKS,
 
     url: function (context) {
       if (context === 'apiurl') {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/config/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/config/resources.js b/app/addons/config/resources.js
index 816b57c..895e4d8 100644
--- a/app/addons/config/resources.js
+++ b/app/addons/config/resources.js
@@ -23,7 +23,7 @@ function (app, FauxtonAPI) {
 
   Config.Model = Backbone.Model.extend({});
   Config.OptionModel = Backbone.Model.extend({
-    documentation: "config",
+    documentation: FauxtonAPI.constants.DOC_URLS.CONFIG,
 
     url: function () {
       return app.host + '/_config/' + this.get("section") + '/' + encodeURIComponent(this.get("name"));
@@ -53,7 +53,7 @@ function (app, FauxtonAPI) {
   Config.Collection = Backbone.Collection.extend({
     model: Config.Model,
 
-    documentation: "config",
+    documentation: FauxtonAPI.constants.DOC_URLS.CONFIG,
 
     comparator: function (OptionModel) {
       if (OptionModel.get("section")) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/databases/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/resources.js b/app/addons/databases/resources.js
index f580ebf..9483c6e 100644
--- a/app/addons/databases/resources.js
+++ b/app/addons/databases/resources.js
@@ -31,8 +31,8 @@ function(app, FauxtonAPI, Documents) {
       });
     },
 
-    documentation: function(){
-      return "all_dbs";
+    documentation: function () {
+      return FauxtonAPI.constants.DOC_URLS.ALL_DBS;
     },
     
     buildAllDocs: function(params) {
@@ -89,7 +89,7 @@ function(app, FauxtonAPI, Documents) {
       this.params = options.params;
     },
     documentation: function(){
-      return "changes";
+      return FauxtonAPI.constants.DOC_URLS.CHANGES;
     },
     url: function (context) {
       var query = "";
@@ -158,8 +158,8 @@ function(app, FauxtonAPI, Documents) {
   // TODO: shared databases - read from the user doc
   Databases.List = FauxtonAPI.Collection.extend({
     model: Databases.Model,
-    documentation: function(){
-      return "all_dbs";
+    documentation: function () {
+      return FauxtonAPI.constants.DOC_URLS.ALL_DBS;
     },
 
     getDatabaseNames: function () {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/documents/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/resources.js b/app/addons/documents/resources.js
index b9337d2..a5acf81 100644
--- a/app/addons/documents/resources.js
+++ b/app/addons/documents/resources.js
@@ -47,7 +47,7 @@ function(app, FauxtonAPI, PagingCollection) {
   Documents.Doc = FauxtonAPI.Model.extend({
     idAttribute: "_id",
     documentation: function(){
-      return "docs";
+      return FauxtonAPI.constants.DOC_URLS.GENERAL;
     },
     url: function(context) {
       if (context === "app") {
@@ -225,7 +225,7 @@ function(app, FauxtonAPI, PagingCollection) {
   Documents.DdocInfo = FauxtonAPI.Model.extend({
     idAttribute: "_id",
     documentation: function(){
-      return "docs";
+      return FauxtonAPI.constants.DOC_URLS.GENERAL;
     },
     initialize: function (_attrs, options) {
       this.database = options.database;
@@ -262,7 +262,7 @@ function(app, FauxtonAPI, PagingCollection) {
       return this.id.match(/^_design/) ? "design doc" : "doc";
     },
     documentation: function(){
-      return "docs";
+      return FauxtonAPI.constants.DOC_URLS.GENERAL;
     },
     url: function(context) {
       return this.collection.database.url(context) + "/" + this.safeID();
@@ -390,7 +390,7 @@ function(app, FauxtonAPI, PagingCollection) {
   Documents.AllDocs = PagingCollection.extend({
     model: Documents.Doc,
     documentation: function(){
-      return "docs";
+      return FauxtonAPI.constants.DOC_URLS.GENERAL;
     },
     initialize: function(_models, options) {
       this.viewMeta = options.viewMeta;
@@ -494,7 +494,7 @@ function(app, FauxtonAPI, PagingCollection) {
   Documents.IndexCollection = PagingCollection.extend({
     model: Documents.ViewRow,
     documentation: function(){
-      return "docs";
+      return FauxtonAPI.constants.DOC_URLS.GENERAL;
     },
     initialize: function(_models, options) {
       this.database = options.database;
@@ -629,7 +629,7 @@ function(app, FauxtonAPI, PagingCollection) {
   Documents.PouchIndexCollection = PagingCollection.extend({
     model: Documents.ViewRow,
     documentation: function(){
-      return "docs";
+      return FauxtonAPI.constants.DOC_URLS.GENERAL;
     },
     initialize: function(_models, options) {
       this.database = options.database;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/documents/routes-documents.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-documents.js b/app/addons/documents/routes-documents.js
index 9abbb8e..fbd62c3 100644
--- a/app/addons/documents/routes-documents.js
+++ b/app/addons/documents/routes-documents.js
@@ -223,7 +223,7 @@ function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases,
Resou
     createParams: function (options) {
       var urlParams = app.getParams(options),
           params = Documents.QueryParams.parse(urlParams),
-          limit = this.getDocPerPageLimit(params, FauxtonAPI.constants.DEFAULT_PAGE_SIZE);
+          limit = this.getDocPerPageLimit(params, FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE);
 
       return {
         urlParams: urlParams,
@@ -319,7 +319,7 @@ function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases,
Resou
       this.sidebar.setSelectedTab(app.utils.removeSpecialCharacters(ddoc) + '_' + app.utils.removeSpecialCharacters(viewName));
 
       this.apiUrl = function() {
-       return [this.indexedDocs.urlRef("apiurl", urlParams), "docs"];
+        return [this.indexedDocs.urlRef("apiurl", urlParams), FauxtonAPI.constants.DOC_URLS.GENERAL];
       };
 
       this.rightHeader.showQueryOptions();
@@ -384,7 +384,7 @@ function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases,
Resou
           collection;
 
       isLazyInit = _.isUndefined(this.documentsView) || _.isUndefined(this.documentsView.allDocsNumber);
-      defaultPageSize = isLazyInit ? FauxtonAPI.constants.DEFAULT_PAGE_SIZE : this.documentsView.perPage();
+      defaultPageSize = isLazyInit ? FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE : this.documentsView.perPage();
       docParams.limit = pageSize = this.getDocPerPageLimit(urlParams, defaultPageSize);
 
       if (event.allDocs) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/documents/templates/ddoc_info.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/ddoc_info.html b/app/addons/documents/templates/ddoc_info.html
index fe4d72c..c06d5cf 100644
--- a/app/addons/documents/templates/ddoc_info.html
+++ b/app/addons/documents/templates/ddoc_info.html
@@ -1,4 +1,4 @@
-<!--
+<%/*
 Licensed under the Apache License, Version 2.0 (the "License"); you may not
 use this file except in compliance with the License. You may obtain a copy of
 the License at
@@ -10,11 +10,11 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 License for the specific language governing permissions and limitations under
 the License.
--->
+*/%>
 <div class="metadata-page">
   <header class="page-header">
     <h2>Design Document Metadata: _design/<%-Ddoc%> </h2>
-    <p class="help">Information about the specified design document, including the
index, index size and current status of the design document and associated index information.<a
href="<%- getDocUrl('design_doc_metadata') %>" class="help-link" target="_blank" data-bypass="true"><i
class="icon-question-sign"></i></a></p>
+    <p class="help">Information about the specified design document, including the
index, index size and current status of the design document and associated index information.<a
href="<%- getDocUrl('DESIGN_DOC_METADATA') %>" class="help-link" target="_blank" data-bypass="true"><i
class="icon-question-sign"></i></a></p>
   </header>
   <div class="row-fluid">
     <div class="span6">

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/documents/templates/design_doc_selector.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/design_doc_selector.html b/app/addons/documents/templates/design_doc_selector.html
index 2fcbadc..46435a7 100644
--- a/app/addons/documents/templates/design_doc_selector.html
+++ b/app/addons/documents/templates/design_doc_selector.html
@@ -12,7 +12,7 @@ License for the specific language governing permissions and limitations
under
 the License.
 -->
 <div class="span3">
-  <label for="ddoc">Save to Design Document <a class="help-link" data-bypass="true"
href="<%-getDocUrl('design_doc')%>" target="_blank"><i class="icon-question-sign"></i></a></label>
+  <label for="ddoc">Save to Design Document <a class="help-link" data-bypass="true"
href="<%-getDocUrl('DOC_URL_DESIGN_DOCS')%>" target="_blank"><i class="icon-question-sign"></i></a></label>
   <select id="ddoc">
     <optgroup label="Select a document">
       <option value="new-doc">New document</option>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/documents/templates/query_options_main_fields.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/query_options_main_fields.html b/app/addons/documents/templates/query_options_main_fields.html
index 81b8ee9..c2da0e9 100644
--- a/app/addons/documents/templates/query_options_main_fields.html
+++ b/app/addons/documents/templates/query_options_main_fields.html
@@ -14,7 +14,7 @@ the License.
 
 <span class="add-on">
   Query Options
-  <a class="help-link" href="<%-getDocUrl(documentation)%>" target="_blank" data-bypass="true">
+  <a class="help-link" href="<%-documentation%>" target="_blank" data-bypass="true">
     <i class="icon-question-sign"></i>
   </a>
 </span>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/documents/templates/view_editor.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/view_editor.html b/app/addons/documents/templates/view_editor.html
index d22c734..8c8a4ee 100644
--- a/app/addons/documents/templates/view_editor.html
+++ b/app/addons/documents/templates/view_editor.html
@@ -31,13 +31,13 @@ the License.
           </div>
 
           <div class="control-group">
-            <label for="index-name">Index name <a class="help-link" data-bypass="true"
href="<%-getDocUrl('view_functions')%>" target="_blank"><i class="icon-question-sign"></i></a></label>
+            <label for="index-name">Index name <a class="help-link" data-bypass="true"
href="<%-getDocUrl('VIEW_FUNCS')%>" target="_blank"><i class="icon-question-sign"></i></a></label>
             <input type="text" id="index-name" value="<%- viewName %>" placeholder="Index
name" />
           </div>
 
 
           <div class="control-group">
-            <label for="map-function">Map function <a class="help-link" data-bypass="true"
href="<%-getDocUrl('map_functions')%>" target="_blank"><i class="icon-question-sign"></i></a></label>
+            <label for="map-function">Map function <a class="help-link" data-bypass="true"
href="<%-getDocUrl('MAP_FUNCS')%>" target="_blank"><i class="icon-question-sign"></i></a></label>
             <% if (newView) { %>
             <div class="js-editor" id="map-function"><%= langTemplates.map %></div>
             <% } else { %>
@@ -48,7 +48,7 @@ the License.
 
 
           <div class="control-group">
-            <label for="reduce-function-selector">Reduce (optional) <a class="help-link"
data-bypass="true" href="<%-getDocUrl('reduce_functions')%>" target="_blank"><i
class="icon-question-sign"></i></a></label>
+            <label for="reduce-function-selector">Reduce (optional) <a class="help-link"
data-bypass="true" href="<%-getDocUrl('REDUCE_FUNCS')%>" target="_blank"><i class="icon-question-sign"></i></a></label>
 
             <select id="reduce-function-selector">
               <option value="" <%- !reduceFunStr ? 'selected="selected"' : '' %>>None</option>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index c76fb9d..4548495 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -208,14 +208,14 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) {
         }
       });
 
-      FauxtonAPI.Events.on(FauxtonAPI.constants.EVENT_TRAY_OPENED, this.onTrayOpenEvent,
this);
+      FauxtonAPI.Events.on(FauxtonAPI.constants.EVENTS.TRAY_OPENED, this.onTrayOpenEvent,
this);
     },
 
     cleanup: function() {
       $('body').off('click.' + this.trayId);
     },
 
-    // all trays publish a EVENT_TRAY_OPENED event containing their unique ID. This listens
for those events and
+    // all trays publish a EVENTS.TRAY_OPENED event containing their unique ID. This listens
for those events and
     // closes the current tray if it's already open
     onTrayOpenEvent: function (msg) {
       if (!_.has(msg, 'trayId')) {
@@ -239,7 +239,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) {
 
     hideTray: function () {
       var $tray = this.$('.tray');
-      $tray.velocity('reverse', FauxtonAPI.constants.TRAY_TOGGLE_SPEED, function () {
+      $tray.velocity('reverse', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function ()
{
         $tray.hide();
       });
 
@@ -247,11 +247,11 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) {
         this.$(this.toggleTrayBtnSelector).removeClass('enabled');
       }
       // announce that the tray is being closed
-      FauxtonAPI.Events.trigger(FauxtonAPI.constants.EVENT_TRAY_CLOSED, { trayId: this.trayId
});
+      FauxtonAPI.Events.trigger(FauxtonAPI.constants.EVENTS.TRAY_CLOSED, { trayId: this.trayId
});
     },
 
     showTray: function () {
-      this.$('.tray').velocity('transition.slideDownIn', FauxtonAPI.constants.TRAY_TOGGLE_SPEED);
+      this.$('.tray').velocity('transition.slideDownIn', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED);
       if (!_.isNull(this.toggleTrayBtnSelector)) {
         this.$(this.toggleTrayBtnSelector).addClass('enabled');
       }
@@ -260,7 +260,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) {
         this.onShowTray();
       }
 
-      FauxtonAPI.Events.trigger(FauxtonAPI.constants.EVENT_TRAY_OPENED, { trayId: this.trayId
});
+      FauxtonAPI.Events.trigger(FauxtonAPI.constants.EVENTS.TRAY_OPENED, { trayId: this.trayId
});
     },
 
     trayVisible: function () {
@@ -275,7 +275,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) {
     initialize: function (options) {
       var _options = options || {};
       this.endpoint = _options.endpoint || '_all_docs';
-      this.documentation = _options.documentation || 'docs';
+      this.documentation = _options.documentation || FauxtonAPI.constants.DOC_URLS.GENERAL;
 
       this.initTray({ toggleTrayBtnSelector: '.api-url-btn' });
     },
@@ -1036,7 +1036,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) {
 
     closeTray: function () {
       var $tray = this.$el;
-      $tray.velocity("reverse", FauxtonAPI.constants.TRAY_TOGGLE_SPEED, function () {
+      $tray.velocity("reverse", FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function ()
{
         $tray.hide();
       });
       FauxtonAPI.Events.trigger('lookaheadTray:close');

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/fauxton/templates/api_bar.html
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/templates/api_bar.html b/app/addons/fauxton/templates/api_bar.html
index eee43f3..68e4991 100644
--- a/app/addons/fauxton/templates/api_bar.html
+++ b/app/addons/fauxton/templates/api_bar.html
@@ -21,7 +21,7 @@ the License.
     <div class="input-prepend input-append">
       <span class="add-on">
         API URL
-        <a class="help-link" data-bypass="true" href="<%-getDocUrl(documentation)%>"
target="_blank">
+        <a class="help-link" data-bypass="true" href="<%-documentation%>" target="_blank">
           <i class="icon icon-question-sign"></i>
         </a>
       </span>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/fauxton/templates/nav_bar.html
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/templates/nav_bar.html b/app/addons/fauxton/templates/nav_bar.html
index 194fd7a..da6a668 100644
--- a/app/addons/fauxton/templates/nav_bar.html
+++ b/app/addons/fauxton/templates/nav_bar.html
@@ -1,4 +1,4 @@
-<!--
+<%/*
 Licensed under the Apache License, Version 2.0 (the "License"); you may not
 use this file except in compliance with the License. You may obtain a copy of
 the License at
@@ -10,7 +10,7 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 License for the specific language governing permissions and limitations under
 the License.
--->
+*/%>
 
 <div class="burger">
   <div><!-- * --></div>
@@ -34,7 +34,7 @@ the License.
   <div id="bottom-nav">
     <ul id="bottom-nav-links" class="nav">
       <li data-nav-name= "Documentation">
-        <a data-bypass="true" href="<%-getDocUrl('docs')%>" target="_blank">
+        <a data-bypass="true" href="<%-getDocUrl('GENERAL')%>" target="_blank">
           <i class="fonticon-bookmark fonticon"></i>
             Documentation
         </a>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/permissions/templates/section.html
----------------------------------------------------------------------
diff --git a/app/addons/permissions/templates/section.html b/app/addons/permissions/templates/section.html
index a320c90..ff3a435 100644
--- a/app/addons/permissions/templates/section.html
+++ b/app/addons/permissions/templates/section.html
@@ -13,7 +13,7 @@ the License.
 -->
 <header class="page-header">
 <h3> <%- section %> </h3>
-<p class="help"> <%- help %> <a class="help-link" data-bypass="true" href="<%-getDocUrl('database_permission')%>"
target="_blank"><i class="icon-question-sign"> </i> </a></p>
+<p class="help"> <%- help %> <a class="help-link" data-bypass="true" href="<%-getDocUrl('DB_PERMISSION')%>"
target="_blank"><i class="icon-question-sign"> </i> </a></p>
 </header>
 
 <div class="row-fluid">

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/replication/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/resources.js b/app/addons/replication/resources.js
index 4e3988b..73a8cc5 100644
--- a/app/addons/replication/resources.js
+++ b/app/addons/replication/resources.js
@@ -59,7 +59,7 @@ function (app, FauxtonAPI, ActiveTasks) {
   });
 
   Replication.Replicate = Backbone.Model.extend({
-    documentation: "replication_doc",
+    documentation: FauxtonAPI.constants.DOC_URLS.REPLICATION,
     url: function(){
       return window.location.origin + "/_replicate";
     }

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/addons/replication/templates/form.html
----------------------------------------------------------------------
diff --git a/app/addons/replication/templates/form.html b/app/addons/replication/templates/form.html
index e354bc0..7bd1bfa 100644
--- a/app/addons/replication/templates/form.html
+++ b/app/addons/replication/templates/form.html
@@ -63,7 +63,7 @@ the License.
 
 			<label for="createTarget">
 				<input type="checkbox" name="create_target" value="true" id="createTarget">
-				Create Target <a class="help-link" data-bypass="true" href="<%-getDocUrl('replication_doc')%>"
target="_blank"><i class="icon-question-sign" rel="tooltip" title="Create the target
database"></i></a>
+				Create Target <a class="help-link" data-bypass="true" href="<%-getDocUrl('REPLICATION')%>"
target="_blank"><i class="icon-question-sign" rel="tooltip" title="Create the target
database"></i></a>
 			</label>
 		</div>
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/constants.js
----------------------------------------------------------------------
diff --git a/app/constants.js b/app/constants.js
index 9fa318e..d4b4df6 100644
--- a/app/constants.js
+++ b/app/constants.js
@@ -13,13 +13,38 @@
 define([], function () {
 
   var constants = {
-    TRAY_TOGGLE_SPEED: 250,
-    DEFAULT_PAGE_SIZE: 20,
+
+    MISC: {
+      TRAY_TOGGLE_SPEED: 250,
+      DEFAULT_PAGE_SIZE: 20
+    },
 
     // events
-    EVENT_TRAY_CLOSED: 'tray:closed',
-    EVENT_TRAY_OPENED: 'tray:opened',
-    EVENT_BURGER_CLICKED: 'burger:clicked'
+    EVENTS: {
+      TRAY_CLOSED: 'tray:closed',
+      TRAY_OPENED: 'tray:opened',
+      BURGER_CLICKED: 'burger:clicked'
+    },
+
+    // documentation URLs
+    DOC_URLS: {
+      GENERAL: '/_utils/docs/intro/api.html#documents',
+      ALL_DBS: '/_utils/docs/api/server/common.html?highlight=all_dbs#get--_all_dbs',
+      REPLICATION: '/_utils/docs/replication/replicator.html#basics',
+      DESIGN_DOCS: '/_utils/docs/couchapp/ddocs.html#design-docs',
+      DESIGN_DOC_METADATA: '/_utils/docs/api/ddoc/common.html#api-ddoc-view-index-info',
+      VIEW_FUNCS: '/_utils/docs/couchapp/ddocs.html#view-functions',
+      MAP_FUNCS: '/_utils/docs/couchapp/ddocs.html#map-functions',
+      REDUCE_FUNCS: '/_utils/docs/couchapp/ddocs.html#reduce-and-rereduce-functions',
+      API_REF: '/_utils/docs/http-api.html',
+      DB_PERMISSION: '/_utils/docs/api/database/security.html#db-security',
+      STATS: '/_utils/docs/api/server/common.html?highlight=stats#get--_stats',
+      ACTIVE_TASKS: '/_utils/docs/api/server/common.html?highlight=stats#active-tasks',
+      LOG: '/_utils/docs/api/server/common.html?highlight=stats#log',
+      CONFIG: '/_utils/docs/config/index.html',
+      VIEWS: '/_utils/docs/intro/overview.html#views',
+      CHANGES: '/_utils/docs/api/database/changes.html?highlight=changes#post--db-_changes'
+    }
   };
 
   return constants;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/07fe0738/app/helpers.js
----------------------------------------------------------------------
diff --git a/app/helpers.js b/app/helpers.js
index acaaba2..025ab37 100644
--- a/app/helpers.js
+++ b/app/helpers.js
@@ -19,11 +19,12 @@
 
 
 define([
+  'constants',
   "core/utils",
   "d3"
 ],
 
-function(utils, d3) {
+function(constants, utils, d3) {
 
   var Helpers = {};
 
@@ -36,29 +37,8 @@ function(utils, d3) {
     return path;
   };
 
-  // Get the URL for documentation, wiki, wherever we store it.
-  // update the URLs in documentation_urls.js
-  Helpers.docs =  {
-    "docs": "/_utils/docs/intro/api.html#documents",
-    "all_dbs": "/_utils/docs/api/server/common.html?highlight=all_dbs#get--_all_dbs",
-    "replication_doc": "/_utils/docs/replication/replicator.html#basics",
-    "design_doc": "/_utils/docs/couchapp/ddocs.html#design-docs",
-    "design_doc_metadata" : "/_utils/docs/api/ddoc/common.html#api-ddoc-view-index-info",
-    "view_functions": "/_utils/docs/couchapp/ddocs.html#view-functions",
-    "map_functions": "/_utils/docs/couchapp/ddocs.html#map-functions",
-    "reduce_functions": "/_utils/docs/couchapp/ddocs.html#reduce-and-rereduce-functions",
-    "api_reference": "/_utils/docs/http-api.html",
-    "database_permission": "/_utils/docs/api/database/security.html#db-security",
-    "stats": "/_utils/docs/api/server/common.html?highlight=stats#get--_stats",
-    "_active_tasks": "/_utils/docs/api/server/common.html?highlight=stats#active-tasks",
-    "log": "/_utils/docs/api/server/common.html?highlight=stats#log",
-    "config": "/_utils/docs/config/index.html",
-    "views": "/_utils/docs/intro/overview.html#views",
-    "changes": "/_utils/docs/api/database/changes.html?highlight=changes#post--db-_changes"
-  };
-
-  Helpers.getDocUrl = function(docKey){
-    return Helpers.docs[docKey] || '#';
+  Helpers.getDocUrl = function (key) {
+    return (_.has(constants.DOC_URLS, key)) ? constants.DOC_URLS[key] : '#';
   };
 
   // File size pretty printing, taken from futon.format.js


Mime
View raw message