ChangeScreen2: Display a welcome bar to new users

If the user's preferences are for the site default screen, display a
welcome bar in the header with a link to the new screen documentation.
Immediately update the user's preference to be either the old screen,
or the new screen to prevent the bar from displaying again.

For anonymous users save a "gerrit_cs2" cookie for 7 days with the
value of "0" (old screen) or "1" (new screen) when the user clicks
a link to dismiss the welcome bar.

Change-Id: Idc371732bbfa160e47075b8d01bc877a46d1b723
This commit is contained in:
Shawn Pearce
2013-12-07 13:58:17 -08:00
parent d7f80ca621
commit ee772c5252
6 changed files with 188 additions and 1 deletions

View File

@@ -91,10 +91,12 @@ import com.google.gerrit.reviewdb.client.Project;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.Window;
import com.google.gwtorm.client.KeyUtil;
public class Dispatcher {
public static final String COOKIE_CS2 = "gerrit_cs2";
public static boolean changeScreen2;
public static String toPatchSideBySide(final Patch.Key id) {
@@ -551,6 +553,11 @@ public class Dispatcher {
.getGeneralPreferences()
.getChangeScreen();
}
String v = Cookies.getCookie(Dispatcher.COOKIE_CS2);
if (v != null) {
changeScreen2 = "1".equals(v);
return changeScreen2;
}
if (ui == null) {
ui = Gerrit.getConfig().getChangeScreen();
}