Genericize Google Drive Links

Replace the two drive links on the "contact us" page with values that can be
driven from the config.  The drive links are the link to the technical
documentation folder and the link to the registrar's transaction activity
reports.  The former is a straightforward static replacement, but the latter
is derived from a per-registrar Google Drive id which must be formatted using
a template from the config module.

Note: This currently requires adding the transaction activity URL template to
the old-style RegistryConfig class instead of the daggerized ConfigModule
because this is the easiest way to pass it though to the non-daggerized
RegistrarServlet.  In an upcoming CL, I'll convert RegistrarServlet to
RegistrarAction and then I'll be able to make this template injectable.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137518466
This commit is contained in:
mmuller 2016-10-28 09:21:21 -07:00 committed by Ben McIlwain
parent c89a902b72
commit 2e4273c4f4
14 changed files with 50 additions and 23 deletions

View file

@ -141,6 +141,16 @@ public final class ConfigModule {
return "+1 (888) 555 0123";
}
/**
* The URL for technical support docs. Used in the "contact-us" section of the registrar console.
*/
@Provides
@Config("technicalDocsUrl")
public static String provideTechnicalDocsUrl(RegistryEnvironment environment) {
// Change this to your support docs link.
return "http://example.com/your_support_docs/";
}
/** @see RegistryConfig#getZoneFilesBucket() */
@Provides
@Config("zoneFilesBucket")

View file

@ -16,7 +16,6 @@ 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');
@ -45,15 +44,6 @@ 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

