adjusted Alert popup, and added a check for the drag and drop file size

This commit is contained in:
Jared Tabor
2014-07-31 11:55:47 -04:00
parent 27c44ac5d8
commit 4c621aeae7
3 changed files with 17 additions and 10 deletions

View File

@@ -75,15 +75,17 @@ angular.module('Utilities', ['RestServices', 'Utilities'])
* alert-info...). Pass an optional function(){}, if you want a specific action to occur when user
* clicks 'OK' button. Set secondAlert to true, when a second dialog is needed.
*/
.factory('Alert', ['$rootScope', '$compile', '$sce', function ($rootScope, $compile, $sce) {
.factory('Alert', ['$rootScope', '$compile', '$sce', function ($rootScope) {
return function (hdr, msg, cls, action, secondAlert, disableButtons) {
var scope = $rootScope.$new(), alertClass, e;
if (secondAlert) {
e = angular.element(document.getElementById('alert-modal2'));
$compile(e)(scope);
scope.alertHeader2 = hdr;
scope.alertBody2 = $sce.trustAsHtml(msg);
$('#alertHeader2').text(hdr);
$('#alert2-modal-msg').text(msg);
$("#alertHeader").text(msg);
alertClass = (cls) ? cls : 'alert-danger'; //default alert class is alert-danger
$('#alert2-modal-msg').attr({ "class": "alert " + alertClass });
$('#alert-modal2').modal({
show: true,
@@ -104,9 +106,9 @@ angular.module('Utilities', ['RestServices', 'Utilities'])
});
} else {
e = angular.element(document.getElementById('alert-modal'));
$compile(e)(scope);
scope.alertHeader = hdr;
scope.alertBody = $sce.trustAsHtml(msg);
$('#alertHeader').text(hdr);
$('#alert-modal-msg').text(msg);
alertClass = (cls) ? cls : 'alert-danger'; //default alert class is alert-danger
$('#alert-modal-msg').attr({ "class": "alert " + alertClass });
$('#alert-modal').modal({

View File

@@ -786,7 +786,12 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
reader.onerror = function() {
Alert('Error','There was an error reading the selected file.');
};
reader.readAsText(files[0]);
if(files[0].size<10000){
reader.readAsText(files[0]);
}
else {
Alert('Error','There was an error reading the selected file.');
}
});
}
};