Skip to content

Commit 36a97fc

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent 1dae839 commit 36a97fc

File tree

2 files changed

+10
-109
lines changed

2 files changed

+10
-109
lines changed

src/kendo.dialog.js

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -124,33 +124,6 @@
124124
}
125125
},
126126

127-
setOptions: function(options) {
128-
var that = this;
129-
130-
Widget.fn.setOptions.call(that, options);
131-
132-
if (options.content) {
133-
kendo.destroy(that.element.children());
134-
that.element.html(options.content);
135-
}
136-
137-
if (options.actions) {
138-
that.wrapper.children(KBUTTONGROUP).remove();
139-
that._createActionbar(that.wrapper);
140-
}
141-
142-
that._closable(that.wrapper);
143-
that._dimensions();
144-
145-
if (options.modal !== undefined) {
146-
that._overlay(that.wrapper.is(VISIBLE)).css({ opacity: 0.5 });
147-
}
148-
149-
if (options.title !== undefined) {
150-
that.title(options.title);
151-
}
152-
},
153-
154127
_dimensions: function() {
155128
var that = this,
156129
wrapper = that.wrapper,
@@ -321,6 +294,7 @@
321294
options = that.options,
322295
isRtl = kendo.support.isRtl(content),
323296
titlebar = $(templates.titlebar(options)),
297+
titlebarActions = titlebar.find(".k-window-actions"),
324298
titleId = (content.id || kendo.guid()) + "_title",
325299
wrapper = $(that.wrapperTemplate(options));
326300

@@ -329,6 +303,15 @@
329303
content.addClass(KCONTENTCLASS);
330304
that.appendTo.append(wrapper);
331305

306+
if (options.closable !== false) {
307+
if (options.title !== false) {
308+
titlebarActions.append(templates.close(options));
309+
}
310+
else {
311+
wrapper.append(templates.close(options));
312+
}
313+
}
314+
332315
if (options.title !== false) {
333316
wrapper.append(titlebar);
334317
titlebar.attr("id", titleId);
@@ -337,8 +320,6 @@
337320
wrapper.addClass(KTITLELESS);
338321
}
339322

340-
that._closable(wrapper);
341-
342323
wrapper.append(content);
343324

344325
if (options.content) {
@@ -351,25 +332,6 @@
351332
}
352333
},
353334

354-
_closable: function (wrapper) {
355-
var that = this;
356-
var options = that.options;
357-
var titlebar = wrapper.children(KDIALOGTITLEBAR);
358-
var titlebarActions = titlebar.find(".k-window-actions");
359-
var closeAction = titlebarActions.length ? titlebarActions.find(".k-dialog-close") : wrapper.find(".k-dialog-close");
360-
361-
closeAction.remove();
362-
363-
if (options.closable !== false) {
364-
if (options.title !== false) {
365-
titlebarActions.append(templates.close(options));
366-
}
367-
else {
368-
wrapper.prepend(templates.close(options));
369-
}
370-
}
371-
},
372-
373335
_createActionbar: function(wrapper) {
374336
var isStretchedLayout = (this.options.buttonLayout === "stretched");
375337
var buttonLayout = isStretchedLayout ? "stretched" : "normal";

tests/dialog/api.js

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -312,67 +312,6 @@
312312
ok(dialog.wrapper.is(":visible"));
313313
});
314314

315-
test("setOptions modifies actions", function() {
316-
var dialog = createDialog({
317-
actions: [{
318-
text: "OK"
319-
}]
320-
});
321-
322-
dialog.setOptions({
323-
actions:[
324-
{ text: "OK" },
325-
{ text: "Cancel" }
326-
]
327-
});
328-
329-
equal(dialog.wrapper.find(".k-dialog-buttongroup .k-button").length, 2);
330-
});
331-
332-
test("setOptions modifies title", function() {
333-
var dialog = createDialog({
334-
actions: [{
335-
text: "OK"
336-
}]
337-
});
338-
339-
dialog.setOptions({
340-
title: "Test"
341-
});
342-
343-
equal(dialog.title(), "Test");
344-
});
345-
346-
test("setOptions modifies modality", function() {
347-
var dialog = createDialog({
348-
actions: [{
349-
text: "OK"
350-
}],
351-
modal: true
352-
});
353-
354-
dialog.setOptions({
355-
modal: false
356-
});
357-
358-
equal(dialog.options.modal, false);
359-
});
360-
361-
test("setOptions modifies modality", function() {
362-
var dialog = createDialog({
363-
actions: [{
364-
text: "OK"
365-
}],
366-
modal: true
367-
});
368-
369-
dialog.setOptions({
370-
content: "test"
371-
});
372-
373-
equal(dialog.element.html(), "test");
374-
});
375-
376315
test("center should track for resize", function() {
377316
var dialog = createDialog({ visible: false });
378317
trackMethodCall(dialog, "_centerOnResize");

0 commit comments

Comments
 (0)