[open-ils-commits] [GIT] Evergreen ILS branch master updated. 8d86d3fe1d71797d671a13a9b10a6141936ed94e

Evergreen Git git at git.evergreen-ils.org
Mon Mar 11 17:56:41 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  8d86d3fe1d71797d671a13a9b10a6141936ed94e (commit)
       via  5f166ed1fcbad1f3600965b4172047470aec391d (commit)
      from  cc6235e21c4ddb21671466bac74cd760db0a5b65 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8d86d3fe1d71797d671a13a9b10a6141936ed94e
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Wed Feb 27 09:34:58 2013 -0500

    Tweak Google Book Preview Display, Take 2
    
    After some additional feedback, this commit makes three changes
    to the Google Book preview link:
    
    1) As a solution offered by Dan Scott, rather than move the
    button, we simply scroll to the preview when the button is clicked.
    This effectively makes it impossible to miss. (In the current
    code it sometimes loads off the screen.)
    
    2) Make the viewer display in the same style as other added
    content.
    
    3) Allow the added content header to function as an additional
    toggle to turn the viewer on and off.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/templates/opac/parts/ac_google_books.tt2 b/Open-ILS/src/templates/opac/parts/ac_google_books.tt2
index 8243fe0..3dbb5f9 100644
--- a/Open-ILS/src/templates/opac/parts/ac_google_books.tt2
+++ b/Open-ILS/src/templates/opac/parts/ac_google_books.tt2
@@ -1,5 +1,6 @@
 <script type="text/javascript">
 var GBisbns = Array();
+var GBPreviewShowing = false;
 
 /**
  *
@@ -34,9 +35,11 @@ function GBPreviewCallback(GBPBookInfo) {
     GBPBadge.style.border = 0;
     GBPBadge.style.margin = '0.5em 0 0 0';
     GBPBadgelink = document.createElement('a');
-    GBPBadgelink.href = 'javascript:GBDisplayPreview();';
+    GBPBadgelink.id = 'gbpbadge_link';
+    GBPBadgelink.href = 'javascript:GBDisplayPreview(true);';
     GBPBadgelink.appendChild( GBPBadge );
     dojo.byId('rdetail_title_div').appendChild( GBPBadgelink );
+    unHideMe(dojo.byId('gbp_extra'));
   }
 }
 
@@ -44,7 +47,7 @@ function GBPreviewCallback(GBPBookInfo) {
  *  This is called when the user clicks on the 'Preview' link.  We assume
  *  a preview is available from Google if this link was made visible.
  */
