forked from 0x2620/pandora
add embedFileDialog
This commit is contained in:
parent
cfc783f280
commit
a7cead82e8
1 changed files with 58 additions and 0 deletions
58
static/js/pandora/embedFileDialog.js
Normal file
58
static/js/pandora/embedFileDialog.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||
'use strict';
|
||||
|
||||
pandora.ui.embedFileDialog = function(id) {
|
||||
|
||||
var isImage = Ox.contains(['jpg', 'png'], selected.split('.').pop()),
|
||||
url = 'http' + (pandora.site.site.https ? 's' : '') + '://'
|
||||
+ pandora.site.site.url + '/files/' + id,
|
||||
|
||||
$content = Ox.Element()
|
||||
.css({margin: '16px'})
|
||||
.html(
|
||||
'To embed this file, use the following HTML:<br>'
|
||||
),
|
||||
|
||||
$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',
|
||||
title: 'Close'
|
||||
}).bindEvent({
|
||||
click: function() {
|
||||
that.close();
|
||||
}
|
||||
})
|
||||
],
|
||||
closeButton: true,
|
||||
content: $content,
|
||||
fixedSize: true,
|
||||
height: 128,
|
||||
keys: {escape: 'close'},
|
||||
removeOnClose: true,
|
||||
title: 'Embed File',
|
||||
width: 368
|
||||
});
|
||||
|
||||
return that;
|
||||
|
||||
};
|
Loading…
Reference in a new issue