Render per-project themes on the client side
Always include the relevant <style>/<div> tags in the host page, even if they are empty. Have Gerrit store the sitewide values, and swap them in and out when loading project-specific screens. Change-Id: Iab6d2c91bf636ef361e2031dd39904e0c7e9bf41
This commit is contained in:
@@ -371,44 +371,39 @@ public abstract class PatchScreen extends Screen implements
|
||||
fileList.movePointerTo(patchKey);
|
||||
}
|
||||
|
||||
com.google.gwtjsonrpc.common.AsyncCallback<PatchScript> pscb =
|
||||
new ScreenLoadCallback<PatchScript>(this) {
|
||||
CallbackGroup cb = new CallbackGroup();
|
||||
ConfigInfoCache.get(patchSetDetail.getProject(),
|
||||
cb.add(new AsyncCallback<ConfigInfoCache.Entry>() {
|
||||
@Override
|
||||
protected void preDisplay(final PatchScript result) {
|
||||
if (rpcSequence == rpcseq) {
|
||||
onResult(result, isFirst);
|
||||
}
|
||||
public void onSuccess(ConfigInfoCache.Entry result) {
|
||||
commentLinkProcessor = result.getCommentLinkProcessor();
|
||||
contentTable.setCommentLinkProcessor(commentLinkProcessor);
|
||||
setTheme(result.getTheme());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(final Throwable caught) {
|
||||
if (rpcSequence == rpcseq) {
|
||||
settingsPanel.setEnabled(true);
|
||||
super.onFailure(caught);
|
||||
}
|
||||
public void onFailure(Throwable caught) {
|
||||
// Handled by ScreenLoadCallback.onFailure.
|
||||
}
|
||||
};
|
||||
if (commentLinkProcessor == null) {
|
||||
// Fetch config in parallel if we haven't previously.
|
||||
CallbackGroup cb = new CallbackGroup();
|
||||
ConfigInfoCache.get(patchSetDetail.getProject(),
|
||||
cb.add(new AsyncCallback<ConfigInfoCache.Entry>() {
|
||||
@Override
|
||||
public void onSuccess(ConfigInfoCache.Entry result) {
|
||||
commentLinkProcessor = result.getCommentLinkProcessor();
|
||||
contentTable.setCommentLinkProcessor(commentLinkProcessor);
|
||||
}
|
||||
}));
|
||||
PatchUtil.DETAIL_SVC.patchScript(patchKey, idSideA, idSideB,
|
||||
settingsPanel.getValue(), cb.addGwtjsonrpc(
|
||||
new ScreenLoadCallback<PatchScript>(this) {
|
||||
@Override
|
||||
protected void preDisplay(final PatchScript result) {
|
||||
if (rpcSequence == rpcseq) {
|
||||
onResult(result, isFirst);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// Handled by ScreenLoadCallback.onFailure.
|
||||
}
|
||||
}));
|
||||
pscb = cb.addGwtjsonrpc(pscb);
|
||||
}
|
||||
|
||||
PatchUtil.DETAIL_SVC.patchScript(patchKey, idSideA, idSideB, //
|
||||
settingsPanel.getValue(), pscb);
|
||||
@Override
|
||||
public void onFailure(final Throwable caught) {
|
||||
if (rpcSequence == rpcseq) {
|
||||
settingsPanel.setEnabled(true);
|
||||
super.onFailure(caught);
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private void onResult(final PatchScript script, final boolean isFirst) {
|
||||
|
Reference in New Issue
Block a user