embed document dialog: support position

This commit is contained in:
rolux 2015-02-05 08:14:35 +00:00
parent 809486b43c
commit eb68de7a44

View file

@ -1,11 +1,15 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript // vim: et:ts=4:sw=4:sts=4:ft=javascript
'use strict'; 'use strict';
pandora.ui.embedDocumentDialog = function(id) { pandora.ui.embedDocumentDialog = function(id, position) {
var $content = Ox.Element() var $content = Ox.Element()
.css({margin: '16px'}) .css({margin: '16px'})
.html(Ox._('To embed this document, use the following HTML:')), .html(Ox._(
'To embed this document'
+ (position ? ' at the current position' : '')
+ ', use the following HTML:'
)),
$embed = $('<textarea>') $embed = $('<textarea>')
.css({ .css({
@ -14,9 +18,10 @@ pandora.ui.embedDocumentDialog = function(id) {
marginTop: '8px' marginTop: '8px'
}) })
.val( .val(
'<a href="/documents/' '<a href="/documents/' + id
+ id + '"><img src="/documents/' + (position ? '/' + position : '')
+ id + '/256p.jpg"></a>' + '"><img src="/documents/' + id + '/256p'
+ (position || '') + '.jpg"></a>'
) )
.on({ .on({
click: function() { click: function() {