Genericize "Contact Us" page

Parameterize integration, support and announcement email addresses and contact
phone number, make static parameters flow through the system in a consistent
manner.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136183813
This commit is contained in:
mmuller 2016-10-14 12:16:23 -07:00 committed by Ben McIlwain
parent 6a4088a8b6
commit 84bbb9a7c0
16 changed files with 177 additions and 65 deletions

View file

@ -99,14 +99,46 @@ public final class ConfigModule {
@Provides
@Config("productName")
public static String provideProductName(RegistryEnvironment environment) {
switch (environment) {
case UNITTEST:
case LOCAL:
return "Nomulus";
default:
// Change this to the name of your product.
return "Google Registry";
}
return "Nomulus";
}
/**
* The e-mail address for questions about integrating with the registry. Used in the
* "contact-us" section of the registrar console.
*/
@Provides
@Config("integrationEmail")
public static String provideIntegrationEmail(RegistryEnvironment environment) {
return "integration@example.com";
}
/**
* The e-mail address for general support. Used in the "contact-us" section of the registrar
* console.
*/
@Provides
@Config("supportEmail")
public static String provideSupportEmail(RegistryEnvironment environment) {
return "support@example.com";
}
/**
* The "From" e-mail address for announcements. Used in the "contact-us" section of the
* registrar console.
*/
@Provides
@Config("announcementsEmail")
public static String provideAnnouncementsEmail(RegistryEnvironment environment) {
return "announcements@example.com";
}
/**
* The contact phone number. Used in the "contact-us" section of the registrar console.
*/
@Provides
@Config("supportPhoneNumber")
public static String provideSupportPhoneNumber(RegistryEnvironment environment) {
return "+1 (888) 555 0123";
}
/** @see RegistryConfig#getZoneFilesBucket() */

View file

@ -38,17 +38,19 @@ 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.
* @param {!Object} params Parameters to be passed into templates. These are
* a combination of configurable parameters (e.g. phone number) and
* user/session/registrar specific parameters. See
* registrar/Console.soy#.main for expected contents.
* @constructor
* @extends {registry.Console}
* @final
*/
registry.registrar.Console = function(xsrfToken, clientId, productName) {
registry.registrar.Console = function(params) {
registry.registrar.Console.base(
this, 'constructor',
new registry.registrar.EppSession(this, xsrfToken, clientId));
new registry.registrar.EppSession(this, params.xsrfToken,
params.clientId));
/**
* Component that's currently embedded in the page.
@ -62,15 +64,9 @@ registry.registrar.Console = function(xsrfToken, clientId, productName) {
this.history.setEnabled(true);
/**
* @type {!string}
* @private
* @type {!Object}
*/
this.xsrfToken_ = xsrfToken;
/**
* @type {string}
*/
this.productName = productName;
this.params = params;
/**
* Last active nav element.
@ -142,7 +138,7 @@ registry.registrar.Console.prototype.handleHashChange = function() {
componentCtor = this.pageMap[''];
}
var oldComponent = this.component_;
this.component_ = new componentCtor(this, this.xsrfToken_);
this.component_ = new componentCtor(this, this.params.xsrfToken);
this.registerDisposable(this.component_);
this.component_.basePath = type;
this.component_.bindToDom(id);

View file

@ -16,6 +16,7 @@ goog.provide('registry.registrar.ContactUs');
goog.require('goog.Uri');
goog.require('goog.dom');
goog.require('goog.object');
goog.require('registry.Resource');
goog.require('registry.ResourceComponent');
goog.require('registry.soy.registrar.console');
@ -44,6 +45,15 @@ registry.registrar.ContactUs = function(console, xsrfToken) {
goog.inherits(registry.registrar.ContactUs, registry.ResourceComponent);
/** @override */
registry.registrar.ContactUs.prototype.renderItem = function(rspObj) {
// Augment the static parameters with the response object, we'll need both.
var params = goog.object.clone(this.console.params);
goog.object.extend(params, rspObj);
registry.registrar.ContactUs.base(this, 'renderItem', params);
};
/** @override */
registry.registrar.ContactUs.prototype.bindToDom = function(id) {
registry.registrar.ContactUs.base(this, 'bindToDom', '');

View file

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

View file

@ -29,8 +29,22 @@ 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.
* @param {string} integrationEmail
* @param {string} supportEmail
* @param {string} announcementsEmail
* @param {string} supportPhoneNumber
* @export
*/
registry.registrar.main = function(xsrfToken, clientId, productName) {
new registry.registrar.Console(xsrfToken, clientId, productName);
registry.registrar.main = function(xsrfToken, clientId, productName,
integrationEmail, supportEmail,
announcementsEmail, supportPhoneNumber) {
new registry.registrar.Console({
xsrfToken: xsrfToken,
clientId: clientId,
productName: productName,
integrationEmail: integrationEmail,
supportEmail: supportEmail,
announcementsEmail: announcementsEmail,
supportPhoneNumber: supportPhoneNumber
});
};

View file

@ -60,6 +60,10 @@ public final class ConsoleUiAction implements Runnable {
@Inject UserService userService;
@Inject @Config("logoFilename") String logoFilename;
@Inject @Config("productName") String productName;
@Inject @Config("integrationEmail") String integrationEmail;
@Inject @Config("supportEmail") String supportEmail;
@Inject @Config("announcementsEmail") String announcementsEmail;
@Inject @Config("supportPhoneNumber") String supportPhoneNumber;
@Inject @Config("registrarConsoleEnabled") boolean enabled;
@Inject ConsoleUiAction() {}
@ -71,6 +75,10 @@ public final class ConsoleUiAction implements Runnable {
SoyMapData data = new SoyMapData();
data.put("logoFilename", logoFilename);
data.put("productName", productName);
data.put("integrationEmail", integrationEmail);
data.put("supportEmail", supportEmail);
data.put("announcementsEmail", announcementsEmail);
data.put("supportPhoneNumber", supportPhoneNumber);
if (!enabled) {
response.setStatus(SC_SERVICE_UNAVAILABLE);
response.setPayload(
@ -98,11 +106,12 @@ public final class ConsoleUiAction implements Runnable {
data.put("clientId", registrar.getClientId());
data.put("isAdmin", userService.isUserAdmin());
data.put("showPaymentLink", registrar.getBillingMethod() == Registrar.BillingMethod.BRAINTREE);
response.setPayload(
TOFU_SUPPLIER.get()
String payload = TOFU_SUPPLIER.get()
.newRenderer(ConsoleSoyInfo.MAIN)
.setCssRenamingMap(CSS_RENAMING_MAP_SUPPLIER.get())
.setData(data)
.render());
.render();
response.setPayload(payload);
}
}

View file

@ -28,6 +28,11 @@
{@param logoutUrl: string} /** Generated URL for logging out of Google. */
{@param showPaymentLink: bool}
{@param productName: string} /** Name to display for this software product. */
{@param integrationEmail: string}
{@param supportEmail: string}
{@param announcementsEmail: string}
{@param supportPhoneNumber: string}
{call registry.soy.console.header}
{param app: 'registrar' /}
{param subtitle: 'Registrar Console' /}
@ -61,7 +66,13 @@
{/switch}
{if isNonnull(DEBUG)}
<script>
registry.registrar.main({$xsrfToken}, {$clientId}, {$productName});
registry.registrar.main({$xsrfToken},
{$clientId},
{$productName},
{$integrationEmail},
{$supportEmail},
{$announcementsEmail},
{$supportPhoneNumber});
</script>
{/if}
{/template}
@ -197,6 +208,10 @@
/** Contact us. */
{template .contactUs}
{@param? phonePasscode: string}
{@param integrationEmail: string}
{@param supportEmail: string}
{@param announcementsEmail: string}
{@param supportPhoneNumber: string}
<div id="domain-registrar-contact-us" class="{css item}">
<h1>Contact us</h1>
<p>Our support team can assist you with any technical or operational
@ -209,21 +224,19 @@
</td>
<td class="{css setting}">
<p>
<a href="mailto:registry-integration@google.com">
registry-integration@google.com</a><br>
<a href="mailto:{$integrationEmail}">{$integrationEmail}</a><br>
For help with OT&amp;E sandbox and certification, or new
technical requirements for any of our new TLD launches.
<p>
<a href="mailto:registry-support@google.com">
registry-support@google.com</a><br>
<a href="mailto:{$supportEmail}">{$supportEmail}</a><br>
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
announcements
via <strong>registrar-announcement@google.com</strong>. You
via <strong>{$announcementsEmail}</strong>. You
will not be able to reply to those messages.
<tr><td colspan="2"><hr>
@ -246,7 +259,7 @@
</span>
<p>Call us at:
<p id="registry-phone"><a href="tel:+14049788419">+1 (404) 978 8419</a>
<p id="registry-phone"><a href="tel:{$supportPhoneNumber}">{$supportPhoneNumber}</a>
</td>
</table>
</div>