newui: Index now renders vault name

Change-Id: I8107a61c4c928729ca751308b3dfe788c7a755d1
This commit is contained in:
Brett Slatkin 2012-12-23 14:21:17 -08:00
parent 0cbf38b29a
commit 25038770a4
3 changed files with 135 additions and 3 deletions

View File

@ -1,3 +1,18 @@
<html><body>I am newui index.html. Hi.</body></html>
<!doctype html>
<html>
<head>
<script src="closure/goog/base.js"></script>
<script src="./deps.js"></script>
<script src="?camli.mode=config&var=CAMLISTORE_CONFIG"></script>
<script>
goog.require('camlistore.IndexPage');
</script>
<link rel="stylesheet" href="blob_item.css" type="text/css">
</head>
<body>
<script>
var page = new camlistore.IndexPage(window.CAMLISTORE_CONFIG);
page.render(document.body);
</script>
</body>
</html>

View File

@ -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
};

View File

@ -4,6 +4,33 @@
goog.provide('camlistore.ServerType');
/**
* @typedef {{
* currentPermanode: string,
* name: string,
* prefix: Array.<string>,
* }}
*/
camlistore.ServerType.DiscoveryRoot;
/**
* @typedef {{
* blobRoot: string,
* directoryHelper: string,
* downloadHelper: string,
* jsonSignRoot: string,
* ownerName: string,
* publishRoots: Array.<camlistore.ServerType.DiscoveryRoot>,
* searchRoot: string,
* storageGeneration: string,
* storageInitTime: string,
* uploadHelper: string,
* }}
*/
camlistore.ServerType.DiscoveryDocument;
/**
* @typedef {{
* fileName: string,