mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #3286 from mateusz/destroy-checks
BUG Make UI widget destroys more consistent to avoid exceptions.
This commit is contained in:
commit
f16306d843
@ -11,6 +11,8 @@
|
||||
*/
|
||||
$(".cms .field.cms-description-tooltip").entwine({
|
||||
onmatch: function() {
|
||||
this._super();
|
||||
|
||||
var descriptionEl = this.find('.description'), inputEl, tooltipEl;
|
||||
if(descriptionEl.length) {
|
||||
this
|
||||
@ -19,8 +21,8 @@
|
||||
.tooltip({content: descriptionEl.html()});
|
||||
descriptionEl.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
$(".cms .field.cms-description-tooltip :input").entwine({
|
||||
onfocusin: function(e) {
|
||||
|
@ -518,6 +518,7 @@
|
||||
|
||||
$('.cms-edit-form').entwine({
|
||||
onadd: function() {
|
||||
this._super();
|
||||
$('.cms-preview')._initialiseFromContent();
|
||||
}
|
||||
});
|
||||
|
@ -948,8 +948,8 @@ jQuery.noConflict();
|
||||
setTimeout(function() {
|
||||
form.clickedButton = null;
|
||||
}, 10);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.redraw();
|
||||
this._super();
|
||||
|
@ -198,11 +198,13 @@
|
||||
|
||||
$('.ss-gridfield-print-iframe').entwine({
|
||||
onmatch: function(){
|
||||
this._super();
|
||||
|
||||
this.hide().bind('load', function() {
|
||||
this.focus();
|
||||
var ifWin = this.contentWindow || this;
|
||||
ifWin.print();
|
||||
});;
|
||||
});
|
||||
},
|
||||
onunmatch: function() {
|
||||
this._super();
|
||||
@ -268,15 +270,15 @@
|
||||
}
|
||||
});
|
||||
$('.ss-gridfield[data-selectable] .ss-gridfield-items').entwine({
|
||||
onmatch: function() {
|
||||
onadd: function() {
|
||||
this._super();
|
||||
|
||||
// TODO Limit to single selection
|
||||
this.selectable();
|
||||
},
|
||||
onunmatch: function() {
|
||||
onremove: function() {
|
||||
this._super();
|
||||
this.selectable('destroy');
|
||||
if (this.data('selectable')) this.selectable('destroy');
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -959,6 +959,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
||||
|
||||
$('form.htmleditorfield-form.htmleditorfield-mediaform input.remoteurl').entwine({
|
||||
onadd: function() {
|
||||
this._super();
|
||||
this.validate();
|
||||
},
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
this._super();
|
||||
},
|
||||
onremove: function() {
|
||||
if(this.data('uiTabs')) this.tabs('destroy');
|
||||
if(this.data('tabs')) this.tabs('destroy');
|
||||
this._super();
|
||||
},
|
||||
redrawTabs: function() {
|
||||
|
@ -2,15 +2,16 @@
|
||||
$.entwine('ss', function($){
|
||||
$('.ss-toggle').entwine({
|
||||
onadd: function() {
|
||||
this._super();
|
||||
|
||||
this.accordion({
|
||||
collapsible: true,
|
||||
active: (this.hasClass("ss-toggle-start-closed")) ? false : 0
|
||||
});
|
||||
|
||||
this._super();
|
||||
},
|
||||
onremove: function() {
|
||||
this.accordion('destroy');
|
||||
if (this.data('accordion')) this.accordion('destroy');
|
||||
this._super();
|
||||
},
|
||||
|
||||
getTabSet: function() {
|
||||
|
@ -423,11 +423,13 @@
|
||||
|
||||
$('.TreeDropdownField input[type=hidden]').entwine({
|
||||
onadd: function() {
|
||||
this._super();
|
||||
this.bind('change.TreeDropdownField', function() {
|
||||
$(this).getField().updateTitle();
|
||||
});
|
||||
},
|
||||
onremove: function() {
|
||||
this._super();
|
||||
this.unbind('.TreeDropdownField');
|
||||
}
|
||||
});
|
||||
|
@ -328,11 +328,11 @@
|
||||
}
|
||||
});
|
||||
$('div.ss-upload .ss-uploadfield-files .ss-uploadfield-item').entwine({
|
||||
onmatch: function() {
|
||||
onadd: function() {
|
||||
this._super();
|
||||
this.closest('.ss-upload').find('.ss-uploadfield-addfile').addClass('borderTop');
|
||||
},
|
||||
onunmatch: function() {
|
||||
onremove: function() {
|
||||
$('.ss-uploadfield-files:not(:has(.ss-uploadfield-item))').closest('.ss-upload').find('.ss-uploadfield-addfile').removeClass('borderTop');
|
||||
this._super();
|
||||
}
|
||||
@ -365,19 +365,25 @@
|
||||
if(config.changeDetection) {
|
||||
this.closest('form').trigger('dirty');
|
||||
}
|
||||
fileupload._trigger('destroy', e, {
|
||||
context: item,
|
||||
url: this.data('href'),
|
||||
type: 'get',
|
||||
dataType: fileupload.options.dataType
|
||||
});
|
||||
|
||||
if (fileupload) {
|
||||
fileupload._trigger('destroy', e, {
|
||||
context: item,
|
||||
url: this.data('href'),
|
||||
type: 'get',
|
||||
dataType: fileupload.options.dataType
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Removed files will be applied to object on save
|
||||
if(config.changeDetection) {
|
||||
this.closest('form').trigger('dirty');
|
||||
}
|
||||
fileupload._trigger('destroy', e, {context: item});
|
||||
|
||||
if (fileupload) {
|
||||
fileupload._trigger('destroy', e, {context: item});
|
||||
}
|
||||
}
|
||||
|
||||
e.preventDefault(); // Avoid a form submit
|
||||
|
Loading…
Reference in New Issue
Block a user