Move code from ui-elements to common-interface
This commit is contained in:
parent
179e7d68b4
commit
817309d602
@ -462,6 +462,35 @@ define([
|
||||
return frame;
|
||||
};
|
||||
|
||||
UI.createModal = function (cfg) {
|
||||
var $body = cfg.$body || $('body');
|
||||
var $blockContainer = $body.find('#'+cfg.id);
|
||||
if (!$blockContainer.length) {
|
||||
$blockContainer = $(h('div.cp-modal-container#'+cfg.id, {
|
||||
tabindex: 1
|
||||
}));
|
||||
}
|
||||
var hide = function () {
|
||||
if (cfg.onClose) { return void cfg.onClose(); }
|
||||
$blockContainer.hide();
|
||||
};
|
||||
$blockContainer.html('').appendTo($body);
|
||||
var $block = $(h('div.cp-modal')).appendTo($blockContainer);
|
||||
$(h('span.cp-modal-close.fa.fa-times', {
|
||||
title: Messages.filePicker_close
|
||||
})).click(hide).appendTo($block);
|
||||
$body.click(hide);
|
||||
$block.click(function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
$body.keydown(function (e) {
|
||||
if (e.which === 27) {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
return $blockContainer;
|
||||
};
|
||||
|
||||
UI.alert = function (msg, cb, opt) {
|
||||
var force = false;
|
||||
if (typeof(opt) === 'object') {
|
||||
|
||||
@ -2538,37 +2538,6 @@ define([
|
||||
return $block;
|
||||
};
|
||||
|
||||
UIElements.createModal = function (cfg) {
|
||||
var $body = cfg.$body || $('body');
|
||||
var $blockContainer = $body.find('#'+cfg.id);
|
||||
if (!$blockContainer.length) {
|
||||
$blockContainer = $('<div>', {
|
||||
'class': 'cp-modal-container',
|
||||
tabindex: 1,
|
||||
'id': cfg.id
|
||||
});
|
||||
}
|
||||
var hide = function () {
|
||||
if (cfg.onClose) { return void cfg.onClose(); }
|
||||
$blockContainer.hide();
|
||||
};
|
||||
$blockContainer.html('').appendTo($body);
|
||||
var $block = $('<div>', {'class': 'cp-modal'}).appendTo($blockContainer);
|
||||
$('<span>', {
|
||||
'class': 'cp-modal-close fa fa-times',
|
||||
'title': Messages.filePicker_close
|
||||
}).click(hide).appendTo($block);
|
||||
$body.click(hide);
|
||||
$block.click(function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
$body.keydown(function (e) {
|
||||
if (e.which === 27) {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
return $blockContainer;
|
||||
};
|
||||
|
||||
UIElements.createNewPadModal = function (common) {
|
||||
// if in drive, show new pad modal instead
|
||||
@ -2576,7 +2545,7 @@ define([
|
||||
return void $(".cp-app-drive-element-row.cp-app-drive-new-ghost").click();
|
||||
}
|
||||
|
||||
var $modal = UIElements.createModal({
|
||||
var $modal = UI.createModal({
|
||||
id: 'cp-app-toolbar-creation-dialog',
|
||||
$body: $('body')
|
||||
});
|
||||
|
||||
@ -2892,7 +2892,7 @@ define([
|
||||
$element.append($('<span>', {'class': 'cp-app-drive-element-name'})
|
||||
.text(Messages.fm_newFile));
|
||||
$element.click(function () {
|
||||
var $modal = UIElements.createModal({
|
||||
var $modal = UI.createModal({
|
||||
id: 'cp-app-drive-new-ghost-dialog',
|
||||
$body: $('body')
|
||||
});
|
||||
|
||||
@ -81,7 +81,7 @@ define([
|
||||
var createFileDialog = function () {
|
||||
var types = filters.types || [];
|
||||
// Create modal
|
||||
var $blockContainer = UIElements.createModal({
|
||||
var $blockContainer = UI.createModal({
|
||||
id: 'cp-filepicker-dialog',
|
||||
$body: $body,
|
||||
onClose: hideFileDialog
|
||||
|
||||
@ -535,7 +535,7 @@ define([
|
||||
};
|
||||
|
||||
var makePermissions = function () {
|
||||
var $blockContainer = UIElements.createModal({
|
||||
var $blockContainer = UI.createModal({
|
||||
id: 'cp-teams-roster-dialog',
|
||||
}).show();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user