Commit 5d8ab5f7 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic

Bug 1742347: block styles/ignore notFound error/set unique ids in blocks

- methods in theme.js need to be retriggered for timeline view
because all the versions are ajax loaded
- also patching video js style
- tidy up a few lines
- ignore not artefact not found exception
when displaying view version
- add version number in block target ids
to be able to collapse retractable blocks

behatnotneeded

Change-Id: Id081b63987f282d4c3580c97890676b6cf3e0356
parent d86be907
......@@ -1174,14 +1174,17 @@ class BlockInstance {
$content = call_static_method($classname, 'render_instance', $this, false, $versioning);
}
catch (NotFoundException $e) {
// Whoops - where did the image go? There is possibly a bug
// somewhere else that meant that this blockinstance wasn't
// told that the image was previously deleted. But the block
// instance is not allowed to treat this as a failure
log_debug('Artefact not found when rendering a block instance. '
. 'There might be a bug with deleting artefacts of this type? '
. 'Original error follows:');
log_debug($e->getMessage());
//Ignore not found error when fetching old verions of view
if (!$versioning) {
// Whoops - where did the image go? There is possibly a bug
// somewhere else that meant that this blockinstance wasn't
// told that the image was previously deleted. But the block
// instance is not allowed to treat this as a failure
log_debug('Artefact not found when rendering a block instance. '
. 'There might be a bug with deleting artefacts of this type? '
. 'Original error follows:');
log_debug($e->getMessage());
}
$content = '';
}
}
......
......@@ -410,6 +410,7 @@
var getFetchedData = function (data) {
fetchedData = data;
};
var _fetchData = function (obj) {
// var dataResult;
if (options.callType == callTypes.ajax) {
......@@ -418,6 +419,7 @@
//----------------------
if (data.error==false) {
_constructDom(data.message.data, obj);
$(window).trigger('versioningload');
}
else {
$(obj).html("Error fetching data");
......
......@@ -171,7 +171,6 @@ $string['lastpage'] = 'Last page';
$string['maxitemsperpage1'] = 'Results per page:';
$string['showmore'] = 'Show more';
$string['accept'] = 'Accept';
$string['memberofinstitutions'] = 'Member of %s';
$string['staffofinstitutions'] = 'Staff of %s';
......
......@@ -11,7 +11,6 @@
defined('INTERNAL') || die();
$string['basics'] = 'Basics';
$string['createview'] = 'Create page';
$string['edittitle'] = 'Edit title';
......@@ -530,4 +529,4 @@ $string['previousversion'] = 'Previous version';
$string['nextversion'] = 'Next version';
$string['versionnumber'] = 'Version %s';
$string['gotonextversion'] = 'Go to the next version ';
$string['gotopreviousversion'] = 'Go to the previous version %s';
$string['gotopreviousversion'] = 'Go to the previous version';
......@@ -7167,12 +7167,13 @@ class View {
return false;
}
public function format_versioning_data($data) {
public function format_versioning_data($data, $versionnumber=0) {
if (empty($data)) {
return false;
}
$data = json_decode($data);
$data->version = $versionnumber;
$this->numrows = isset($data->numrows) ? $data->numrows : $this->numrows;
$this->layout = isset($data->layout) ? $data->layout : $this->layout;
$this->description = isset($data->description) ? $data->description : '';
......
......@@ -207,6 +207,13 @@ jQuery(function($) {
responsiveObjectVideo()
});
$(window).on('versioningload', function() {
carouselHeight();
initThumbnailMasonry();
initUserThumbnailMasonry();
responsiveObjectVideo()
});
if (document.readyState === "complete") {
carouselHeight();
initUserThumbnailMasonry();
......
......@@ -436,3 +436,14 @@ outline-color: #000;
}
}
}
// TODO: remove this style when the embedded media video block is fixed to play in timeline
.video-js {
width: 300px;
height: 150px;
}
.vjs-fluid {
padding-top: 56.25%
}
......@@ -2,7 +2,7 @@
{if $title}
<h3 class="title panel-heading js-heading">
{if $retractable}
<a data-toggle="collapse" href="#blockinstance_{$id}_target" aria-expanded="{if $retractedonload}false{else}true{/if}" aria-controls="blockinstance_{$id}_target" class="outer-link{if $retractedonload} collapsed{/if}"></a>
<a data-toggle="collapse" href="#blockinstance_{$id}_target{if $versioning}_{$versioning->version}{/if}" aria-expanded="{if $retractedonload}false{else}true{/if}" aria-controls="blockinstance_{$id}_target{if $versioning}_{$versioning->version}{/if}" class="outer-link{if $retractedonload} collapsed{/if}"></a>
{/if}
<div class="collapse-inline">
......@@ -28,7 +28,7 @@
{/if}
{/if}
<div class="{if !$title}no-heading {/if}block{if $retractable} collapse{if $retractedonload}{else} in{/if}{/if}" id="blockinstance_{$id}_target" {if $loadbyajax}data-blocktype-ajax="{$id}"{else}data-blocktype-noajax="{$id}"{/if}>
<div class="{if !$title}no-heading {/if}block{if $retractable} collapse{if $retractedonload}{else} in{/if}{/if}" id="blockinstance_{$id}_target{if $versioning}_{$versioning->version}{/if}" {if $loadbyajax}data-blocktype-ajax="{$id}"{else}data-blocktype-noajax="{$id}"{/if}>
{if !$loadbyajax}{$content|safe}{/if}
{if !$versioning && ($link || $viewartefacturl)}
......
......@@ -33,7 +33,7 @@ if ($versions->count > 0) {
reset($versions->data);
foreach ($versions->data as $key => $value) {
$view = new View($viewid);
$value->blockdata_formatted = $view->format_versioning_data($value->blockdata);
$value->blockdata_formatted = $view->format_versioning_data($value->blockdata, $key);
$data[$key] = array(
"isSelected" => ($key == $lastkey ? true : false),
"taskTitle" => (isset($value->blockdata_formatted->title) ? $value->blockdata_formatted->title : $value->viewname),
......
Markdown is supported
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