pandora/static/js/embedDocumentDialog.js

59 lines
1.6 KiB
JavaScript
Raw Normal View History

2013-04-26 08:44:25 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
'use strict';
pandora.ui.embedDocumentDialog = function(id) {
2013-04-26 08:44:25 +00:00
var isImage = Ox.contains(['jpg', 'png'], selected.split('.').pop()),
url = 'http' + (pandora.site.site.https ? 's' : '') + '://'
+ pandora.site.site.url + '/documents/' + id,
2013-04-26 08:44:25 +00:00
$content = Ox.Element()
.css({margin: '16px'})
.html(
2013-05-09 10:13:58 +00:00
Ox._('To embed this file, use the following HTML:<br>')
2013-04-26 08:44:25 +00:00
),
$embed = $('<textarea>')
.css({
width: '336px',
height: '64px',
marginTop: '8px',
})
.val(
isImage
? '<img src="' + url + '">'
: '<a href="' + url + '"><img src="' + url + '.jpg"></a>'
)
.on({
click: function() {
this.focus();
this.select();
}
})
.appendTo($content),
that = Ox.Dialog({
buttons: [
Ox.Button({
id: 'close',
2013-05-09 10:13:58 +00:00
title: Ox._('Close')
2013-04-26 08:44:25 +00:00
}).bindEvent({
click: function() {
that.close();
}
})
],
closeButton: true,
content: $content,
fixedSize: true,
height: 128,
keys: {escape: 'close'},
removeOnClose: true,
2013-05-09 10:13:58 +00:00
title: Ox._('Embed File'),
2013-04-26 08:44:25 +00:00
width: 368
});
return that;
};