Reviewers: ihab.awad,
Description:
Adds the +1 button to the playground
Please review this at http://codereview.appspot.com/4612042/
Affected files:
M src/com/google/caja/demos/playground/Playground.html
M src/com/google/caja/demos/playground/client/ui/PlaygroundUI.ui.xml
M src/com/google/caja/demos/playground/client/ui/PlaygroundView.java
Index: src/com/google/caja/demos/playground/Playground.html
===================================================================
--- src/com/google/caja/demos/playground/Playground.html (revision 4501)
+++ src/com/google/caja/demos/playground/Playground.html (working copy)
@@ -29,6 +29,8 @@
<title>Caja Playground</title>
<link href="Playground.css" type="text/css" rel="stylesheet" />
<link href="prettify.css" type="text/css" rel="stylesheet" />
+ <script type="text/javascript"
src="https://apis.google.com/js/plusone.js">
+ </script>
</head>
<body>
<script type="text/javascript" src="caja.js"></script>
Index: src/com/google/caja/demos/playground/client/ui/PlaygroundView.java
===================================================================
--- src/com/google/caja/demos/playground/client/ui/PlaygroundView.java
(revision 4501)
+++ src/com/google/caja/demos/playground/client/ui/PlaygroundView.java
(working copy)
@@ -248,6 +248,14 @@
setupNativeSelectLineBridge();
selectTab(Tabs.SOURCE);
}
+
+ private native void initPlusOne() /*-{
+ try {
+ $wnd.gapi.plusone.render("plusone",{size: "medium"});
+ } catch (e) {
+ // failure to initialize +1 button should not prevent load of page
+ }
+ }-*/;
private static TreeItem addExampleItem(Map<Example.Type, TreeItem> menu,
Example eg) {
@@ -306,6 +314,7 @@
initFeedbackPanel();
initExamples();
initEditor();
+ initPlusOne();
}
public void setOriginalSource(String result) {
Index: src/com/google/caja/demos/playground/client/ui/PlaygroundUI.ui.xml
===================================================================
--- src/com/google/caja/demos/playground/client/ui/PlaygroundUI.ui.xml
(revision 4501)
+++ src/com/google/caja/demos/playground/client/ui/PlaygroundUI.ui.xml
(working copy)
@@ -6,12 +6,12 @@
type='com.google.caja.demos.playground.client.PlaygroundResource' />
<ui:style>
- body { font-family: arial,sans-serif,helvetica }
- .playgroundUI { background: #92C1F0; }
+ body { font-family: arial,sans-serif,helvetica }
+ .playgroundUI { background: #92C1F0; }
- .pginfo { font-weight: bold; font-size: 120% }
- .loadingLabel { display: hidden; }
- .menuItems { margin: 5px; }
+ .pginfo { font-weight: bold; font-size: 120% }
+ .loadingLabel { display: hidden; }
+ .menuItems { margin: 5px; }
</ui:style>
<g:DockLayoutPanel>
<g:north size="80">
@@ -22,18 +22,25 @@
</g:HorizontalPanel>
<!-- Logo Panel -->
- <g:HorizontalPanel>
- <g:Image resource="{res.logo}"></g:Image>
+ <g:HorizontalPanel width="100%" >
+ <g:cell width="155" height="55">
+ <g:Image resource="{res.logo}"></g:Image>
+ </g:cell>
<g:VerticalPanel styleName="{style.pginfo}">
<g:Label>Caja Playground</g:Label>
<g:Label ui:field="version">Unknown</g:Label>
</g:VerticalPanel>
-
<g:HorizontalPanel ui:field="loadingLabel"
styleName="{style.loadingLabel}" >
<g:Label text="Loading..."></g:Label>
<g:Image resource="{res.loading}"></g:Image>
</g:HorizontalPanel>
+ <g:cell
+ horizontalAlignment="ALIGN_RIGHT"
verticalAlignment="ALIGN_MIDDLE">
+ <g:HTML>
+ <div id="plusone"></div>
+ </g:HTML>
+ </g:cell>
</g:HorizontalPanel>
</g:VerticalPanel>