diff options
author | noveens <noveen.sachdeva@research.iiit.ac.in> | 2017-02-15 01:56:00 +0530 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-03-23 13:12:29 -0600 |
commit | 40228c0c2b17c800fa5e227b4d2e8d074da82075 (patch) | |
tree | 74f7e43380384b88bc29be08135c0e1252600597 /apps | |
parent | 39ac804899197069b40384afdc40966e22658eca (diff) | |
download | nextcloud-server-40228c0c2b17c800fa5e227b4d2e8d074da82075.tar.gz nextcloud-server-40228c0c2b17c800fa5e227b4d2e8d074da82075.zip |
added quit option in commentstabview.js
added quit option in notif in app.js
added quit option in notif in file-upload.js
added quit option in notif in fileinfomodel.js
added quit option in notif in filelist.js
added quit option in notif in filelist.js
added quit option in notif in tagsplugin.js
added quit option in notif in statusmanager.js
added quit option in notif in external.js
added quit option in notif in versionstabview.js
added quit option in notif in notification.js
changes according to the latest review.
timeout removed since there is a button to close it
translation capability added
typo fixed
test files updated
small errors fixed
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/comments/js/commentstabview.js | 4 | ||||
-rw-r--r-- | apps/files/js/app.js | 3 | ||||
-rw-r--r-- | apps/files/js/file-upload.js | 16 | ||||
-rw-r--r-- | apps/files/js/fileinfomodel.js | 2 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 88 | ||||
-rw-r--r-- | apps/files/js/files.js | 25 | ||||
-rw-r--r-- | apps/files/js/tagsplugin.js | 2 | ||||
-rw-r--r-- | apps/files/tests/js/filelistSpec.js | 2 | ||||
-rw-r--r-- | apps/files_external/js/statusmanager.js | 16 | ||||
-rw-r--r-- | apps/files_versions/js/versionstabview.js | 9 | ||||
-rw-r--r-- | apps/files_versions/tests/js/versionstabviewSpec.js | 2 | ||||
-rw-r--r-- | apps/updatenotification/js/notification.js | 7 |
12 files changed, 98 insertions, 78 deletions
diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js index f60968616a2..2256bea943e 100644 --- a/apps/comments/js/commentstabview.js +++ b/apps/comments/js/commentstabview.js @@ -482,9 +482,9 @@ $form.find('.message').prop('disabled', false); if(!_.isUndefined(commentId)) { - OC.Notification.showTemporary(t('comments', 'Error occurred while updating comment with id {id}', {id: commentId})); + OC.Notification.show(t('comments', 'Error occurred while updating comment with id {id}', {id: commentId}), {type: 'error'}); } else { - OC.Notification.showTemporary(t('comments', 'Error occurred while posting comment')); + OC.Notification.show(t('comments', 'Error occurred while posting comment'), {type: 'error'}); } }, diff --git a/apps/files/js/app.js b/apps/files/js/app.js index 17e92de90dd..d46a0b8f9df 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -54,7 +54,7 @@ var showHidden = $('#showHiddenFiles').val() === "1"; this.$showHiddenFiles.prop('checked', showHidden); if ($('#fileNotFound').val() === "1") { - OC.Notification.showTemporary(t('files', 'File could not be found')); + OC.Notification.show(t('files', 'File could not be found'), {type: 'error'}); } this._filesConfig = new OC.Backbone.Model({ @@ -315,4 +315,3 @@ $(document).ready(function() { OCA.Files.App.initialize(); }); }); - diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 2b28380e0b0..ad4d03a1bdb 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -462,7 +462,7 @@ OC.Uploader.prototype = _.extend({ deferred.resolve(); return; } - OC.Notification.showTemporary(t('files', 'Could not create folder "{dir}"', {dir: fullPath})); + OC.Notification.show(t('files', 'Could not create folder "{dir}"', {dir: fullPath}), {type: 'error'}); deferred.reject(); }); }, function() { @@ -544,7 +544,7 @@ OC.Uploader.prototype = _.extend({ }, showUploadCancelMessage: _.debounce(function() { - OC.Notification.showTemporary(t('files', 'Upload cancelled.'), {timeout: 10}); + OC.Notification.show(t('files', 'Upload cancelled.'), {timeout : 7, type: 'error'}); }, 500), /** * callback for the conflicts dialog @@ -907,19 +907,15 @@ OC.Uploader.prototype = _.extend({ self.showConflict(upload); } else if (status === 404) { // target folder does not exist any more - OC.Notification.showTemporary( - t('files', 'Target folder "{dir}" does not exist any more', {dir: upload.getFullPath()}) - ); + OC.Notification.show(t('files', 'Target folder "{dir}" does not exist any more', {dir: upload.getFullPath()} ), {type: 'error'}); self.cancelUploads(); } else if (status === 507) { // not enough space - OC.Notification.showTemporary( - t('files', 'Not enough free space') - ); + OC.Notification.show(t('files', 'Not enough free space'), {type: 'error'}); self.cancelUploads(); } else { // HTTP connection problem or other error - OC.Notification.showTemporary(data.errorThrown, {timeout: 10}); + OC.Notification.show(data.errorThrown, {type: 'error'}); } if (upload) { @@ -1113,5 +1109,3 @@ OC.Uploader.prototype = _.extend({ return this.fileUploadParam; } }, OC.Backbone.Events); - - diff --git a/apps/files/js/fileinfomodel.js b/apps/files/js/fileinfomodel.js index 9d1eac31940..2205c7e6477 100644 --- a/apps/files/js/fileinfomodel.js +++ b/apps/files/js/fileinfomodel.js @@ -112,7 +112,7 @@ deferred.resolve(status, data); }) .fail(function(status) { - OC.Notification.showTemporary(t('files', 'Could not load info for file "{file}"', {file: self.get('name')})); + OC.Notification.show(t('files', 'Could not load info for file "{file}"', {file: self.get('name')}), {type: 'error'}); deferred.reject(status); }); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 1385fe26771..7e79399bba5 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1630,7 +1630,7 @@ if (status === 403) { // Go home this.changeDirectory('/'); - OC.Notification.showTemporary(t('files', 'This operation is forbidden')); + OC.Notification.show(t('files', 'This operation is forbidden'), {type: 'error'}); return false; } @@ -1638,8 +1638,8 @@ if (status === 500) { // Go home this.changeDirectory('/'); - OC.Notification.showTemporary( - t('files', 'This directory is unavailable, please check the logs or contact the administrator') + OC.Notification.show(t('files', 'This directory is unavailable, please check the logs or contact the administrator'), + {type: 'error'} ); return false; } @@ -1649,8 +1649,8 @@ if (this.getCurrentDirectory() !== '/') { this.changeDirectory('/'); // TODO: read error message from exception - OC.Notification.showTemporary( - t('files', 'Storage is temporarily not available') + OC.Notification.show(t('files', 'Storage is temporarily not available'), + {type: 'error'} ); } return false; @@ -1963,12 +1963,12 @@ .fail(function(status) { if (status === 412) { // TODO: some day here we should invoke the conflict dialog - OC.Notification.showTemporary( - t('files', 'Could not move "{file}", target exists', {file: fileName}) + OC.Notification.show(t('files', 'Could not move "{file}", target exists', + {file: fileName}), {type: 'error'} ); } else { - OC.Notification.showTemporary( - t('files', 'Could not move "{file}"', {file: fileName}) + OC.Notification.show(t('files', 'Could not move "{file}"', + {file: fileName}), {type: 'error'} ); } }) @@ -2085,31 +2085,28 @@ // TODO: 409 means current folder does not exist, redirect ? if (status === 404) { // source not found, so remove it from the list - OC.Notification.showTemporary( - t( - 'files', - 'Could not rename "{fileName}", it does not exist any more', - {fileName: oldName} - ) + OC.Notification.show(t('files', 'Could not rename "{fileName}", it does not exist any more', + {fileName: oldName}), {timeout: 7, type: 'error'} ); + self.remove(newName, {updateSummary: true}); return; } else if (status === 412) { // target exists - OC.Notification.showTemporary( - t( - 'files', - 'The name "{targetName}" is already used in the folder "{dir}". Please choose a different name.', - { - targetName: newName, - dir: self.getCurrentDirectory() - } - ) + OC.Notification.show( + t('files', 'The name "{targetName}" is already used in the folder "{dir}". Please choose a different name.', + { + targetName: newName, + dir: self.getCurrentDirectory(), + }), + { + type: 'error' + } ); } else { // restore the item to its previous state - OC.Notification.showTemporary( - t('files', 'Could not rename "{fileName}"', {fileName: oldName}) + OC.Notification.show(t('files', 'Could not rename "{fileName}"', + {fileName: oldName}), {type: 'error'} ); } updateInList(oldFileInfo); @@ -2191,16 +2188,20 @@ self.addAndFetchFileInfo(targetPath, '', {scrollTo: true}).then(function(status, data) { deferred.resolve(status, data); }, function() { - OC.Notification.showTemporary(t('files', 'Could not create file "{file}"', {file: name})); + OC.Notification.show(t('files', 'Could not create file "{file}"', + {file: name}), {type: 'error'} + ); }); }) .fail(function(status) { if (status === 412) { - OC.Notification.showTemporary( - t('files', 'Could not create file "{file}" because it already exists', {file: name}) + OC.Notification.show(t('files', 'Could not create file "{file}" because it already exists', + {file: name}), {type: 'error'} ); } else { - OC.Notification.showTemporary(t('files', 'Could not create file "{file}"', {file: name})); + OC.Notification.show(t('files', 'Could not create file "{file}"', + {file: name}), {type: 'error'} + ); } deferred.reject(status); }); @@ -2237,7 +2238,9 @@ self.addAndFetchFileInfo(targetPath, '', {scrollTo:true}).then(function(status, data) { deferred.resolve(status, data); }, function() { - OC.Notification.showTemporary(t('files', 'Could not create folder "{dir}"', {dir: name})); + OC.Notification.show(t('files', 'Could not create folder "{dir}"', + {dir: name}), {type: 'error'} + ); }); }) .fail(function(createStatus) { @@ -2246,20 +2249,22 @@ // add it to the list, for completeness self.addAndFetchFileInfo(targetPath, '', {scrollTo:true}) .done(function(status, data) { - OC.Notification.showTemporary( - t('files', 'Could not create folder "{dir}" because it already exists', {dir: name}) + OC.Notification.show(t('files', 'Could not create folder "{dir}" because it already exists', + {dir: name}), {type: 'error'} ); // still consider a failure deferred.reject(createStatus, data); }) .fail(function() { - OC.Notification.showTemporary( - t('files', 'Could not create folder "{dir}"', {dir: name}) + OC.Notification.show(t('files', 'Could not create folder "{dir}"', + {dir: name}), {type: 'error'} ); deferred.reject(status); }); } else { - OC.Notification.showTemporary(t('files', 'Could not create folder "{dir}"', {dir: name})); + OC.Notification.show(t('files', 'Could not create folder "{dir}"', + {dir: name}), {type: 'error'} + ); deferred.reject(createStatus); } }); @@ -2314,7 +2319,9 @@ deferred.resolve(status, data); }) .fail(function(status) { - OC.Notification.showTemporary(t('files', 'Could not create file "{file}"', {file: name})); + OC.Notification.show(t('files', 'Could not create file "{file}"', + {file: name}), {type: 'error'} + ); deferred.reject(status); }); @@ -2423,9 +2430,8 @@ removeFromList(file); } else { // only reset the spinner for that one file - OC.Notification.showTemporary( - t('files', 'Error deleting file "{fileName}".', {fileName: file}), - {timeout: 10} + OC.Notification.show(t('files', 'Error deleting file "{fileName}".', + {fileName: file}), {type: 'error'} ); var deleteAction = self.findFileEl(file).find('.action.delete'); deleteAction.removeClass('icon-loading-small').addClass('icon-delete'); @@ -2689,7 +2695,7 @@ */ _showPermissionDeniedNotification: function() { var message = t('core', 'You don’t have permission to upload or create files here'); - OC.Notification.showTemporary(message); + OC.Notification.show(message, {type: 'error'}); }, /** diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 5b345a45b67..a30194013e5 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -117,21 +117,34 @@ ownerDisplayName = $('#ownerDisplayName').val(); if (usedSpacePercent > 98) { if (owner !== oc_current_user) { - OC.Notification.showTemporary(t('files', 'Storage of {owner} is full, files can not be updated or synced anymore!', - { owner: ownerDisplayName })); + OC.Notification.show(t('files', 'Storage of {owner} is full, files can not be updated or synced anymore!', + {owner: ownerDisplayName}), {type: 'error'} + ); return; } - OC.Notification.show(t('files', 'Your storage is full, files can not be updated or synced anymore!')); + OC.Notification.show(t('files', + 'Your storage is full, files can not be updated or synced anymore!'), + {type : 'error'} + ); return; } if (usedSpacePercent > 90) { if (owner !== oc_current_user) { - OC.Notification.showTemporary(t('files', 'Storage of {owner} is almost full ({usedSpacePercent}%)', - { usedSpacePercent: usedSpacePercent, owner: ownerDisplayName })); + OC.Notification.show(t('files', 'Storage of {owner} is almost full ({usedSpacePercent}%)', + { + usedSpacePercent: usedSpacePercent, + owner: ownerDisplayName + }), + { + type: 'error' + } + ); return; } OC.Notification.show(t('files', 'Your storage is almost full ({usedSpacePercent}%)', - {usedSpacePercent: usedSpacePercent})); + {usedSpacePercent: usedSpacePercent}), + {type : 'error'} + ); } }, diff --git a/apps/files/js/tagsplugin.js b/apps/files/js/tagsplugin.js index 9bb4ba33598..67bd9c667c8 100644 --- a/apps/files/js/tagsplugin.js +++ b/apps/files/js/tagsplugin.js @@ -233,7 +233,7 @@ if(response.responseJSON && response.responseJSON.message) { message = ': ' + response.responseJSON.message; } - OC.Notification.showTemporary(t('files', 'An error occurred while trying to update the tags') + message); + OC.Notification.show(t('files', 'An error occurred while trying to update the tags' + message), {type: 'error'}); toggleStar($actionEl, isFavorite); }); } diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index f3c04c48cb3..865aa35ac6a 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -68,7 +68,7 @@ describe('OCA.Files.FileList tests', function() { useHTTPS: false }); redirectStub = sinon.stub(OC, 'redirect'); - notificationStub = sinon.stub(OC.Notification, 'showTemporary'); + notificationStub = sinon.stub(OC.Notification, 'show'); // prevent resize algo to mess up breadcrumb order while // testing bcResizeStub = sinon.stub(OCA.Files.BreadCrumb.prototype, '_resize'); diff --git a/apps/files_external/js/statusmanager.js b/apps/files_external/js/statusmanager.js index 782b0b08288..ae4ce989130 100644 --- a/apps/files_external/js/statusmanager.js +++ b/apps/files_external/js/statusmanager.js @@ -157,7 +157,9 @@ OCA.External.StatusManager = { }, error: function (jqxhr, state, error) { self.mountPointList = []; - OC.Notification.showTemporary(t('files_external', 'Couldn\'t get the list of external mount points: {type}', {type: error})); + OC.Notification.show(t('files_external', 'Couldn\'t get the list of external mount points: {type}', + {type: error}), {type: 'error'} + ); }, complete: function () { self.isGetMountPointListRunning = false; @@ -265,7 +267,9 @@ OCA.External.StatusManager = { // check if we have a list first if (list === undefined && !self.emptyWarningShown) { self.emptyWarningShown = true; - OC.Notification.showTemporary(t('files_external', 'Couldn\'t get the list of Windows network drive mount points: empty response from the server')); + OC.Notification.show(t('files_external', 'Couldn\'t get the list of Windows network drive mount points: empty response from the server'), + {type: 'error'} + ); return; } if (list && list.length > 0) { @@ -295,7 +299,9 @@ OCA.External.StatusManager = { } }); if (showNotification) { - OC.Notification.showTemporary(t('files_external', 'Some of the configured external mount points are not connected. Please click on the red row(s) for more information')); + OC.Notification.show(t('files_external', 'Some of the configured external mount points are not connected. Please click on the red row(s) for more information'), + {type: 'error'} + ); } } }); @@ -414,14 +420,14 @@ OCA.External.StatusManager = { } }, success: function (data) { - OC.Notification.showTemporary(t('files_external', 'Credentials saved')); + OC.Notification.show(t('files_external', 'Credentials saved'), {type: 'error'}); dialog.ocdialog('close'); /* Trigger status check again */ OCA.External.StatusManager.recheckConnectivityForMount([OC.basename(data.mountPoint)], true); }, error: function () { $('.oc-dialog-close').show(); - OC.Notification.showTemporary(t('files_external', 'Credentials saving failed')); + OC.Notification.show(t('files_external', 'Credentials saving failed'), {type: 'error'}); } }); return false; diff --git a/apps/files_versions/js/versionstabview.js b/apps/files_versions/js/versionstabview.js index e5ca115ecfa..aa20d8fda7a 100644 --- a/apps/files_versions/js/versionstabview.js +++ b/apps/files_versions/js/versionstabview.js @@ -133,11 +133,14 @@ fileInfoModel.trigger('busy', fileInfoModel, false); self.$el.find('.versions').removeClass('hidden'); self._toggleLoading(false); - OC.Notification.showTemporary( - t('files_version', 'Failed to revert {file} to revision {timestamp}.', { + OC.Notification.show(t('files_version', 'Failed to revert {file} to revision {timestamp}.', + { file: versionModel.getFullPath(), timestamp: OC.Util.formatDate(versionModel.get('timestamp') * 1000) - }) + }), + { + type: 'error' + } ); } }); diff --git a/apps/files_versions/tests/js/versionstabviewSpec.js b/apps/files_versions/tests/js/versionstabviewSpec.js index cadd4eb363e..94ad72d0f77 100644 --- a/apps/files_versions/tests/js/versionstabviewSpec.js +++ b/apps/files_versions/tests/js/versionstabviewSpec.js @@ -224,7 +224,7 @@ describe('OCA.Versions.VersionsTabView', function() { expect(changes.etag).toBeDefined(); }); it('shows notification on revert error', function() { - var notificationStub = sinon.stub(OC.Notification, 'showTemporary'); + var notificationStub = sinon.stub(OC.Notification, 'show'); tabView.$el.find('.revertVersion').eq(1).click(); diff --git a/apps/updatenotification/js/notification.js b/apps/updatenotification/js/notification.js index 26215b50df0..a2e78cecb09 100644 --- a/apps/updatenotification/js/notification.js +++ b/apps/updatenotification/js/notification.js @@ -17,11 +17,10 @@ $(document).ready(function(){ var text = t('core', '{version} is available. Get more information on how to update.', {version: oc_updateState.updateVersion}), element = $('<a>').attr('href', oc_updateState.updateLink).attr('target','_blank').text(text); - OC.Notification.showTemporary( - element, + OC.Notification.show(element, { - isHTML: true + isHTML: true, + type: 'error' } ); }); - |