Add intro page after first admin login into Gerrit
Give some initial help and the most noteworthy links to the first-time
admin user after its very first login into Gerrit Code Review UX.
Change-Id: Ia0e755b8b392f1fbad5a3a800c874be27078784c
diff --git a/src/main/java/com/googlesource/gerrit/plugins/manager/FirstWebLoginListener.java b/src/main/java/com/googlesource/gerrit/plugins/manager/FirstWebLoginListener.java
index 85dbdd2..00f2ace 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/manager/FirstWebLoginListener.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/manager/FirstWebLoginListener.java
@@ -53,7 +53,7 @@
Path firstLoginFile =
pluginData.resolve("firstLogin." + user.getAccountId().get());
if (!firstLoginFile.toFile().exists()) {
- response.sendRedirect(pluginUrl + "static/index.html");
+ response.sendRedirect(pluginUrl + "static/intro.html");
Files.write(firstLoginFile, new Date().toString().getBytes(),
StandardOpenOption.CREATE);
diff --git a/src/main/resources/static/css/ie10-viewport-bug-workaround.css b/src/main/resources/static/css/ie10-viewport-bug-workaround.css
new file mode 100644
index 0000000..4b9518e
--- /dev/null
+++ b/src/main/resources/static/css/ie10-viewport-bug-workaround.css
@@ -0,0 +1,13 @@
+/*!
+ * IE10 viewport hack for Surface/desktop Windows 8 bug
+ * Copyright 2014-2015 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+
+/*
+ * See the Getting Started docs for more information:
+ * http://getbootstrap.com/getting-started/#support-ie10-width
+ */
+@-ms-viewport { width: device-width; }
+@-o-viewport { width: device-width; }
+@viewport { width: device-width; }
diff --git a/src/main/resources/static/css/jumbotron.css b/src/main/resources/static/css/jumbotron.css
new file mode 100644
index 0000000..179d408
--- /dev/null
+++ b/src/main/resources/static/css/jumbotron.css
@@ -0,0 +1,5 @@
+/* Move down content because we have a fixed navbar that is 50px tall */
+body {
+ padding-top: 50px;
+ padding-bottom: 20px;
+}
diff --git a/src/main/resources/static/intro.html b/src/main/resources/static/intro.html
new file mode 100644
index 0000000..2b1d215
--- /dev/null
+++ b/src/main/resources/static/intro.html
@@ -0,0 +1,146 @@
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
+<meta name="description" content="Gerrit Plugin Manager">
+<meta name="author" content="Gerrit Code Review">
+<link rel="icon" href="/favicon.ico">
+
+<title>Gerrit Plugin Manager - Introduction</title>
+
+<!-- Bootstrap core CSS -->
+<link
+ href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"
+ rel="stylesheet"
+ integrity="sha256-MfvZlkHCEqatNoGiOXveE8FIwMzZg4W85qfrfIFBfYc= sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ=="
+ crossorigin="anonymous">
+<link href="css/style.css" rel="stylesheet">
+
+<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
+<link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
+
+<!-- Custom styles for this template -->
+<link href="css/jumbotron.css" rel="stylesheet">
+
+<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
+<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
+<script src="js/ie-emulation-modes-warning.js"></script>
+
+<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
+<!--[if lt IE 9]>
+ <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
+ <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
+ <![endif]-->
+</head>
+
+<body>
+
+ <nav class="navbar navbar-inverse navbar-fixed-top">
+ <div class="container">
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle collapsed"
+ data-toggle="collapse" data-target="#navbar"
+ aria-expanded="false" aria-controls="navbar">
+ <span class="sr-only">Toggle navigation</span> <span
+ class="icon-bar"></span> <span class="icon-bar"></span> <span
+ class="icon-bar"></span>
+ </button>
+ <a class="navbar-brand" href="../../../">» Skip intro</a>
+ </div>
+ </div>
+ </nav>
+
+ <!-- Main jumbotron for a primary marketing message or call to action -->
+ <div class="jumbotron">
+ <div class="container">
+ <h1>Welcome!</h1>
+ <p><b><a href="https://www.gerritcodereview.com" target="_blank">Gerrit Code Review</a></b> provides web-based code review and repository
+ management for the Git version control system.</p>
+ <p>
+ Before starting using it, you may want to consider <strong>installing
+ some extra plugins</strong> to extend its functionality, including <i>replication
+ to remote locations</i>, integration with <i>Atlassian Jira</i>
+ and other issue trackers workflow, <i>OAuth 2.0
+ authentication</i> with external providers such as <i>Google
+ Account</i>, <i>GitHub</i> and <i>GitLab</i> and many others.
+ </p>
+ <p>
+ <p>
+ Once you're done with your plugins selection, click on the
+ top-right <strong>"> Go to Gerrit"</strong> link on the
+ top-right corner to access the Gerrit Code Review main screen.
+ </p>
+ <a class="btn btn-primary btn-lg" href="index.html" role="button">Install
+ plugins »</a>
+ </p>
+ </div>
+ </div>
+
+ <div class="container">
+ <!-- Example row of columns -->
+ <div class="row">
+ <div class="col-md-4">
+ <h2><span class="glyphicon glyphicon-film" aria-hidden="true"></span> Learn more</h2>
+ <p>Before starting using Gerrit Code Review, you may want to
+ spend a few minutes learning the basic concepts and how its
+ workflow works.</p>
+ <p>Get information from the source, with an introduction
+ video starring Shawn Pearce, the Gerrit Code Review project
+ founder, at the EclipseCon 2013.</p>
+ <p>
+ <a class="btn btn-default"
+ href="https://www.youtube.com/watch?v=Wxx8XndqZ7A&t=15s"
+ target="_blank" role="button">Watch Video »</a>
+ </p>
+ </div>
+ <div class="col-md-4">
+ <h2><span class="glyphicon glyphicon-envelope" aria-hidden="true"></span> Get involved</h2>
+ <p>Gerrit Code Review is backed by a thriving Community of
+ users and contributors. The main channel to get in touch is
+ through the "repo-discuss" mailing list.</p>
+ <p>Join the discussions and feel free to ask questions.
+ Share your thoughts on how to improve Gerrit workflow and user
+ experience.
+ <p>
+ <a class="btn btn-default"
+ href="https://groups.google.com/forum/#!forum/repo-discuss"
+ target="_blank" role="button">Repo-discuss mailing list
+ »</a>
+ </p>
+ </div>
+ <div class="col-md-4">
+ <h2><span class="glyphicon glyphicon-thumbs-up" aria-hidden="true"></span> Keep in touch</h2>
+ <p>
+ Get the latest news about Gerrit Code Review releases and
+ events by following the official social network channels of
+ the project, including <a
+ href="https://plus.google.com/communities/111271594706618791655"
+ target="_blank">Google+</a> and <a
+ href="https://twitter.com/gerritreview">Twitter</a>.
+ </p>
+ <p>Follow Gerrit and tweet about your experience to share
+ your thoughts and achievements with your daily code reviews.
+ <p>
+ <a href="https://twitter.com/gerritreview"
+ class="twitter-follow-button" data-show-count="false">Follow
+ @gerritreview</a>
+ <script async src="//platform.twitter.com/widgets.js"
+ charset="utf-8"></script>
+ </p>
+ </div>
+ </div>
+
+ <hr>
+
+ <footer>
+ <p><a href="https://www.gerritcodereview.com" href="_blank">Gerrit Code Review</a> - Copyright © 2017 The Android Open Source Project -
+ Licensed under the Apache License, Version 2.0.</p>
+ </footer>
+ </div>
+ <!-- /container -->
+</body>
+</html>
diff --git a/src/main/resources/static/js/ie-emulation-modes-warning.js b/src/main/resources/static/js/ie-emulation-modes-warning.js
new file mode 100644
index 0000000..3f97ba5
--- /dev/null
+++ b/src/main/resources/static/js/ie-emulation-modes-warning.js
@@ -0,0 +1,51 @@
+// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
+// IT'S JUST JUNK FOR OUR DOCS!
+// ++++++++++++++++++++++++++++++++++++++++++
+/*!
+ * Copyright 2014-2015 Twitter, Inc.
+ *
+ * Licensed under the Creative Commons Attribution 3.0 Unported License. For
+ * details, see https://creativecommons.org/licenses/by/3.0/.
+ */
+// Intended to prevent false-positive bug reports about Bootstrap not working properly in old versions of IE due to folks testing using IE's unreliable emulation modes.
+(function () {
+ 'use strict';
+
+ function emulatedIEMajorVersion() {
+ var groups = /MSIE ([0-9.]+)/.exec(window.navigator.userAgent)
+ if (groups === null) {
+ return null
+ }
+ var ieVersionNum = parseInt(groups[1], 10)
+ var ieMajorVersion = Math.floor(ieVersionNum)
+ return ieMajorVersion
+ }
+
+ function actualNonEmulatedIEMajorVersion() {
+ // Detects the actual version of IE in use, even if it's in an older-IE emulation mode.
+ // IE JavaScript conditional compilation docs: https://msdn.microsoft.com/library/121hztk3%28v=vs.94%29.aspx
+ // @cc_on docs: https://msdn.microsoft.com/library/8ka90k2e%28v=vs.94%29.aspx
+ var jscriptVersion = new Function('/*@cc_on return @_jscript_version; @*/')() // jshint ignore:line
+ if (jscriptVersion === undefined) {
+ return 11 // IE11+ not in emulation mode
+ }
+ if (jscriptVersion < 9) {
+ return 8 // IE8 (or lower; haven't tested on IE<8)
+ }
+ return jscriptVersion // IE9 or IE10 in any mode, or IE11 in non-IE11 mode
+ }
+
+ var ua = window.navigator.userAgent
+ if (ua.indexOf('Opera') > -1 || ua.indexOf('Presto') > -1) {
+ return // Opera, which might pretend to be IE
+ }
+ var emulated = emulatedIEMajorVersion()
+ if (emulated === null) {
+ return // Not IE
+ }
+ var nonEmulated = actualNonEmulatedIEMajorVersion()
+
+ if (emulated !== nonEmulated) {
+ window.alert('WARNING: You appear to be using IE' + nonEmulated + ' in IE' + emulated + ' emulation mode.\nIE emulation modes can behave significantly differently from ACTUAL older versions of IE.\nPLEASE DON\'T FILE BOOTSTRAP BUGS based on testing in IE emulation modes!')
+ }
+})();