diff options
author | suelockwood <deathbear@apache.org> | 2014-04-01 13:40:35 -0400 |
---|---|---|
committer | suelockwood <deathbear@apache.org> | 2014-04-01 13:40:43 -0400 |
commit | 50382cadc00b292ae74d0e976b88dbc3b0392871 (patch) | |
tree | fe88b2ec27497970cd0c35c85a028dea542def04 | |
parent | 027ffa44a71f84a0978930e826f0ba2194eb4efa (diff) | |
download | couchdb-50382cadc00b292ae74d0e976b88dbc3b0392871.tar.gz |
Update template helpers with utils methods for encoding and removing special characters
-rw-r--r-- | src/fauxton/app/helpers.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/fauxton/app/helpers.js b/src/fauxton/app/helpers.js index d4836b909..a58cc20c4 100644 --- a/src/fauxton/app/helpers.js +++ b/src/fauxton/app/helpers.js @@ -12,20 +12,25 @@ // This file creates a set of helper functions that will be loaded for all html -// templates. These functions should be self contained and not rely on any +// templates. These functions should be self contained and not rely on any // external dependencies as they are loaded prior to the application. We may // want to change this later, but for now this should be thought of as a // "purely functional" helper system. define([ + "core/utils", "d3" ], -function() { +function(utils) { var Helpers = {}; + Helpers.removeSpecialCharacters = utils.removeSpecialCharacters; + + Helpers.safeURL = utils.safeURLName; + Helpers.imageUrl = function(path) { // TODO: add dynamic path for different deploy targets return path; @@ -33,7 +38,7 @@ function() { // Get the URL for documentation, wiki, wherever we store it. - // update the URLs in documentation_urls.js + // update the URLs in documentation_urls.js Helpers.docs = { "docs": "http://docs.couchdb.org/en/latest/intro/api.html#documents", "all_dbs": "http://docs.couchdb.org/en/latest/api/server/common.html?highlight=all_dbs#get--_all_dbs", @@ -50,8 +55,8 @@ function() { "config": "http://docs.couchdb.org/en/latest/config/index.html", "views": "http://docs.couchdb.org/en/latest/intro/overview.html#views", "changes": "http://docs.couchdb.org/en/latest/api/database/changes.html?highlight=changes#post--db-_changes" - }; - + }; + Helpers.getDocUrl = function(docKey){ return Helpers.docs[docKey] || '#'; }; @@ -70,7 +75,7 @@ function() { }; Helpers.formatDate = function(timestamp){ - format = d3.time.format("%b. %e at %H:%M%p"); + format = d3.time.format("%b. %e at %H:%M%p"); return format(new Date(timestamp*1000)); }; |