Orbit/app/views/shared/preview/_modal_preview.html.erb

51 lines
1.6 KiB
Plaintext
Raw Normal View History

<div class="modal hide fade in banner-preview" id="<%= @preview_obj.id %>">
2012-09-04 01:24:12 +00:00
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
2012-11-27 03:15:15 +00:00
<h3><%= t(:preview) %></h3>
2012-09-04 01:24:12 +00:00
</div>
<div class="modal-body">
2013-10-24 06:46:53 +00:00
<iframe src=<%= @preview_obj.get_preview_link %>></iframe>
2012-09-04 01:24:12 +00:00
</div>
<div class="modal-footer">
2012-11-27 03:15:15 +00:00
<a href="#" class="btn" data-dismiss="modal"><%= t(:close) %></a>
2012-09-04 01:24:12 +00:00
</div>
<div>
2013-10-24 06:46:53 +00:00
<script type="text/javascript" src="/assets/kernel.js"></script>
2012-09-04 01:24:12 +00:00
<script type="text/javascript">
2013-11-06 08:31:27 +00:00
var preview_img;
2013-10-24 06:46:53 +00:00
$(function() {
$("iframe").load(function() {
2012-09-04 01:24:12 +00:00
// Get the body element
2013-10-24 06:46:53 +00:00
var frameBody = $("iframe").contents().find('body');
2012-09-04 01:24:12 +00:00
// Get all links inside the BODY tag
2013-10-24 06:46:53 +00:00
$("iframe").contents().find('#orbit-bar').hide();
2013-11-06 08:31:27 +00:00
$('.thumbnail').each(function(){
if($(this).children('img').length) preview_img = $(this).children('img').attr('src');
});
2013-10-24 06:46:53 +00:00
2013-11-06 08:31:27 +00:00
InsertPreviewImage();
2013-10-24 06:46:53 +00:00
frameBody.find('a').click(function(e){
//Disable all default actions
e.preventDefault();
2012-09-04 01:24:12 +00:00
});
$('input', frameBody).attr("disabled", true);
2013-10-24 06:46:53 +00:00
});
$(".modal").on("hidden", function () {
$("#show_preview").remove();
});
2012-09-04 01:24:12 +00:00
});
2013-11-06 08:31:27 +00:00
function InsertPreviewImage(){
if($("iframe").contents().find('.news_image').length){
$("iframe").contents().find('.news_image').append("<a href='' target='_blank'><img src='"+preview_img+"' width='320' height='240' /></a>");
}else{
setTimeout(InsertPreviewImage,1000);
}
}
2012-09-04 01:24:12 +00:00
</script>
</div>
</div>