Repository: couchdb-fauxton Updated Branches: refs/heads/import-master b32c61733 -> 4ab2cde64
Update template helpers with utils methods for encoding and removing special characters Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/c2a3aec0 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/c2a3aec0 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/c2a3aec0 Branch: refs/heads/import-master Commit: c2a3aec05d6a453e493fa80b8fc06bd82d1b976e Parents: b32c617 Author: suelockwood <[email protected]> Authored: Tue Apr 1 13:40:35 2014 -0400 Committer: suelockwood <[email protected]> Committed: Tue Apr 1 13:40:43 2014 -0400 ---------------------------------------------------------------------- app/helpers.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c2a3aec0/app/helpers.js ---------------------------------------------------------------------- diff --git a/app/helpers.js b/app/helpers.js index d4836b9..a58cc20 100644 --- a/app/helpers.js +++ b/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)); };
