Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions src/js/dialogs-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
var DialogsManager = {
widgetsTypes: {},
createWidgetType: function(typeName, properties, Parent) {
createWidgetType(typeName, properties, Parent) {

if (!Parent) {
Parent = this.Widget;
Expand All @@ -41,15 +41,15 @@

return WidgetType;
},
addWidgetType: function(typeName, properties, Parent) {
addWidgetType(typeName, properties, Parent) {

if (properties && properties.prototype instanceof this.Widget) {
return this.widgetsTypes[typeName] = properties;
}

return this.widgetsTypes[typeName] = this.createWidgetType(typeName, properties, Parent);
},
getWidgetType: function(widgetType) {
getWidgetType(widgetType) {

return this.widgetsTypes[widgetType];
}
Expand Down Expand Up @@ -743,7 +743,7 @@
DialogsManager.widgetsTypes.simple = DialogsManager.Widget;

DialogsManager.addWidgetType('buttons', {
activeKeyUp: function(event) {
activeKeyUp(event) {

var TAB_KEY = 9;

Expand All @@ -755,7 +755,7 @@
this.hotKeys[event.which](this);
}
},
activeKeyDown: function(event) {
activeKeyDown(event) {

if (!this.focusedButton) {
return;
Expand Down Expand Up @@ -788,7 +788,7 @@
this.focusedButton = this.buttons[nextButtonIndex].trigger('focus');
}
},
addButton: function(options) {
addButton(options) {

var self = this,
settings = self.getSettings(),
Expand Down Expand Up @@ -827,29 +827,29 @@

return self;
},
bindHotKeys: function() {
bindHotKeys() {

this.getElements('window').on({
keyup: this.activeKeyUp,
keydown: this.activeKeyDown
});
},
buildWidget: function() {
buildWidget() {

DialogsManager.Widget.prototype.buildWidget.apply(this, arguments);

var $buttonsWrapper = this.addElement('buttonsWrapper');

this.getElements('widget').append($buttonsWrapper);
},
getClosureMethods: function() {
getClosureMethods() {

return [
'activeKeyUp',
'activeKeyDown'
];
},
getDefaultSettings: function() {
getDefaultSettings() {

return {
hide: {
Expand All @@ -860,19 +860,19 @@
}
};
},
onHide: function() {
onHide() {

this.unbindHotKeys();
},
onInit: function() {
onInit() {

this.buttons = [];

this.hotKeys = {};

this.focusedButton = null;
},
onShow: function() {
onShow() {

this.bindHotKeys();

Expand All @@ -884,7 +884,7 @@
this.focusedButton.trigger('focus');
}
},
unbindHotKeys: function() {
unbindHotKeys() {

this.getElements('window').off({
keyup: this.activeKeyUp,
Expand All @@ -894,7 +894,7 @@
});

DialogsManager.addWidgetType('lightbox', DialogsManager.getWidgetType('buttons').extend('lightbox', {
getDefaultSettings: function() {
getDefaultSettings() {

var settings = DialogsManager.getWidgetType('buttons').prototype.getDefaultSettings.apply(this, arguments);

Expand All @@ -908,7 +908,7 @@
}
});
},
buildWidget: function() {
buildWidget() {

DialogsManager.getWidgetType('buttons').prototype.buildWidget.apply(this, arguments);

Expand All @@ -923,7 +923,7 @@
$widgetContent.prepend(elements.closeButton);
}
},
onReady: function() {
onReady() {

var elements = this.getElements(),
settings = this.getSettings();
Expand All @@ -939,7 +939,7 @@
}));

DialogsManager.addWidgetType('confirm', DialogsManager.getWidgetType('lightbox').extend('confirm', {
onReady: function() {
onReady() {

DialogsManager.getWidgetType('lightbox').prototype.onReady.apply(this, arguments);

Expand All @@ -949,7 +949,7 @@
this.addButton({
name: 'cancel',
text: strings.cancel,
callback: function(widget) {
callback(widget) {

widget.trigger('cancel');
},
Expand All @@ -959,14 +959,14 @@
this.addButton({
name: 'ok',
text: strings.confirm,
callback: function(widget) {
callback(widget) {

widget.trigger('confirm');
},
focus: !isDefaultCancel
});
},
getDefaultSettings: function() {
getDefaultSettings() {

var settings = DialogsManager.getWidgetType('lightbox').prototype.getDefaultSettings.apply(this, arguments);

Expand All @@ -982,7 +982,7 @@
}));

DialogsManager.addWidgetType('alert', DialogsManager.getWidgetType('lightbox').extend('alert', {
onReady: function() {
onReady() {

DialogsManager.getWidgetType('lightbox').prototype.onReady.apply(this, arguments);

Expand All @@ -991,13 +991,13 @@
this.addButton({
name: 'ok',
text: strings.confirm,
callback: function(widget) {
callback(widget) {

widget.trigger('confirm');
}
});
},
getDefaultSettings: function() {
getDefaultSettings() {

var settings = DialogsManager.getWidgetType('lightbox').prototype.getDefaultSettings.apply(this, arguments);

Expand Down