Make registrar console logo non-Google-Registry-specific

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134691115
This commit is contained in:
mcilwain 2016-09-29 12:08:34 -07:00 committed by Ben McIlwain
parent f86c7c161c
commit bf75c4ca48
16 changed files with 70 additions and 23 deletions

View file

@ -81,6 +81,34 @@ public final class ConfigModule {
return config.getProjectId();
}
/** The filename of the logo to be displayed in the header of the registrar console. */
@Provides
@Config("logoFilename")
public static String provideLogoFilename(RegistryEnvironment environment) {
switch (environment) {
case UNITTEST:
case LOCAL:
return "logo.png";
default:
// Change this to the filename of your logo.
return "google_registry.png";
}
}
/** The product name of this specific registry. Used throughout the registrar console. */
@Provides
@Config("productName")
public static String provideProductName(RegistryEnvironment environment) {
switch (environment) {
case UNITTEST:
case LOCAL:
return "Domain Registry";
default:
// Change this to the name of your product.
return "Google Registry";
}
}
/** @see RegistryConfig#getZoneFilesBucket() */
@Provides
@Config("zoneFilesBucket")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -129,7 +129,7 @@ input#kd-searchfield {
/* Logo */
a.logo {
vertical-align: top;
vertical-align: middle;
font-size: 30px;
font-weight: 300;
font-family: "open sans", sans-serif;
@ -137,12 +137,7 @@ a.logo {
}
a.logo * {
vertical-align: top;
}
a.logo img {
/* Get the baseline of "Google" and "Registry" to line up. */
margin-top: 1px;
vertical-align: middle;
}
/* Reg prefix. */

View file

@ -58,6 +58,8 @@ public final class ConsoleUiAction implements Runnable {
@Inject Response response;
@Inject SessionUtils sessionUtils;
@Inject UserService userService;
@Inject @Config("logoFilename") String logoFilename;
@Inject @Config("productName") String productName;
@Inject @Config("registrarConsoleEnabled") boolean enabled;
@Inject ConsoleUiAction() {}
@ -66,19 +68,22 @@ public final class ConsoleUiAction implements Runnable {
response.setContentType(MediaType.HTML_UTF_8);
response.setHeader(X_FRAME_OPTIONS, "SAMEORIGIN"); // Disallow iframing.
response.setHeader("X-Ui-Compatible", "IE=edge"); // Ask IE not to be silly.
SoyMapData data = new SoyMapData();
data.put("logoFilename", logoFilename);
data.put("productName", productName);
if (!enabled) {
response.setStatus(SC_SERVICE_UNAVAILABLE);
response.setPayload(
TOFU_SUPPLIER.get()
.newRenderer(ConsoleSoyInfo.DISABLED)
.setCssRenamingMap(CSS_RENAMING_MAP_SUPPLIER.get())
.setData(data)
.render());
return;
}
if (!sessionUtils.checkRegistrarConsoleLogin(req)) {
SoyMapData data = new SoyMapData();
data.put("username", userService.getCurrentUser().getNickname());
data.put("logoutUrl", userService.createLogoutURL(PATH));
if (!sessionUtils.checkRegistrarConsoleLogin(req)) {
response.setStatus(SC_FORBIDDEN);
response.setPayload(
TOFU_SUPPLIER.get()
@ -89,12 +94,9 @@ public final class ConsoleUiAction implements Runnable {
return;
}
Registrar registrar = Registrar.loadByClientId(sessionUtils.getRegistrarClientId(req));
SoyMapData data = new SoyMapData();
data.put("xsrfToken", XsrfTokenManager.generateToken(EppConsoleAction.XSRF_SCOPE));
data.put("clientId", registrar.getClientId());
data.put("username", userService.getCurrentUser().getNickname());
data.put("isAdmin", userService.isUserAdmin());
data.put("logoutUrl", userService.createLogoutURL(PATH));
data.put("showPaymentLink", registrar.getBillingMethod() == Registrar.BillingMethod.BRAINTREE);
response.setPayload(
TOFU_SUPPLIER.get()

View file

@ -70,9 +70,11 @@
{template .googlebar}
{@param username: string}
{@param logoutUrl: string}
{@param logoFilename: string}
{@param productName: string}
<div id="kd-googlebar" role="banner">
<a class="{css logo}" href="/registrar">
<img src="/assets/images/glogo_black.png" alt="Google">Registry
<img src="/assets/images/{$logoFilename}" alt="{$productName}">
</a>
<div id="kd-search">
<input id="kd-searchfield"

View file

@ -98,13 +98,15 @@
* Feature disabled
*/
{template .disabled}
{@param logoFilename: string}
{@param productName: string}
{call registry.soy.console.header}
{param app: 'registrar' /}
{param subtitle: 'Console Disabled' /}
{/call}
<div class="{css whoAreYou-disabled}">
<a class="{css logo}" href="/registrar">
<img src="/assets/images/glogo_black.png" alt="Google">Registry
<img src="/assets/images/{$logoFilename}" alt="{$productName}">
</a>
<h1>Console is disabled</h1>
<p>
@ -122,13 +124,15 @@
{template .whoareyou}
{@param username: string} /** Arbitrary username to display. */
{@param logoutUrl: string} /** Generated URL for logging out of Google. */
{@param logoFilename: string}
{@param productName: string}
{call registry.soy.console.header}
{param app: 'registrar' /}
{param subtitle: 'Please Login' /}
{/call}
<div class="{css whoAreYou}">
<a class="{css logo}" href="/registrar">
<img src="/assets/images/glogo_black.png" alt="Google">Registry
<img src="/assets/images/{$logoFilename}" alt="{$productName}">
</a>
<h1>You need permission</h1>
<p>

View file

@ -51,7 +51,9 @@ function setUp() {
logoutUrl: 'omg',
isAdmin: true,
clientId: test.testClientId,
showPaymentLink: false
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Domain Registry'
});
registry.registrar.ConsoleTestUtil.setup(test);
var regNavlist = $('reg-navlist');

View file

@ -50,7 +50,9 @@ function setUp() {
logoutUrl: 'omg',
isAdmin: true,
clientId: test.testClientId,
showPaymentLink: false
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Domain Registry'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
registry.registrar.ConsoleTestUtil.setup(test);

View file

@ -41,7 +41,9 @@ function setUp() {
logoutUrl: 'omg',
isAdmin: true,
clientId: 'daddy',
showPaymentLink: false
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Domain Registry'
});
registry.registrar.ConsoleTestUtil.setup(test);
}

View file

@ -47,7 +47,9 @@ function setUp() {
logoutUrl: 'https://justinetunney.com',
isAdmin: true,
clientId: 'ignore',
showPaymentLink: false
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Domain Registry'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);

View file

@ -47,7 +47,9 @@ function setUp() {
logoutUrl: 'https://example.com',
isAdmin: true,
clientId: 'ignore',
showPaymentLink: false
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Domain Registry'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);

View file

@ -55,7 +55,9 @@ function setUp() {
isAdmin: true,
xsrfToken: test.testXsrfToken,
clientId: test.testClientId,
showPaymentLink: false
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Domain Registry'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
registry.registrar.ConsoleTestUtil.setup(test);

View file

@ -49,7 +49,9 @@ function setUp() {
logoutUrl: 'omg',
isAdmin: true,
clientId: test.testClientId,
showPaymentLink: false
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Domain Registry'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
registry.registrar.ConsoleTestUtil.setup(test);

View file

@ -50,6 +50,8 @@ public class ConsoleUiActionTest {
@Before
public void setUp() throws Exception {
action.enabled = true;
action.logoFilename = "logo.png";
action.productName = "Domain Registry";
action.response = response;
action.sessionUtils = sessionUtils;
action.userService = UserServiceFactory.getUserService();