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.');
}
});
}
};

View File

@@ -362,7 +362,7 @@
<div class="modal-header">
<button type="button" class="close" ng-hide="disableButtons" data-target="#alert-modal"
data-dismiss="modal" class="modal" aria-hidden="true">&times;</button>
<h3 ng-bind="alertHeader"></h3>
<h3 id= "alertHeader" ng-bind="alertHeader"></h3>
</div>
<div class="modal-body">
<div id="alert-modal-msg" class="alert" ng-bind-html="alertBody"></div>
@@ -380,7 +380,7 @@
<div class="modal-header">
<button type="button" class="close" data-target="#alert-modal2"
data-dismiss="modal" ng-hide="disableButtons2" aria-hidden="true">&times;</button>
<h3 ng-bind="alertHeader2"></h3>
<h3 id="alertHeader2" ng-bind="alertHeader2"></h3>
</div>
<div class="modal-body">
<div id="alert2-modal-msg" class="alert" ng-bind-html="alertBody2"></div>