Add upload and installation errors.

This commit is contained in:
Gunther Brunner
2014-09-04 16:10:42 +09:00
parent 7ea5dd2777
commit 2f172c2fda
14 changed files with 165 additions and 69 deletions

View File

@@ -0,0 +1,4 @@
module.exports = angular.module('stf.upload-service', [
require('gettext').name
])
.filter('uploadError', require('./upload-error-filter'))

View File

@@ -0,0 +1,10 @@
module.exports = function uploadErrorFilter(gettext) {
return function (text) {
return {
'fail_invalid_app_file': gettext('Uploaded file is not valid'),
'fail_download': gettext('Failed to download file'),
'fail_invalid_url': gettext('Cannot access specified URL'),
'fail': gettext('Upload failed')
}[text] || gettext('Upload unknown error')
}
}

View File

@@ -0,0 +1,13 @@
describe('upload', function() {
beforeEach(angular.mock.module(require('./').name))
it('should ...', inject(function($filter) {
var filter = $filter('upload')
expect(filter('input')).toEqual('output')
}))
})