1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-02 19:27:52 +02:00

Filesmanager: Bootstrap Lightbox added instead of default Modal Dialog. #100

This commit is contained in:
Awilum
2013-03-09 00:01:41 +02:00
parent d261be9b07
commit cb973d3ea9
2 changed files with 11 additions and 22 deletions

View File

@@ -8,21 +8,7 @@ $.monstra.filesmanager = {
showImage: function() {
$('.image').find('a').on('click', function() {
var src = $(this).attr('href');
var file = $(src.split('/')).last();
var image = new Image();
image.src = src;
$(image).load(function() {
$('#showImage')
.modal('show')
.css({"min-width": 632})
.find('img')
.attr('src', src);
$('#showImage').find('h3 span').text(file[0]);
$('#showImage').find('img').css({"max-width": 600});
$('#showImage').find('img').attr('alt', file[0]);
});
return false;
$('#previewLightbox').lightbox('show').find('img').attr('src', $(this).attr('rel'));
});
}
};

View File

@@ -71,7 +71,11 @@
<?php if ( ! in_array($ext, $forbidden_types)) { ?>
<tr>
<td<?php if (isset(File::$mime_types[$ext]) && preg_match('/image/', File::$mime_types[$ext])) echo ' class="image"'?>>
<?php if (isset(File::$mime_types[$ext]) && preg_match('/image/', File::$mime_types[$ext])) { ?>
<?php echo Html::anchor(File::name($file), '#', array('rel' => $site_url.'public/' . $path.$file));?>
<?php } else { ?>
<?php echo Html::anchor(File::name($file), $site_url.'public/' . $path.$file, array('target'=>'_blank'));?>
<?php } ?>
</td>
<td class="hidden-phone">
<?php echo $ext; ?>
@@ -92,12 +96,11 @@
</tbody>
</table>
<div id="showImage" class="modal hide fade">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3><?php echo __('Image:', 'filesmanager')?> <span></span></h3>
<div id="previewLightbox" class="lightbox hide fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class='lightbox-header'>
<button type="button" class="close" data-dismiss="lightbox" aria-hidden="true">&times;</button>
</div>
<div class="modal-body">
<p align="center"><img /></p>
<div class='lightbox-content'>
<img />
</div>
</div>