Skip to content
Snippets Groups Projects
Commit 6f0e5434 authored by Demian Katz's avatar Demian Katz
Browse files

Restored visibility of preview tab.

parent 7b92b161
Branches
Tags
No related merge requests found
......@@ -766,7 +766,7 @@ url = "https://api.vlb.de/api/v1/cover/"
; Tab makes a tab with an embedded preview appear on record view
; Default is "GoogleOptions['link'] = full,partial" if nothing
; is set here.
; see code.google.com/apis/books/docs/dynamic-links.html#JSONformat
; see https://developers.google.com/books/docs/dynamic-links#json-results-format
;GoogleOptions['link'] = full,partial
;GoogleOptions['tab'] = partial
......
......@@ -195,19 +195,14 @@ class Factory
// and googleoptions[tab] is not empty.
$active = false;
if (isset($cfg->Content->previews)) {
$content_previews = explode(
',', strtolower(str_replace(' ', '', $cfg->Content->previews))
$previews = array_map(
'trim', explode(',', strtolower($cfg->Content->previews))
);
if (in_array('google', $content_previews)
&& isset($cfg->Content->GoogleOptions)
if (in_array('google', $previews)
&& isset($cfg->Content->GoogleOptions['tab'])
&& strlen(trim($cfg->Content->GoogleOptions['tab'])) > 0
) {
$g_options = $cfg->Content->GoogleOptions;
if (isset($g_options->tab)) {
$tabs = explode(',', $g_options->tab);
if (count($tabs) > 0) {
$active = true;
}
}
$active = true;
}
}
return new Preview($active);
......
......@@ -93,4 +93,15 @@ class Preview extends AbstractBase
// until there is content
return false;
}
/**
* Can this tab be loaded via AJAX?
*
* @return bool
*/
public function supportsAjax()
{
// No, Google script magic required
return false;
}
}
......@@ -68,7 +68,7 @@ function processGBSBookInfo(booksInfo) {
if (viewOptions['tab'].indexOf(bookInfo.preview)>= 0
&& (bookInfo.embeddable)) {
// make tab visible
$('ul.recordTabs li.hidden a#preview').parent().removeClass('hidden');
$('ul.nav-tabs li.hidden a.preview').parent().removeClass('hidden');
}
}
}
......
......@@ -6,4 +6,4 @@
$this->headScript()->appendFile('https://www.google.com/jsapi');
$this->headScript()->appendFile('embedGBS.js');
?>
<div id="gbsViewer" ></div>
<div id="gbsViewer" style="height: 600px;"></div>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment