]> source.dussan.org Git - nextcloud-server.git/commitdiff
added quit option in commentstabview.js 4007/head
authornoveens <noveen.sachdeva@research.iiit.ac.in>
Tue, 14 Feb 2017 20:26:00 +0000 (01:56 +0530)
committerMorris Jobke <hey@morrisjobke.de>
Thu, 23 Mar 2017 19:12:29 +0000 (13:12 -0600)
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>
12 files changed:
apps/comments/js/commentstabview.js
apps/files/js/app.js
apps/files/js/file-upload.js
apps/files/js/fileinfomodel.js
apps/files/js/filelist.js
apps/files/js/files.js
apps/files/js/tagsplugin.js
apps/files/tests/js/filelistSpec.js
apps/files_external/js/statusmanager.js
apps/files_versions/js/versionstabview.js
apps/files_versions/tests/js/versionstabviewSpec.js
apps/updatenotification/js/notification.js

index f60968616a2a756d00f68e48c89cb743999be57c..2256bea943ec536de8e89fd9b1d3c0e48690b87a 100644 (file)
                        $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'});
                        }
                },
 
index 17e92de90ddc9da8795595bc46167d5aecf45b8c..d46a0b8f9df6ef5b7fde36a2d96e7850aea6b3fa 100644 (file)
@@ -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();
        });
 });
-
index 2b28380e0b017e1003cd15562f195a7166648ea7..ad4d03a1bdb00dcfd7a4b86146ca15b139c63cc9 100644 (file)
@@ -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);
-
-
index 9d1eac31940e2adfea22b4abee9f9843a2ee62b6..2205c7e6477220acb2561f76e86292e64cdd44d2 100644 (file)
                                        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);
                                });
 
index 1385fe26771add0d4470acbc87ba78bdcde29848..7e79399bba59c2eee25dda96d5b50b96567edd52 100644 (file)
                        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;
                        }
 
                        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;
                        }
                                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;
                                        .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'}
                                                        );
                                                }
                                        })
                                                                // 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);
                                        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);
                                });
                                        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) {
                                                // 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);
                                        }
                                });
                                        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);
                                });
 
                                                        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');
                 */
                _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'});
                },
 
                /**
index 5b345a45b67d3611e7f6c92955aad840b4a26d85..a30194013e5a9a40214b8e67dc447cb6ed117147 100644 (file)
                                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'}
+                               );
                        }
                },
 
index 9bb4ba335989e45d730120173a12394e9db47d95..67bd9c667c84154fa20413c554e553b47255f9d2 100644 (file)
                                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);
                        });
                }
index f3c04c48cb325d12e188e9f1c7b5d188aa17a9aa..865aa35ac6ac6876fdc81650ff7e7e6632445832 100644 (file)
@@ -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');
index 782b0b082888e8384166a58f36d97ad2e4b95f80..ae4ce9891306029d7f9e81660a8a742d05c6f6c8 100644 (file)
@@ -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;
index e5ca115ecfadd17c25d370293c08b99d00ffc903..aa20d8fda7abf3d22c5960dfc533737cc1d74b89 100644 (file)
                                        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'
+                                               }
                                        );
                                }
                        });
index cadd4eb363e76ba566fc5e048baff433eea4ae1e..94ad72d0f77248029c42d61d2aad4155acb6b4a3 100644 (file)
@@ -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();
 
index 26215b50df074473b48b41484ec0c5ba8c2e7b2e..a2e78cecb0972b7cfca2c7c1101442d66ace05b9 100644 (file)
@@ -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'
                }
        );
 });
-