Commit 7dc05671 authored by Aaron Wells's avatar Aaron Wells Committed by Gerrit Code Review
Browse files

Merge "Show description text below images in image gallery (Bug #833867)"

parents 03f9705a f7807a18
......@@ -7,11 +7,19 @@ function Slideshow(id, count) {
if (to == this.current || to < 0 || to > this.count) {
return false;
}
if ($j("#description_" + id + "_" + this.current)) {
$j("#description_" + id + "_" + this.current).css('display', 'none');
}
$j(this.id).height($j(this.id + " img:eq(" + this.current + ")").height() + 10);
$j(this.id + " img:eq(" + this.current + ")").fadeOut(500, function() {
var extraheight = 0;
self.current = to;
if ($j("#description_" + id + "_" + self.current)) {
$j("#description_" + id + "_" + self.current).css('display','block');
extraheight = $j("#description_" + id + "_" + self.current).height();
}
$j(self.id).height($j(self.id + " img:eq(" + self.current + ")").height() + extraheight + 10);
$j(self.id + " img:eq(" + self.current + ")").fadeIn(500);
$j(self.id).height($j(self.id + " img:eq(" + self.current + ")").height() + 10);
});
$j(this.id + ' td.control span').removeClass('disabled');
if (to == 0) {
......
......@@ -27,7 +27,8 @@ $string['style'] = 'Style';
$string['stylethumbs'] = 'Thumbnails';
$string['stylesquares'] = 'Thumbnails (square)';
$string['styleslideshow'] = 'Slideshow';
$string['showdescriptions'] = 'Show descriptions';
$string['showdescriptionsdescription'] = 'Select to caption each image with its description.';
$string['cannotdisplayslideshow'] = 'Cannot display slideshow.';
$string['gallerysettings'] = 'Gallery settings';
......
......@@ -388,7 +388,9 @@ class PluginBlocktypeGallery extends PluginBlocktype {
$smarty->assign('instanceid', $instance->get('id'));
$smarty->assign('count', count($images));
$smarty->assign('images', $images);
$smarty->assign('showdescription', (!empty($configdata['showdescription'])) ? $configdata['showdescription'] : false);
$smarty->assign('width', $width);
$smarty->assign('captionwidth', (get_config_plugin('blocktype', 'gallery', 'photoframe') ? $width + 8 : $width));
if (isset($height)) {
$smarty->assign('height', $height);
}
......@@ -552,6 +554,12 @@ class PluginBlocktypeGallery extends PluginBlocktype {
'defaultvalue' => (isset($configdata['style'])) ? $configdata['style'] : 2, // Square thumbnails should be default...
'separator' => '<br>',
),
'showdescription' => array(
'type' => 'checkbox',
'title' => get_string('showdescriptions', 'blocktype.file/gallery'),
'description' => get_string('showdescriptionsdescription', 'blocktype.file/gallery'),
'defaultvalue' => !empty($configdata['showdescription']) ? true : false,
),
'width' => array(
'type' => 'text',
'title' => get_string('width', 'blocktype.file/gallery'),
......
......@@ -7,8 +7,9 @@
<span class="first disabled">&laquo;</span>
</td>
<td>
{foreach from=$images item=image name=images}
{foreach from=$images item=image key=k name=images}
<a href="{$image.link}" target="_blank"><img src="{$image.source}" alt="{$image.title}" title="{$image.title}" style="max-width: {$width}px;{if !$dwoo.foreach.images.first} display:none;{/if}"></a>
{if $showdescription && $image.title}<div class="caption" id="description_{$instanceid}_{$k}" style="{if !$dwoo.foreach.images.first} display:none;{/if}">{$image.title}</div>{/if}
{/foreach}
</td>
<td class="control">
......
<div class="thumbnails">
<div class="thumbnails" id="thumbnails{$instanceid}">
{foreach from=$images item=image}
<span style="float:left;{if $frame} padding: 3px;{/if}">
<div style="float:left;{if $frame} padding: 3px;{/if}" class="thumb">
<a rel="{$image.slimbox2}" href="{$image.link}" title="{$image.title}" target="_blank">
<img src="{$image.source}" alt="{$image.title}" title="{$image.title}" width="{$width}" height="{$width}" {if $frame}class="frame"{/if}/>
</a>
</span>
{if $showdescription && $image.title}<div class="caption" style="width: {$captionwidth}px;">{$image.title|safe}</div>{/if}
</div>
{/foreach}
<div class="cb"></div>
</div>
<script type="text/javascript">
$j(function() {
if ($j('#thumbnails{$instanceid}')) {
// adjust height of image + description box to align things up
var maxHeight = Math.max.apply(null, $j('#thumbnails{$instanceid} .thumb').map(function() {
return $j(this).height();
}).get());
$j('#thumbnails{$instanceid} .thumb').each(function() {
$j(this).css('height', maxHeight);
});
}
});
</script>
{if isset($copyright)}<div class="cb" id="lbBottom">{$copyright|safe}</div>{/if}
<div class="thumbnails">
<div class="thumbnails" id="thumbnails{$instanceid}">
{foreach from=$images item=image}
<span style="float:left;{if $frame} padding: 3px;{/if}">
<div style="float:left;{if $frame} padding: 3px;{/if}" class="thumb">
<a rel="{$image.slimbox2}" href="{$image.link}" title="{$image.title}" target="_blank">
<img src="{$image.source}" alt="{$image.title}" title="{$image.title}" {if $frame}class="frame"{/if} />
</a>
</span>
{if $showdescription && $image.title}<div class="caption" style="width: {$captionwidth}px;">{$image.title|safe}</div>{/if}
</div>
{/foreach}
<div class="cb"></div>
</div>
<script type="text/javascript">
$j(function() {
if ($j('#thumbnails{$instanceid}')) {
// adjust height of image + description box to align things up
var maxHeight = Math.max.apply(null, $j('#thumbnails{$instanceid} .thumb').map(function() {
return $j(this).height();
}).get());
$j('#thumbnails{$instanceid} .thumb').each(function() {
$j(this).css('height', maxHeight);
});
}
});
</script>
{if isset($copyright)}<div class="cb" id="lbBottom">{$copyright|safe}</div>{/if}
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