Skip to content

Commit

Permalink
Merge pull request #89 from NYULibraries/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
ekate authored Dec 12, 2018
2 parents a63369a + 1400bda commit f9a2946
Show file tree
Hide file tree
Showing 11 changed files with 162 additions and 154 deletions.
12 changes: 10 additions & 2 deletions inc/types/book.inc
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,18 @@ function dlts_viewer_full_book_view(&$entity) {
}

function dlts_viewer_book_metadata_view($entity) {
$element = node_view($entity, 'metadata');
$element = node_view($entity, 'metadata',$entity->language);
return drupal_render($element);
}

function dlts_viewer_process_node_dlts_book(&$vars) {
$args = arg();
$count = count($args);
if ($count === 3 && $args[2] == 'display') {
$vars['theme_hook_suggestions'][] = 'node__display';
}
}

function dlts_viewer_pjax_book_view(&$entity) {
$vars = array(
'button_next' => $entity->button_next,
Expand Down Expand Up @@ -128,7 +136,7 @@ function _language_field(&$entity) {
$entity->lang_name = isset($languages[$entity->language]->name) ? $languages[$entity->language]->name : 'English';
$translations = translation_path_get_translations('node/' . $entity->nid);
if (count($translations) > 1) {
$entity->lang_options = array('#type' => 'markup', '#prefix' => '<select class="language">', '#suffix' => '</select>', '#markup' => '');
$entity->lang_options = array('#type' => 'markup', '#prefix' => '<select class="language" aria-label="Choose Language for Metadata">', '#suffix' => '</select>', '#markup' => '');
foreach ($translations as $key => $index) {
$url = url('books/' . $entity->identifier . '/display', array('absolute' => true, 'query' => array('lang' => $key)));
$markup = array(
Expand Down
2 changes: 1 addition & 1 deletion js/modules/slider-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ YUI.add('slider-base', function(Y, NAME) {
* @type {String}
* @default &lt;span class="{thumbClass}" tabindex="-1">&lt;img src="{thumbShadowUrl}" alt="Slider thumb shadow" class="{thumbShadowClass}">&lt;img src="{thumbImageUrl}" alt="Slider thumb" class="{thumbImageClass}">&lt;/span>
*/
THUMB_TEMPLATE : '<span class="{thumbClass}" aria-labelledby="{thumbAriaLabelId}" aria-valuetext="" aria-valuemax="" aria-valuemin="" aria-valuenow="" role="slider" tabindex="0">' + // keyboard access jeff tabindex="-1"
THUMB_TEMPLATE : '<span aria-hidden="true" class="{thumbClass}" aria-valuetext="" aria-valuemax="" aria-valuemin="" aria-valuenow="" role="slider" tabindex="0">' + // keyboard access jeff tabindex="-1"
'<img src="{thumbShadowUrl}" ' + 'alt="Slider thumb shadow" ' + 'class="{thumbShadowClass}">' + '<img src="{thumbImageUrl}" ' + 'alt="Slider thumb" ' + 'class="{thumbImageClass}">' + '</span>'

}, {
Expand Down
26 changes: 16 additions & 10 deletions js/ui.components.yui.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,23 @@ YUI().use(
}
Y.fire(event_prefix + ':toggle', e);
}

/** TODO: I don't like this, find a more elegant solution */
function pager_form(e) {
e.preventDefault();
var value = this.get('value');
var current = parseInt(book.sequence_number, 10);
var olMap = Y.one('.olMap');
var olMapData = olMap.getData();
var current = parseInt(olMapData.sequence, 10);
var css_class;
if (value.match(/\D/)) {
css_class = 'error';
}
else {
value = parseInt(value, 10);
if (value !== current &&(value > 0 && value <= sequenceCount )) {
if (value !== current && (value > 0 && value <= sequenceCount)) {
css_class = 'ok';
Y.one('.current_page').set('text', value);
pjax.navigate(bookUrl + '/' + value);
}
else {
Expand Down Expand Up @@ -161,6 +165,7 @@ YUI().use(
var data = map.getData();
var request = bookUrl + '/' + e.target.getValue() + '?page_view=' + data.pageview;
if (!Y.Lang.isValue(slider.triggerBy)) {
Y.one('.current_page').set('text', e.target.getValue());
pjax.navigate(request);
/** slider set focus to the slider rail, blur as soon as possible so that user can use the keyboard to read the book */
Y.soon(function() {
Expand All @@ -174,6 +179,7 @@ YUI().use(
}

function pjax_navigate(e) {
Y.one('body').addClass('openlayers-loading');
var msg = e.url.replace(bookUrl, '' ).replace('/' , '');
if (/(^[\d]+$){1}/.test(msg ) || /(^[\d]+-[\d]+$){1}/.test(msg)) {
this.one('.current_page').set('text', msg);
Expand Down Expand Up @@ -336,11 +342,8 @@ YUI().use(
imgMetadata: config.metadata
});
Y.on('contentready', function() {
Y.CrossFrame.postMessage("parent", JSON.stringify({fire: 'openlayers:change', data: config }));
Y.fire('openlayers:change', config);
Y.later(1000, Y.one('.pane.load'), function() {
this.hide();
});
Y.CrossFrame.postMessage("parent", JSON.stringify({fire: 'openlayers:change', data: config }));
Y.fire('openlayers:change', config);
}, '#' + config.id);
}

Expand All @@ -357,8 +360,8 @@ YUI().use(
}

function openLayersTilesLoading() {
if (Y.one('body').hasClass('openlayers-loading' )) {
Y.later(500, Y.one('.pane.load'), openLayersTilesLoading);
if (Y.one('body').hasClass('openlayers-loading')) {
Y.later(200, Y.one('.pane.load'), openLayersTilesLoading);
}
else {
Y.one('.pane.load').hide();
Expand Down Expand Up @@ -570,7 +573,10 @@ YUI().use(
var displayData = display.getData();
Y.CrossFrame.postMessage('parent', JSON.stringify({ fire: 'display:load', data: displayData}));
}

function resizeSlider() {
slider.set('length' ,(Y.one('#pager').get('offsetWidth') - 120 ));
}
Y.on('windowresize', resizeSlider);
Y.once('contentready', onDisplayContentReady, '#display');

});
243 changes: 120 additions & 123 deletions js/ui.keyboard.yui.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions js/ui.map.components.yui.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ YUI().use(


function pjax_navigate(e) {
Y.one('body').addClass('openlayers-loading')
var msg = e.url.replace(bookUrl, '' ).replace('/' , '');
if (/(^[\d]+$){1}/.test(msg ) || /(^[\d]+-[\d]+$){1}/.test(msg)) {
this.one('.current_page').set('text', msg);
Expand Down Expand Up @@ -255,8 +256,8 @@ YUI().use(
}

function openLayersTilesLoading() {
if (Y.one('body').hasClass('openlayers-loading' )) {
Y.later(500, Y.one('.pane.load'), openLayersTilesLoading);
if (Y.one('body').hasClass('openlayers-loading')) {
Y.later(200, Y.one('.pane.load'), openLayersTilesLoading);
}
else {
Y.one('.pane.load').hide();
Expand Down
8 changes: 3 additions & 5 deletions js/ui.photo.components.yui.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ YUI().use(


function pjax_navigate(e) {
Y.one('body').addClass('openlayers-loading')
var msg = e.url.replace(photoUrl, '' ).replace('/' , '');
if (/(^[\d]+$){1}/.test(msg ) || /(^[\d]+-[\d]+$){1}/.test(msg)) {
this.one('.current_page').set('text', msg);
Expand Down Expand Up @@ -236,16 +237,13 @@ YUI().use(
Y.on('contentready', function() {
Y.CrossFrame.postMessage("parent", JSON.stringify({fire: 'openlayers:change', data: config }));
Y.fire('openlayers:change', config);
Y.later(1000, Y.one('.pane.load'), function() {
this.hide();
});
}, '#' + config.id);
}


function openLayersTilesLoading() {
if (Y.one('body').hasClass('openlayers-loading' )) {
Y.later(500, Y.one('.pane.load'), openLayersTilesLoading);
if (Y.one('body').hasClass('openlayers-loading')) {
Y.later(200, Y.one('.pane.load'), openLayersTilesLoading);
}
else {
Y.one('.pane.load').hide();
Expand Down
2 changes: 1 addition & 1 deletion templates/components/component--slider.tpl.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<span id="<?php print $slider_id ?>"></span> <form><input id="slider_value" value="<?php print $sequence_number ?>"/></form> <span>/</span> <span class="sequence_count"><?php print $sequence_count ?></span>
<span id="<?php print $slider_id ?>" aria-hidden="true"></span> <span role="navigation"><form><input id="slider_value" value="<?php print $sequence_number ?>" aria-label="Page to jump to"></form> <span>/</span> <span class="sequence_count"><?php print $sequence_count ?></span></span>
2 changes: 1 addition & 1 deletion templates/components/component--top.tpl.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="top" class="pane top">
<div id="top" class="pane top" role="banner">
<div class="views-u-1">
<?php if ($is_admin && $messages) : ?>
<?php print $messages; ?>
Expand Down
4 changes: 1 addition & 3 deletions templates/display.tpl.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<div id="pagemeta" class="pane pagemeta" dir="<?php print isset($lang_dir) ? $lang_dir : "ltr" ?>">
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-TRVMLPF"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
Expand All @@ -14,5 +13,4 @@
</<?php print $ds_content_wrapper ?>>
<?php if (!empty($drupal_render_children)): ?>
<?php print $drupal_render_children ?>
<?php endif; ?>
</div>
<?php endif; ?>
10 changes: 5 additions & 5 deletions templates/ds-1col--node-metadata.tpl.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div id="navbar" class="pane navbar">
<div id="navbar" class="pane navbar" role="navigation">
<?php print $navbar ?>
</div>
<div id="main" class="pane main" dir="<?php print isset($lang_dir) ? $lang_dir : "ltr" ?>">
<div role="main" id="main" class="pane main" dir="<?php print isset($lang_dir) ? $lang_dir : "ltr" ?>">
<div id="pagemeta" class="pane pagemeta <?php echo ($pane_metadata_hidden) ? 'hidden' : '' ?>">
<div class="container">
<<?php print $ds_content_wrapper; print $layout_attributes; ?> class="<?php print $classes;?> " dir="<?php print isset($lang_dir) ? $lang_dir : "ltr" ?>" data-dir="<?php print isset($lang_dir) ? $lang_dir : "ltr" ?>" data-lang="<?php print isset($lang_language) ? $lang_language : "und" ?>" >
Expand All @@ -16,7 +16,7 @@
<?php if (!empty($drupal_render_children)) : print $drupal_render_children; endif; ?>
</div>
</div>
<div id="display" class="pane display"
<div role="presentation" aria-hidden="true" id="display" class="pane display"
data-url="<?php print $url ?>"
data-identifier="<?php print $identifier ?>"
data-sequence-count="<?php print $sequence_count ?>"
Expand All @@ -27,7 +27,7 @@
<?php if (isset($button_previous)) print $button_previous; ?>
<?php if (isset($button_next)) print $button_next; ?>
</div>
<div class="pane load loading">
<div class="pane load loading" role="presentation" aria-hidden="true">
<?php if (isset($loading)) print $loading ; ?>
</div>
</div>
Expand All @@ -36,6 +36,6 @@
<?php if (isset($slider)) : print $slider ; endif ; ?>
</div>
<?php endif; ?>
<div id="thumbnails" class="views-g pane thumbnails hidden">
<div role="presentation" id="thumbnails" class="views-g pane thumbnails hidden">
<?php if (isset($thumbnails)) : print $thumbnails; endif; ?>
</div>
2 changes: 1 addition & 1 deletion templates/html.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<base target="content-frame">
</head>
<body class="pane-body <?php echo $pane_metadata_hidden ?>">
<body class="pane-body openlayers-loading <?php echo $pane_metadata_hidden ?>">
<?php print $page_top ?>
<?php print $page ?>
<?php print $page_bottom ?>
Expand Down

0 comments on commit f9a2946

Please sign in to comment.