Revision: 4502
Author:   jasvir
Date:     Tue Jun 14 14:37:34 2011
Log:      Adds the +1 button to the playground
http://codereview.appspot.com/4612042

Adds the +1 button to the playground

[email protected]

http://code.google.com/p/google-caja/source/detail?r=4502

Modified:
 /trunk/src/com/google/caja/demos/playground/Playground.html
 /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundUI.ui.xml
 /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java

=======================================
--- /trunk/src/com/google/caja/demos/playground/Playground.html Thu May 26 10:52:29 2011 +++ /trunk/src/com/google/caja/demos/playground/Playground.html Tue Jun 14 14:37:34 2011
@@ -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>
=======================================
--- /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundUI.ui.xml Wed May 18 10:18:54 2011 +++ /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundUI.ui.xml Tue Jun 14 14:37:34 2011
@@ -6,12 +6,12 @@
       type='com.google.caja.demos.playground.client.PlaygroundResource' />

   <ui:style>
-       body { font-family: arial,sans-serif,helvetica }
-         .playgroundUI { background: #92C1F0; }
-
-               .pginfo { font-weight: bold; font-size: 120% }
-       .loadingLabel { display: hidden; }
-       .menuItems { margin: 5px;       }
+    body { font-family: arial,sans-serif,helvetica }
+    .playgroundUI { background: #92C1F0; }
+
+    .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>

=======================================
--- /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java Wed Jun 8 10:04:54 2011 +++ /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java Tue Jun 14 14:37:34 2011
@@ -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) {

Reply via email to