@ -33,11 +33,13 @@ goog.require('registry.registrar.Console');
* @param {string} supportEmail
* @param {string} announcementsEmail
* @param {string} supportPhoneNumber
* @param {string} technicalDocsUrl
* @export
*/
registry.registrar.main = function(xsrfToken, clientId, productName,
integrationEmail, supportEmail,
announcementsEmail, supportPhoneNumber) {
announcementsEmail, supportPhoneNumber,
technicalDocsUrl) {
new registry.registrar.Console({
xsrfToken: xsrfToken,
clientId: clientId,
@ -45,6 +47,7 @@ registry.registrar.main = function(xsrfToken, clientId, productName,
integrationEmail: integrationEmail,
supportEmail: supportEmail,
announcementsEmail: announcementsEmail,
supportPhoneNumber: supportPhoneNumber
supportPhoneNumber: supportPhoneNumber,
technicalDocsUrl: technicalDocsUrl
});
};

View file

@ -16,6 +16,7 @@ goog.provide('registry.ResourceComponent');
goog.require('goog.dom');
goog.require('goog.json');
goog.require('goog.object');
goog.require('registry.EditItem');
goog.require('registry.forms');
goog.require('registry.util');
@ -53,6 +54,15 @@ registry.ResourceComponent = function(
goog.inherits(registry.ResourceComponent, registry.EditItem);
/** @override */
registry.ResourceComponent.prototype.renderItem = function(rspObj) {
// Augment the console parameters with the response object, we'll need both.
var params = goog.object.clone(this.console.params);
goog.object.extend(params, rspObj);
registry.ResourceComponent.base(this, 'renderItem', params);
};
/** @override */
registry.ResourceComponent.prototype.bindToDom = function(id) {
registry.ResourceComponent.base(this, 'bindToDom', id);

View file

@ -64,6 +64,7 @@ public final class ConsoleUiAction implements Runnable {
@Inject @Config("supportEmail") String supportEmail;
@Inject @Config("announcementsEmail") String announcementsEmail;
@Inject @Config("supportPhoneNumber") String supportPhoneNumber;
@Inject @Config("technicalDocsUrl") String technicalDocsUrl;
@Inject @Config("registrarConsoleEnabled") boolean enabled;
@Inject ConsoleUiAction() {}
@ -79,6 +80,7 @@ public final class ConsoleUiAction implements Runnable {
data.put("supportEmail", supportEmail);
data.put("announcementsEmail", announcementsEmail);
data.put("supportPhoneNumber", supportPhoneNumber);
data.put("technicalDocsUrl", technicalDocsUrl);
if (!enabled) {
response.setStatus(SC_SERVICE_UNAVAILABLE);
response.setPayload(

View file

@ -32,6 +32,7 @@
{@param supportEmail: string}
{@param announcementsEmail: string}
{@param supportPhoneNumber: string}
{@param technicalDocsUrl: string}
{call registry.soy.console.header}
{param app: 'registrar' /}
@ -72,7 +73,8 @@
{$integrationEmail},
{$supportEmail},
{$announcementsEmail},
{$supportPhoneNumber});
{$supportPhoneNumber},
{$technicalDocsUrl});
</script>
{/if}
{/template}
@ -269,6 +271,7 @@
/** Resources and billing links. */
{template .resources}
{@param? driveFolderId: string}
{@param technicalDocsUrl: string}
<div id="domain-registrar-resources">
<h1>Resources &amp; billing</h1>
<p>
@ -276,10 +279,10 @@
important documentation.
<h2><img src="/assets/images/folder.png">TLD information</h2>
<p>
Find onboarding FAQs &amp; technical documentation in this folder.
Find onboarding FAQs &amp; technical documentation here:
<br><br>
<a class="{css kd-button} {css kd-button-submit}"
href="https://drive.google.com/a/googleregistry.co/folderview?id=0B-X8z5IcswtqNmw5ekx2bU51ckk&usp=sharing"
href="{$technicalDocsUrl}"
target="_blank" rel="noopener">View TLD information on Google Drive</a>
<h2><img src="/assets/images/folder.png">Billing details</h2>
<p>
@ -288,7 +291,7 @@
{if (isNonnull($driveFolderId))}
<a id="reg-resources-driveLink"
class="{css kd-button} {css kd-button-submit}"
href="https://drive.google.com/a/googleregistry.co/folderview?id={$driveFolderId}&usp=sharing"
href="https://drive.google.com/drive/folders/{$driveFolderId}"
target="_blank" rel="noopener">View billing details on Google Drive</a>
{else}
<em>Your billing folder is pending allocation.</em>

View file

@ -57,7 +57,8 @@ function setUp() {
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123'
supportPhoneNumber: '+1 (888) 555 0123',
technicalDocsUrl: 'http://example.com/techdocs',
});
registry.registrar.ConsoleTestUtil.setup(test);
var regNavlist = $('reg-navlist');
@ -126,7 +127,8 @@ function testShowLoginOrDash() {
function testNavToResources() {
registry.registrar.ConsoleTestUtil.visit(test, {
path: 'resources',
xsrfToken: test.testXsrfToken
xsrfToken: test.testXsrfToken,
technicalDocsUrl: 'http://example.com/techdocs'
});
var xhr = goog.testing.net.XhrIo.getSendInstances().pop();
assertTrue(xhr.isActive());

View file

@ -57,6 +57,7 @@ function setUp() {
supportEmail: 'support@google.com',
announcementsEmail: 'announcements@google.com',
supportPhoneNumber: '123 456 7890',
technicalDocsUrl: 'http://example.com/techdocs'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
registry.registrar.ConsoleTestUtil.setup(test);

View file

@ -47,7 +47,8 @@ function setUp() {
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123'
supportPhoneNumber: '+1 (888) 555 0123',
technicalDocsUrl: 'http://example.com/techdocs'
});
registry.registrar.ConsoleTestUtil.setup(test);
}

View file

@ -53,7 +53,8 @@ function setUp() {
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123'
supportPhoneNumber: '+1 (888) 555 0123',
technicalDocsUrl: 'http://example.com/techdocs'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);

View file

@ -53,7 +53,8 @@ function setUp() {
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123'
supportPhoneNumber: '+1 (888) 555 0123',
technicalDocsUrl: 'http://example.com/techdocs'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);

View file

@ -61,7 +61,8 @@ function setUp() {
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123'
supportPhoneNumber: '+1 (888) 555 0123',
technicalDocsUrl: 'http://example.com/techdocs'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
registry.registrar.ConsoleTestUtil.setup(test);

View file

@ -55,7 +55,8 @@ function setUp() {
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123'
supportPhoneNumber: '+1 (888) 555 0123',
technicalDocsUrl: 'http://example.com/techdocs'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
registry.registrar.ConsoleTestUtil.setup(test);

View file

@ -56,6 +56,7 @@ public class ConsoleUiActionTest {
action.supportEmail = "support@example.com";
action.announcementsEmail = "announcements@example.com";
action.supportPhoneNumber = "1 (888) 555 0123";
action.technicalDocsUrl = "http://example.com/technical-docs";
action.response = response;
action.sessionUtils = sessionUtils;
action.userService = UserServiceFactory.getUserService();