Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Modal #9092

Merged
merged 11 commits into from
Dec 13, 2017
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"Logger" : false,
"Match" : false,
"Meteor" : false,
"modal" : false,
"moment" : false,
"Mongo" : false,
"Npm" : false,
Expand All @@ -139,7 +140,6 @@
"Settings" : false,
"SHA256" : false,
"SideNav" : false,
"swal" : false,
"t" : false,
"TAPi18n" : false,
"TAPi18next" : false,
Expand Down
1 change: 0 additions & 1 deletion .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ percolate:synced-cron
raix:handlebar-helpers
raix:push
raix:ui-dropped-event
smoral:sweetalert
steffo:meteor-accounts-saml
todda00:friendly-slugs
yasaricli:slugify
Expand Down
1 change: 0 additions & 1 deletion .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ session@1.1.7
sha@1.0.9
shell-server@0.3.1
simple:json-routes@2.1.0
smoral:sweetalert@1.1.1
spacebars@1.0.15
spacebars-compiler@1.1.3
srp@1.0.10
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-2fa/client/TOTPPassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Meteor.loginWithPassword = function(email, password, cb) {
return cb(error);
}

swal({
modal.open({
title: t('Two-factor_authentication'),
text: t('Open_your_authentication_app_and_enter_the_code'),
type: 'input',
Expand Down
10 changes: 5 additions & 5 deletions packages/rocketchat-2fa/client/accountSecurity.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Template.accountSecurity.events({
},

'click .disable-2fa'() {
swal({
modal.open({
title: t('Two-factor_authentication'),
text: t('Open_your_authentication_app_and_enter_the_code'),
type: 'input',
Expand All @@ -64,7 +64,7 @@ Template.accountSecurity.events({
if (result) {
toastr.success(t('Two-factor_authentication_disabled'));
} else {
return toastr.error(t('Invalid_two_factor_code'));
toastr.error(t('Invalid_two_factor_code'));
}
});
});
Expand All @@ -87,7 +87,7 @@ Template.accountSecurity.events({
},

'click .regenerate-codes'(event, instance) {
swal({
modal.open({
title: t('Two-factor_authentication'),
text: t('Open_your_authentication_app_and_enter_the_code'),
type: 'input',
Expand All @@ -109,7 +109,7 @@ Template.accountSecurity.events({
if (result) {
instance.showBackupCodes(result.codes);
} else {
return toastr.error(t('Invalid_two_factor_code'));
toastr.error(t('Invalid_two_factor_code'));
}
});
});
Expand All @@ -130,7 +130,7 @@ Template.accountSecurity.onCreated(function() {
return (index + 1) % 4 === 0 && index < 11 ? `${ value }\n` : `${ value } `;
}).join('');
const codes = `<code class="text-center allow-text-selection">${ backupCodes }</code>`;
swal({
modal.open({
title: t('Backup_codes'),
text: `${ t('Make_sure_you_have_a_copy_of_your_codes', { codes }) }`,
html: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Template.permissionsRole.helpers({
Template.permissionsRole.events({
'click .remove-user'(e, instance) {
e.preventDefault();
swal({
modal.open({
title: t('Are_you_sure'),
type: 'warning',
showCancelButton: true,
Expand All @@ -120,7 +120,7 @@ Template.permissionsRole.events({
return handleError(error);
}

swal({
modal.open({
title: t('Removed'),
text: t('User_removed'),
type: 'success',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Template.channelSettings.helpers({

Template.channelSettings.events({
'click .delete'() {
return swal({
modal.open({
title: t('Are_you_sure'),
text: t('Delete_Room_Warning'),
type: 'warning',
Expand All @@ -94,13 +94,11 @@ Template.channelSettings.events({
closeOnConfirm: false,
html: false
}, () => {
swal.disableButtons();
Meteor.call('eraseRoom', this.rid, function(error) {
if (error) {
handleError(error);
return swal.enableButtons();
return handleError(error);
}
swal({
modal.open({
title: t('Deleted'),
text: t('Room_has_been_deleted'),
type: 'success',
Expand Down Expand Up @@ -309,7 +307,7 @@ Template.channelSettings.onCreated(function() {
};
if (room['default']) {
if (RocketChat.authz.hasRole(Meteor.userId(), 'admin')) {
swal({
modal.open({
title: t('Room_default_change_to_private_will_be_default_no_more'),
type: 'warning',
showCancelButton: true,
Expand Down Expand Up @@ -388,7 +386,7 @@ Template.channelSettings.onCreated(function() {
return RocketChat.authz.hasAtLeastOnePermission(['archive-room', 'unarchive-room'], room._id);
},
save(value, room) {
return swal({
modal.open({
title: t('Are_you_sure'),
type: 'warning',
showCancelButton: true,
Expand All @@ -398,24 +396,22 @@ Template.channelSettings.onCreated(function() {
closeOnConfirm: false,
html: false
}, function(confirmed) {
swal.disableButtons();
if (confirmed) {
const action = value ? 'archiveRoom' : 'unarchiveRoom';
return Meteor.call(action, room._id, function(err) {
Meteor.call(action, room._id, function(err) {
if (err) {
swal.enableButtons();
handleError(err);
}

swal({
modal.open({
title: value ? t('Room_archived') : t('Room_has_been_archived'),
text: value ? t('Room_has_been_archived') : t('Room_has_been_unarchived'),
type: 'success',
timer: 2000,
showConfirmButton: false
});

return RocketChat.callbacks.run(action, room);
RocketChat.callbacks.run(action, room);
});
} else {
return $('.channel-settings form [name=\'archived\']').prop('checked', !!room.archived);
Expand Down
7 changes: 2 additions & 5 deletions packages/rocketchat-custom-sounds/client/admin/soundInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Template.soundInfo.events({
const sound = instance.sound.get();
if (sound != null) {
const _id = sound._id;
swal({
modal.open({
title: t('Are_you_sure'),
text: t('Custom_Sound_Delete_Warning'),
type: 'warning',
Expand All @@ -50,14 +50,11 @@ Template.soundInfo.events({
closeOnConfirm: false,
html: false
}, function() {
swal.disableButtons();

Meteor.call('deleteCustomSound', _id, (error/*, result*/) => {
if (error) {
handleError(error);
swal.enableButtons();
} else {
swal({
modal.open({
title: t('Deleted'),
text: t('Custom_Sound_Has_Been_Deleted'),
type: 'success',
Expand Down
9 changes: 3 additions & 6 deletions packages/rocketchat-emoji-custom/admin/emojiInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Template.emojiInfo.events({
const emoji = instance.emoji.get();
if (emoji != null) {
const _id = emoji._id;
swal({
modal.open({
title: t('Are_you_sure'),
text: t('Custom_Emoji_Delete_Warning'),
type: 'warning',
Expand All @@ -58,14 +58,11 @@ Template.emojiInfo.events({
closeOnConfirm: false,
html: false
}, function() {
swal.disableButtons();

Meteor.call('deleteEmojiCustom', _id, (error/*, result*/) => {
if (error) {
handleError(error);
swal.enableButtons();
return handleError(error);
} else {
swal({
modal.open({
title: t('Deleted'),
text: t('Custom_Emoji_Has_Been_Deleted'),
type: 'success',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Template.integrationsIncoming.events({
'click .submit > .delete': () => {
const params = Template.instance().data.params();

swal({
modal.open({
title: t('Are_you_sure'),
text: t('You_will_not_be_able_to_recover'),
type: 'warning',
Expand All @@ -172,9 +172,9 @@ Template.integrationsIncoming.events({
}, () => {
Meteor.call('deleteIncomingIntegration', params.id, (err) => {
if (err) {
handleError(err);
return handleError(err);
} else {
swal({
modal.open({
title: t('Deleted'),
text: t('Your_entry_has_been_deleted'),
type: 'success',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Template.integrationsOutgoing.events({
'click .submit > .delete': () => {
const params = Template.instance().data.params();

swal({
modal.open({
title: t('Are_you_sure'),
text: t('You_will_not_be_able_to_recover'),
type: 'warning',
Expand All @@ -239,7 +239,7 @@ Template.integrationsOutgoing.events({
if (err) {
handleError(err);
} else {
swal({
modal.open({
title: t('Deleted'),
text: t('Your_entry_has_been_deleted'),
type: 'success',
Expand Down
4 changes: 2 additions & 2 deletions packages/rocketchat-lib/client/lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Meteor.startup(function() {
Meteor.setTimeout(function() {
const currentUrl = location.origin + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX;
if (__meteor_runtime_config__.ROOT_URL.replace(/\/$/, '') !== currentUrl) {
swal({
modal.open({
type: 'warning',
title: t('Warning'),
text: `${ t('The_setting_s_is_configured_to_s_and_you_are_accessing_from_s', t('Site_Url'), siteUrl, currentUrl) }<br/><br/>${ t('Do_you_want_to_change_to_s_question', currentUrl) }`,
Expand All @@ -72,7 +72,7 @@ Meteor.startup(function() {
html: true
}, function() {
Meteor.call('saveSetting', 'Site_Url', currentUrl, function() {
swal({
modal.open({
title: t('Saved'),
type: 'success',
timer: 1000,
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-livechat/app/client/lib/commands.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* globals LivechatVideoCall, Livechat */
/* globals LivechatVideoCall, Livechat, swal */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it still needed to add swal to globals when actually removing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Livechat widget still uses sweetAlert

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 makes sense I just saw the adding in a bunch of files so was checking :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

// Functions to call on messages of type 'command'
this.Commands = {
survey() {
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-livechat/app/client/views/options.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* globals Department, Livechat */
/* globals Department, Livechat, swal */

Template.options.helpers({
showDepartments() {
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-livechat/app/client/views/survey.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* globals swal */

Template.survey.events({
'click button.skip'(e, instance) {
instance.$('#survey').remove();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* globals Department, Livechat */
/* globals Department, Livechat, swal */

Template.switchDepartment.helpers({
departments() {
Expand Down
12 changes: 2 additions & 10 deletions packages/rocketchat-livechat/app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* globals swal */

Template.livechatIntegrationFacebook.helpers({
pages() {
return Template.instance().pages.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ Template.livechatIntegrationWebhook.events({
if (err) {
return handleError(err);
}
swal(t('It_works'), null, 'success');
modal.open({
title: t('It_works'),
type: 'success',
timer: 2000
});
});
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Template.livechatCustomFields.events({
e.preventDefault();
e.stopPropagation();

swal({
modal.open({
title: t('Are_you_sure'),
type: 'warning',
showCancelButton: true,
Expand All @@ -23,7 +23,7 @@ Template.livechatCustomFields.events({
if (error) {
return handleError(error);
}
swal({
modal.open({
title: t('Removed'),
text: t('Field_removed'),
type: 'success',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Template.livechatDepartments.events({
e.preventDefault();
e.stopPropagation();

swal({
modal.open({
title: t('Are_you_sure'),
type: 'warning',
showCancelButton: true,
Expand All @@ -23,7 +23,7 @@ Template.livechatDepartments.events({
if (error) {
return handleError(error);
}
swal({
modal.open({
title: t('Removed'),
text: t('Department_removed'),
type: 'success',
Expand Down
Loading