Merge pull request #4784 from owncloud/ocdialog_option_setter

Fix setting ocdialog options after initialization.
This commit is contained in:
Thomas Tanghus 2013-09-11 12:20:17 -07:00
commit 80bf1969f9
1 changed files with 10 additions and 6 deletions

View File

@ -39,7 +39,8 @@
return; return;
} }
// Escape // Escape
if(event.keyCode === 27 && self.options.closeOnEscape) { if(event.keyCode === 27 && event.type === 'keydown' && self.options.closeOnEscape) {
event.stopImmediatePropagation();
self.close(); self.close();
return false; return false;
} }
@ -83,20 +84,21 @@
var self = this; var self = this;
switch(key) { switch(key) {
case 'title': case 'title':
var $title = $('<h3 class="oc-dialog-title">' + this.options.title
+ '</h3>'); //<hr class="oc-dialog-separator" />');
if(this.$title) { if(this.$title) {
this.$title.replaceWith($title); this.$title.text(value);
} else { } else {
var $title = $('<h3 class="oc-dialog-title">'
+ value
+ '</h3>');
this.$title = $title.prependTo(this.$dialog); this.$title = $title.prependTo(this.$dialog);
} }
this._setSizes(); this._setSizes();
break; break;
case 'buttons': case 'buttons':
var $buttonrow = $('<div class="oc-dialog-buttonrow" />');
if(this.$buttonrow) { if(this.$buttonrow) {
this.$buttonrow.replaceWith($buttonrow); this.$buttonrow.empty();
} else { } else {
var $buttonrow = $('<div class="oc-dialog-buttonrow" />');
this.$buttonrow = $buttonrow.appendTo(this.$dialog); this.$buttonrow = $buttonrow.appendTo(this.$dialog);
} }
$.each(value, function(idx, val) { $.each(value, function(idx, val) {
@ -124,6 +126,8 @@
$closeButton.on('click', function() { $closeButton.on('click', function() {
self.close(); self.close();
}); });
} else {
this.$dialog.find('.oc-dialog-close').remove();
} }
break; break;
case 'width': case 'width':