This commit is contained in:
rolux 2013-02-21 17:26:56 +05:30
parent 5d89f0d3a9
commit c6aa89f5b6

View file

@ -17,7 +17,7 @@ pandora.ui.textPanel = function() {
var text = result.data, var text = result.data,
embedsURLs = getEmbedsURLs(), embedURLs = getEmbedURLs(text.text),
$toolbar = Ox.Bar({size: 24}), $toolbar = Ox.Bar({size: 24}),
@ -95,32 +95,34 @@ pandora.ui.textPanel = function() {
orientation: 'horizontal' orientation: 'horizontal'
}); });
if (text.type == 'html') { if (text.editable) {
$editMenu = Ox.MenuButton({ if (text.type == 'html') {
items: [ $editMenu = Ox.MenuButton({
{id: 'inserthtml', title: 'Insert HTML...'}, items: [
{id: 'insertembed', title: 'Insert Embed...'} {id: 'inserthtml', title: 'Insert HTML...'},
], {id: 'insertembed', title: 'Insert Embed...'}
title: 'edit', ],
tooltip: 'Editing Options', title: 'edit',
type: 'image' tooltip: 'Editing Options',
}) type: 'image'
.css({ })
float: 'left', .css({
margin: '4px 2px 4px 4px' float: 'left',
}) margin: '4px 2px 4px 4px'
.appendTo($toolbar); })
} else { .appendTo($toolbar);
$uploadButton = Ox.Button({ } else {
title: 'upload', $uploadButton = Ox.Button({
tooltip: 'Upload PDF', title: 'upload',
type: 'image' tooltip: 'Upload PDF',
}) type: 'image'
.css({ })
float: 'left', .css({
margin: '4px 2px 4px 4px' float: 'left',
}) margin: '4px 2px 4px 4px'
.appendTo($toolbar); })
.appendTo($toolbar);
}
} }
that.setElement( that.setElement(
@ -175,10 +177,10 @@ pandora.ui.textHTML = function(text, tags) {
submit: function(data) { submit: function(data) {
Ox.Request.clearCache('getText'); Ox.Request.clearCache('getText');
pandora.api.editText({ pandora.api.editText({
id: ui.text, id: pandora.user.ui.text,
name: data.value name: data.value
}, function(result) { }, function(result) {
// ... Ox.print('RESULT.DATA:', result.data);
}); });
} }
}) })
@ -251,6 +253,8 @@ pandora.ui.textHTML = function(text, tags) {
return that; return that;
}; };
return that;
}; };
pandora.ui.textPDF = function(text) { pandora.ui.textPDF = function(text) {
@ -266,21 +270,25 @@ pandora.ui.textPDF = function(text) {
pandora.ui.textEmbed = function(url) { pandora.ui.textEmbed = function(url) {
var that = Ox.Element() var that = Ox.Element()
.css({padding: '16px'})
.html('No Embeds')
.bindEvent({ .bindEvent({
resizestart: function() { resizestart: function() {
url && $overlay.show(); url && $overlay.show();
}, },
resize: function(data) { resize: function(data) {
pandora.user.ui.embedSize = data.size; pandora.user.ui.embedSize = data.size;
pandora.$ui.text.updateSize(); pandora.$ui.text.update();
}, },
resizeend: function() { resizeend: function() {
url && $overlay.hide(); url && $overlay.hide();
} }
}), }),
$message = $('<div>')
.css({marginTop: '16px', textAlign: 'center'})
.html('No Embeds')
.hide()
.appendTo(that),
$iframe = $('<iframe>') $iframe = $('<iframe>')
.attr({ .attr({
height: '100%', height: '100%',
@ -289,7 +297,7 @@ pandora.ui.textEmbed = function(url) {
width: '100%' width: '100%'
}) })
.hide() .hide()
.appendTo($element), .appendTo(that),
$overlay = $('<div>') $overlay = $('<div>')
.css({ .css({
@ -300,13 +308,15 @@ pandora.ui.textEmbed = function(url) {
bottom: 0 bottom: 0
}) })
.hide() .hide()
.appendTo($element); .appendTo(that);
that.update = function(url) { that.update = function(url) {
if (url) { if (url) {
$message.hide();
$iframe.attr({src: url}).show(); $iframe.attr({src: url}).show();
} else { } else {
$iframe.hide(); $iframe.hide();
$message.show();
} }
return that; return that;
}; };