Make product name driven from config in the console

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135399007
This commit is contained in:
mmuller 2016-10-06 13:41:24 -07:00 committed by Ben McIlwain
parent 74369b69be
commit 129cbe8103
6 changed files with 42 additions and 21 deletions

View file

@ -40,11 +40,12 @@ goog.forwardDeclare('registry.Component');
* The Registrar Console.
* @param {string} xsrfToken Populated by server-side soy template.
* @param {string} clientId The logged in GAE user.
* @param {string} productName The software name displayed on the UI.
* @constructor
* @extends {registry.Console}
* @final
*/
registry.registrar.Console = function(xsrfToken, clientId) {
registry.registrar.Console = function(xsrfToken, clientId, productName) {
registry.registrar.Console.base(
this, 'constructor',
new registry.registrar.EppSession(this, xsrfToken, clientId));
@ -66,6 +67,11 @@ registry.registrar.Console = function(xsrfToken, clientId) {
*/
this.xsrfToken_ = xsrfToken;
/**
* @type {string}
*/
this.productName = productName;
/**
* Last active nav element.
* @type {Element}

View file

@ -54,7 +54,10 @@ registry.registrar.Dashboard.prototype.bindToDom = function(id) {
registry.registrar.Dashboard.base(this, 'bindToDom', '');
goog.dom.removeChildren(goog.dom.getRequiredElement('reg-appbar'));
goog.soy.renderElement(goog.dom.getElement('reg-content'),
registry.soy.registrar.console.dashboard);
registry.soy.registrar.console.dashboard,
{
productName: this.console.productName
});
goog.events.listen(goog.dom.getElement('rotate'),
goog.events.EventType.CLICK,
goog.bind(this.rotate_, this));

View file

@ -28,8 +28,9 @@ goog.require('registry.registrar.Console');
*
* @param {string} xsrfToken populated by server-side soy template.
* @param {string} clientId The registrar clientId.
* @param {string} productName the product name displayed by the UI.
* @export
*/
registry.registrar.main = function(xsrfToken, clientId) {
new registry.registrar.Console(xsrfToken, clientId);
registry.registrar.main = function(xsrfToken, clientId, productName) {
new registry.registrar.Console(xsrfToken, clientId, productName);
};

View file

@ -27,6 +27,7 @@
{@param isAdmin: bool} /** Is this user an App Engine account admin? */
{@param logoutUrl: string} /** Generated URL for logging out of Google. */
{@param showPaymentLink: bool}
{@param productName: string} /** Name to display for this software product. */
{call registry.soy.console.header}
{param app: 'registrar' /}
{param subtitle: 'Registrar Console' /}
@ -59,7 +60,9 @@
<script>goog.require('registry.registrar.main');</script>
{/switch}
{if isNonnull(DEBUG)}
<script>registry.registrar.main({$xsrfToken}, {$clientId});</script>
<script>
registry.registrar.main({$xsrfToken}, {$clientId}, {$productName});
</script>
{/if}
{/template}
@ -110,8 +113,8 @@
</a>
<h1>Console is disabled</h1>
<p>
The Registrar Console of the Google Registry is temporarily disabled. Please contact your
customer service representative for more information.
The {$productName} registrar console is temporarily disabled. Please
contact your customer service representative for more information.
<p>
<img src="/assets/images/android_sad.png">
</div>
@ -136,9 +139,9 @@
</a>
<h1>You need permission</h1>
<p>
The account you are logged in as is not associated with Google
Registry. Please contact your customer service representative or
switch to an account associated with Google Registry.
The account you are logged in as is not associated with {$productName}.
Please contact your customer service representative or
switch to an account associated with {$productName}.
<p>
You are signed in as <strong>{$username}</strong>.
<div>
@ -152,10 +155,11 @@
/** Welcome text and nav. */
{template .dashboard}
{@param productName: string}
<div id="domain-registrar-dashboard">
<h1>Welcome to the Google Registry Registrar Console<super>BETA</super></h1>
<p>This console can help you manage your relationship with Google
Registry and allow self-service for key operations.</p>
<h1>Welcome to the {$productName} Registrar Console<super>BETA</super></h1>
<p>This console can help you manage your relationship with {$productName}
and allow self-service for key operations.</p>
<table>
<tr>
<td>
@ -179,7 +183,7 @@
<h2>Contact Us</h2>
View important phone &amp; email<br>
contact information for<br>
Google Registry.
{$productName}.
</div>
</tr>
</table>
@ -213,8 +217,8 @@
<p>
<a href="mailto:registry-support@google.com">
registry-support@google.com</a><br>
For general purpose questions once you are integrated with
Google Registry. If the issue is urgent, please put
For general purpose questions once you are integrated
with our registry system. If the issue is urgent, please put
&quot;Urgent&quot; in the email title.
<p class="{css description}">Note: You may receive occasional service
@ -255,7 +259,8 @@
<div id="domain-registrar-resources">
<h1>Resources &amp; billing</h1>
<p>
Google Registry uses <strong>Google Drive</strong> to share important documentation.
The registry system uses <strong>Google Drive</strong> to share
important documentation.
<h2><img src="/assets/images/folder.png">TLD information</h2>
<p>
Find onboarding FAQs &amp; technical documentation in this folder.

View file

@ -70,7 +70,9 @@ function tearDown() {
function testButter() {
registry.registrar.ConsoleTestUtil.visit(test);
registry.registrar.ConsoleTestUtil.visit(test, {
productName: 'Foo Registry'
});
registry.util.butter('butter msg');
var butter = goog.dom.getElementByClass(goog.getCssName('kd-butterbar'));
assertNotNull(butter.innerHTML.match(/.*butter msg.*/));
@ -90,7 +92,8 @@ function testEppLogin() {
test, {
isEppLoggedIn: true,
testClientId: test.testClientId,
testXsrfToken: test.testXsrfToken
testXsrfToken: test.testXsrfToken,
productName: 'Foo Registry'
}, function() {
test.sessionMock.login(
goog.testing.mockmatchers.isFunction).$does(function() {
@ -109,7 +112,9 @@ function testEppLogin() {
/** Authed user with no path op specified should nav to welcome page. */
function testShowLoginOrDash() {
registry.registrar.ConsoleTestUtil.visit(test);
registry.registrar.ConsoleTestUtil.visit(test, {
productName: 'Foo Registry'
});
assertNotNull(goog.dom.getElement('domain-registrar-dashboard'));
}

View file

@ -88,7 +88,8 @@ registry.registrar.ConsoleTestUtil.visit = function(
/** @type {!registry.registrar.Console} */
test.console = new registry.registrar.Console(
opt_args.testXsrfToken,
opt_args.testClientId);
opt_args.testClientId,
opt_args.productName);
// XXX: Should be triggered via event passing.
test.console.handleHashChange();
test.mockControl.$verifyAll();