2013-04-26 08:44:25 +00:00
|
|
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
|
|
|
'use strict';
|
|
|
|
|
2015-02-05 08:14:35 +00:00
|
|
|
pandora.ui.embedDocumentDialog = function(id, position) {
|
2013-04-26 08:44:25 +00:00
|
|
|
|
2014-02-04 05:53:28 +00:00
|
|
|
var $content = Ox.Element()
|
2013-04-26 08:44:25 +00:00
|
|
|
.css({margin: '16px'})
|
2015-02-05 08:14:35 +00:00
|
|
|
.html(Ox._(
|
|
|
|
'To embed this document'
|
|
|
|
+ (position ? ' at the current position' : '')
|
|
|
|
+ ', use the following HTML:'
|
|
|
|
)),
|
2013-04-26 08:44:25 +00:00
|
|
|
|
|
|
|
$embed = $('<textarea>')
|
|
|
|
.css({
|
2014-02-04 05:53:28 +00:00
|
|
|
width: '322px',
|
2013-04-26 08:44:25 +00:00
|
|
|
height: '64px',
|
2014-02-04 05:53:28 +00:00
|
|
|
marginTop: '8px'
|
2013-04-26 08:44:25 +00:00
|
|
|
})
|
|
|
|
.val(
|
2015-02-05 08:14:35 +00:00
|
|
|
'<a href="/documents/' + id
|
|
|
|
+ (position ? '/' + position : '')
|
|
|
|
+ '"><img src="/documents/' + id + '/256p'
|
|
|
|
+ (position || '') + '.jpg"></a>'
|
2013-04-26 08:44:25 +00:00
|
|
|
)
|
|
|
|
.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,
|
2015-02-05 08:18:46 +00:00
|
|
|
height: 144,
|
2013-04-26 08:44:25 +00:00
|
|
|
keys: {escape: 'close'},
|
|
|
|
removeOnClose: true,
|
2014-02-04 05:53:28 +00:00
|
|
|
title: Ox._('Embed Document'),
|
2013-04-26 08:44:25 +00:00
|
|
|
width: 368
|
|
|
|
});
|
|
|
|
|
|
|
|
return that;
|
|
|
|
|
|
|
|
};
|