From 25038770a44552f5644fdf67415ffbb6dfb0953a Mon Sep 17 00:00:00 2001 From: Brett Slatkin Date: Sun, 23 Dec 2012 14:21:17 -0800 Subject: [PATCH] newui: Index now renders vault name Change-Id: I8107a61c4c928729ca751308b3dfe788c7a755d1 --- server/camlistored/newui/index.html | 21 +++++- server/camlistored/newui/index.js | 90 +++++++++++++++++++++++++ server/camlistored/newui/server_type.js | 27 ++++++++ 3 files changed, 135 insertions(+), 3 deletions(-) create mode 100644 server/camlistored/newui/index.js diff --git a/server/camlistored/newui/index.html b/server/camlistored/newui/index.html index ba3a386d8..60bfc5c54 100644 --- a/server/camlistored/newui/index.html +++ b/server/camlistored/newui/index.html @@ -1,3 +1,18 @@ -I am newui index.html. Hi. - - + + + + + + + + + + + + + diff --git a/server/camlistored/newui/index.js b/server/camlistored/newui/index.js new file mode 100644 index 000000000..e7bcc9132 --- /dev/null +++ b/server/camlistored/newui/index.js @@ -0,0 +1,90 @@ +/** + * @fileoverview TODO + * + */ +goog.provide('camlistore.IndexPage'); + +goog.require('goog.dom'); +goog.require('goog.dom.classes'); +goog.require('goog.events.EventHandler'); +goog.require('goog.events.EventType'); +goog.require('goog.ui.Component'); + + + +/** + * @param {camlistore.ServerType.DiscoveryDocument} config Global config + * of the current server this page is being rendered for. + * @param {goog.dom.DomHelper=} opt_domHelper DOM helper to use. + * + * @extends {goog.ui.Component} + * @constructor + */ +camlistore.IndexPage = function(config, opt_domHelper) { + goog.base(this, opt_domHelper); + + /** + * @type {Object} + * @private + */ + this.config_ = config; + + /** + * @type {goog.events.EventHandler} + * @private + */ + this.eh_ = new goog.events.EventHandler(this); +}; +goog.inherits(camlistore.IndexPage, goog.ui.Component); + + + +/** + * Creates an initial DOM representation for the component. + */ +camlistore.IndexPage.prototype.createDom = function() { + this.decorateInternal(this.dom_.createElement('div')); +}; + + +/** + * Decorates an existing HTML DIV element. + * @param {Element} element The DIV element to decorate. + */ +camlistore.IndexPage.prototype.decorateInternal = function(element) { + camlistore.IndexPage.superClass_.decorateInternal.call(this, element); + + var el = this.getElement(); + goog.dom.classes.add(el, 'cam-index-page'); + + var titleEl = this.dom_.createDom('h1', 'cam-index-page-title'); + this.dom_.setTextContent(titleEl, this.config_.ownerName + '\'s Vault'); + + this.dom_.appendChild(el, titleEl); +}; + + +/** @override */ +camlistore.IndexPage.prototype.disposeInternal = function() { + camlistore.IndexPage.superClass_.disposeInternal.call(this); + this.eh_.dispose(); +}; + + +/** + * Called when component's element is known to be in the document. + */ +camlistore.IndexPage.prototype.enterDocument = function() { + camlistore.IndexPage.superClass_.enterDocument.call(this); + // Add event handlers here +}; + + +/** + * Called when component's element is known to have been removed from the + * document. + */ +camlistore.IndexPage.prototype.exitDocument = function() { + camlistore.IndexPage.superClass_.exitDocument.call(this); + // Clear event handlers here +}; diff --git a/server/camlistored/newui/server_type.js b/server/camlistored/newui/server_type.js index 061dec6b4..481f20a5f 100644 --- a/server/camlistored/newui/server_type.js +++ b/server/camlistored/newui/server_type.js @@ -4,6 +4,33 @@ goog.provide('camlistore.ServerType'); +/** + * @typedef {{ + * currentPermanode: string, + * name: string, + * prefix: Array., + * }} + */ +camlistore.ServerType.DiscoveryRoot; + + +/** + * @typedef {{ + * blobRoot: string, + * directoryHelper: string, + * downloadHelper: string, + * jsonSignRoot: string, + * ownerName: string, + * publishRoots: Array., + * searchRoot: string, + * storageGeneration: string, + * storageInitTime: string, + * uploadHelper: string, + * }} + */ +camlistore.ServerType.DiscoveryDocument; + + /** * @typedef {{ * fileName: string,