From 2e4273c4f42384115dfb8cd220fbe1654bd99a48 Mon Sep 17 00:00:00 2001 From: mmuller Date: Fri, 28 Oct 2016 09:21:21 -0700 Subject: [PATCH] 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 --- java/google/registry/config/ConfigModule.java | 10 ++++++++++ java/google/registry/ui/js/registrar/contact_us.js | 10 ---------- java/google/registry/ui/js/registrar/main.js | 7 +++++-- java/google/registry/ui/js/resource_component.js | 10 ++++++++++ .../registry/ui/server/registrar/ConsoleUiAction.java | 2 ++ java/google/registry/ui/soy/registrar/Console.soy | 11 +++++++---- .../google/registry/ui/js/registrar/console_test.js | 6 ++++-- .../registry/ui/js/registrar/contact_settings_test.js | 1 + .../google/registry/ui/js/registrar/contact_test.js | 3 ++- .../google/registry/ui/js/registrar/domain_test.js | 3 ++- .../google/registry/ui/js/registrar/host_test.js | 3 ++- .../ui/js/registrar/security_settings_test.js | 3 ++- .../registry/ui/js/registrar/whois_settings_test.js | 3 ++- .../ui/server/registrar/ConsoleUiActionTest.java | 1 + 14 files changed, 50 insertions(+), 23 deletions(-) diff --git a/java/google/registry/config/ConfigModule.java b/java/google/registry/config/ConfigModule.java index 478b9ecca..a8906943b 100644 --- a/java/google/registry/config/ConfigModule.java +++ b/java/google/registry/config/ConfigModule.java @@ -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") diff --git a/java/google/registry/ui/js/registrar/contact_us.js b/java/google/registry/ui/js/registrar/contact_us.js index 95db547f3..317b5925f 100644 --- a/java/google/registry/ui/js/registrar/contact_us.js +++ b/java/google/registry/ui/js/registrar/contact_us.js @@ -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', ''); diff --git a/java/google/registry/ui/js/registrar/main.js b/java/google/registry/ui/js/registrar/main.js index c3b85a7fb..d56953eef 100644 --- a/java/google/registry/ui/js/registrar/main.js +++ b/java/google/registry/ui/js/registrar/main.js @@ -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 }); }; diff --git a/java/google/registry/ui/js/resource_component.js b/java/google/registry/ui/js/resource_component.js index d932f01b6..6fa54e5e8 100644 --- a/java/google/registry/ui/js/resource_component.js +++ b/java/google/registry/ui/js/resource_component.js @@ -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); diff --git a/java/google/registry/ui/server/registrar/ConsoleUiAction.java b/java/google/registry/ui/server/registrar/ConsoleUiAction.java index 527963570..37aeeeaa4 100644 --- a/java/google/registry/ui/server/registrar/ConsoleUiAction.java +++ b/java/google/registry/ui/server/registrar/ConsoleUiAction.java @@ -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( diff --git a/java/google/registry/ui/soy/registrar/Console.soy b/java/google/registry/ui/soy/registrar/Console.soy index 60b7060df..8d5c6d2eb 100644 --- a/java/google/registry/ui/soy/registrar/Console.soy +++ b/java/google/registry/ui/soy/registrar/Console.soy @@ -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}); {/if} {/template} @@ -269,6 +271,7 @@ /** Resources and billing links. */ {template .resources} {@param? driveFolderId: string} + {@param technicalDocsUrl: string}

Resources & billing

@@ -276,10 +279,10 @@ important documentation.

TLD information

- Find onboarding FAQs & technical documentation in this folder. + Find onboarding FAQs & technical documentation here:

View TLD information on Google Drive

Billing details

@@ -288,7 +291,7 @@ {if (isNonnull($driveFolderId))} View billing details on Google Drive {else} Your billing folder is pending allocation. diff --git a/javatests/google/registry/ui/js/registrar/console_test.js b/javatests/google/registry/ui/js/registrar/console_test.js index 7aab3899d..cf3f81b16 100644 --- a/javatests/google/registry/ui/js/registrar/console_test.js +++ b/javatests/google/registry/ui/js/registrar/console_test.js @@ -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()); diff --git a/javatests/google/registry/ui/js/registrar/contact_settings_test.js b/javatests/google/registry/ui/js/registrar/contact_settings_test.js index a9b4b27a5..f79414943 100644 --- a/javatests/google/registry/ui/js/registrar/contact_settings_test.js +++ b/javatests/google/registry/ui/js/registrar/contact_settings_test.js @@ -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); diff --git a/javatests/google/registry/ui/js/registrar/contact_test.js b/javatests/google/registry/ui/js/registrar/contact_test.js index 334cef498..3e0e63393 100644 --- a/javatests/google/registry/ui/js/registrar/contact_test.js +++ b/javatests/google/registry/ui/js/registrar/contact_test.js @@ -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); } diff --git a/javatests/google/registry/ui/js/registrar/domain_test.js b/javatests/google/registry/ui/js/registrar/domain_test.js index 41de39dce..8cded55c8 100644 --- a/javatests/google/registry/ui/js/registrar/domain_test.js +++ b/javatests/google/registry/ui/js/registrar/domain_test.js @@ -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); diff --git a/javatests/google/registry/ui/js/registrar/host_test.js b/javatests/google/registry/ui/js/registrar/host_test.js index 08ac98867..b541a6a8e 100644 --- a/javatests/google/registry/ui/js/registrar/host_test.js +++ b/javatests/google/registry/ui/js/registrar/host_test.js @@ -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); diff --git a/javatests/google/registry/ui/js/registrar/security_settings_test.js b/javatests/google/registry/ui/js/registrar/security_settings_test.js index a165140fe..56b4e2179 100644 --- a/javatests/google/registry/ui/js/registrar/security_settings_test.js +++ b/javatests/google/registry/ui/js/registrar/security_settings_test.js @@ -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); diff --git a/javatests/google/registry/ui/js/registrar/whois_settings_test.js b/javatests/google/registry/ui/js/registrar/whois_settings_test.js index 4a095bebe..a5911779c 100644 --- a/javatests/google/registry/ui/js/registrar/whois_settings_test.js +++ b/javatests/google/registry/ui/js/registrar/whois_settings_test.js @@ -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); diff --git a/javatests/google/registry/ui/server/registrar/ConsoleUiActionTest.java b/javatests/google/registry/ui/server/registrar/ConsoleUiActionTest.java index a465da75c..57f4e0414 100644 --- a/javatests/google/registry/ui/server/registrar/ConsoleUiActionTest.java +++ b/javatests/google/registry/ui/server/registrar/ConsoleUiActionTest.java @@ -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();