-function GBDisplayPreview() {
+function GBDisplayPreview(scroll_to_div) {
   var GBPreviewPane = document.createElement('div');
   GBPreviewPane.id = 'rdetail_preview_div';
   GBPreviewPane.style.height = '800px';
@@ -52,19 +55,46 @@ function GBDisplayPreview() {
   GBPreviewPane.style.display = 'block';
   var GBClear = document.createElement('div');
   GBClear.style.padding = '1em';
-  dojo.byId('canvas_main').insertBefore(GBPreviewPane, dojo.byId('rdetail_record_details'));
-  dojo.byId('canvas_main').insertBefore(GBClear, dojo.byId('rdetail_record_details'));
+  dojo.byId('gbp_extra_container').appendChild(GBPreviewPane);
+  dojo.byId('gbp_extra_container').appendChild(GBClear);
   if (GBPreviewPane.getAttribute('loaded') == null || GBPreviewPane.getAttribute('loaded') == "false" ) {
      google.load("books", "0", {"callback" : GBPViewerLoadCallback, "language": "[% ctx.locale.substr(0,2) %]"} );
      GBPreviewPane.setAttribute('loaded', 'true');
   }
+  if (scroll_to_div) document.location.hash = '#gbp_extra';
 }
 
 function GBPViewerLoadCallback() {
   var GBPViewer = new google.books.DefaultViewer(dojo.byId('rdetail_preview_div'));
   GBPViewer.load('ISBN:' + GBisbns[0]);
   GBPViewer.resize();
-  dojo.byId('gbpbadge').style.display = 'none';
+  var GBPBadgelink = dojo.byId('gbpbadge_link');
+  GBPBadgelink.href = 'javascript:GBShowHidePreview(true);';
+  dojo.forEach(
+    dojo.byId('gbp_extra_links').getElementsByTagName('a'),
+    function(link) {
+      link.href = 'javascript:GBShowHidePreview();';
+    }
+  );
+  hideMe(dojo.byId('gbp_arrow_link'));
+  unHideMe(dojo.byId('gbp_arrow_down_link'));
+  GBPreviewShowing = true;
+}
+
+function GBShowHidePreview(from_button) {
+  if (!GBPreviewShowing) {
+    dojo.byId('gbp_extra_container').style.display = 'inherit';
+    hideMe(dojo.byId('gbp_arrow_link'));
+    unHideMe(dojo.byId('gbp_arrow_down_link'));
+    GBPreviewShowing = true;
+  } else if (!from_button) { // button can open, but shouldn't close
+    dojo.byId('gbp_extra_container').style.display = 'none';
+    unHideMe(dojo.byId('gbp_arrow_link'));
+    hideMe(dojo.byId('gbp_arrow_down_link'));
+    GBPreviewShowing = false;
+  }
+  // button should always scroll
+  if (from_button) document.location.hash = '#gbp_extra';
 }
 
 dojo.addOnLoad(function() {
diff --git a/Open-ILS/src/templates/opac/parts/record/extras.tt2 b/Open-ILS/src/templates/opac/parts/record/extras.tt2
index 54f36d9..a6100f1 100644
--- a/Open-ILS/src/templates/opac/parts/record/extras.tt2
+++ b/Open-ILS/src/templates/opac/parts/record/extras.tt2
@@ -1,5 +1,24 @@
+[%
+    arrow_img = ctx.media_prefix _ '/images/rdetail_arrow.png';
+    arrow_down_img = ctx.media_prefix _ '/images/rdetail_arrow_down.png';
+%]
 <div>
     <div id='rdetail_extras_div' style='width: 100%;'> 
+        [%
+            IF ctx.google_books_preview;
+                label = l('Google Preview');
+                name = 'google_preview';
+                href = 'javascript:GBDisplayPreview();';
+        %]
+        <div id="gbp_extra" class="rdetail_extras hide_me">
+            <div class="rdetail_extras_hr"></div>
+            <div id="gbp_extra_links" class="rdetail_extras_link">
+                <a id='gbp_arrow_link' name='[% name %]' href='[% href %]'><img alt='[% label %]' src='[% arrow_img %]'/></a>
+                <a id='gbp_arrow_down_link' name='[% name %]' href='[% href %]' class='hide_me'><img alt='[% label %]' src='[% arrow_down_img %]'/></a>
+                <a name='[% name %]_lbl' href='[% href %]' class="rdetail_extras_lbl">[% label %]</a></div>
+        </div>
+        <div id="gbp_extra_container" class='rdetail_extras_div'></div>
+        [%  END %]
 
         [%  # Hidden extras are not yet implemented.  Some may require JS
 
@@ -56,14 +75,14 @@
                 [%  
                     IF tab_is_active(name);
                         href = mkurl('', {}, ['expand', 'ac']);
-                        img_url = ctx.media_prefix _ '/images/rdetail_arrow_down.png';
+                        img_url = arrow_down_img;
                     ELSE;
                         IF name == 'addedcontent' AND default_ac;
                             href = mkurl('', {expand => name, ac => default_ac}) _ '#' _ name; 
                         ELSE;
                             href = mkurl('', {expand => name}) _ '#' _ name; 
                         END;
-                        img_url = ctx.media_prefix _ '/images/rdetail_arrow.png';
+                        img_url = arrow_img;
                     END;
                 %]
                 <a name='[% name %]' href='[% href %]'><img alt='[% extra.label %]' src='[% img_url %]'/></a>

commit 5f166ed1fcbad1f3600965b4172047470aec391d
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Wed Feb 27 09:24:33 2013 -0500

    Make Google Books Preview Honor Setting
    
    The new Google Book Preview was loading even if the setting was
    off, provided some other 'want_dojo' feature was loaded. This
    change will honor the setting regardless.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/templates/opac/parts/js.tt2 b/Open-ILS/src/templates/opac/parts/js.tt2
index 07dfa9a..2302e59 100644
--- a/Open-ILS/src/templates/opac/parts/js.tt2
+++ b/Open-ILS/src/templates/opac/parts/js.tt2
@@ -81,6 +81,6 @@
 [% END; # use_autosuggest %]
 
 [% INCLUDE "opac/parts/acjs.tt2" IF ctx.page == 'record' %]
-[% INCLUDE "opac/parts/ac_google_books.tt2" IF ctx.page == 'record' %]
+[% INCLUDE "opac/parts/ac_google_books.tt2" IF ctx.page == 'record' AND ctx.google_books_preview %]
 
 [%- END; # want_dojo -%]

-----------------------------------------------------------------------

Summary of changes:
 .../src/templates/opac/parts/ac_google_books.tt2   |   40 +++++++++++++++++--
 Open-ILS/src/templates/opac/parts/js.tt2           |    2 +-
 .../src/templates/opac/parts/record/extras.tt2     |   23 ++++++++++-
 3 files changed, 57 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list