Skip to content

Commit

Permalink
Minor style fixes and changes to show http error exceptions with othe…
Browse files Browse the repository at this point in the history
…r message structures
  • Loading branch information
root committed Mar 27, 2015
1 parent e93ba64 commit 7518508
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build/angular-growl-foundation.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
position: fixed;
float: right;
width: 90%;
max-width: 400px;
max-width: 500px;
z-index: 9999;
}
.growl-container.growl-fixed.top-right {
Expand Down
2 changes: 1 addition & 1 deletion build/angular-growl.foundation.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 13 additions & 7 deletions build/angular-growl.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ angular.module('angular-growl').provider('growl', function () {
'$q',
'growl',
function ($q, growl) {
function checkResponse(response) {
if (response.data[_messagesKey] && response.data[_messagesKey].length > 0) {
growl.addServerMessages(response.data[_messagesKey]);
function checkResponse(response,type) {
if (response.data && response.data[_messagesKey] && response.data[_messagesKey].length > 0) {
growl.addServerMessages(response.data[_messagesKey],type);
}
}
return {
Expand All @@ -174,7 +174,7 @@ angular.module('angular-growl').provider('growl', function () {
return response;
},
'responseError': function (rejection) {
checkResponse(rejection);
checkResponse(rejection,'error');
return $q.reject(rejection);
}
};
Expand Down Expand Up @@ -248,11 +248,17 @@ angular.module('angular-growl').provider('growl', function () {
severity = (severity || 'error').toLowerCase();
sendMessage(text, config, severity);
}
function addServerMessages(messages) {
function addServerMessages(messages,type) {
var i, message, severity, length;
length = messages.length;
if(!angular.isArray(messages)){
var temp = {};
temp[_messageTextKey]=messages;
temp[_messageSeverityKey]= type || 'success';
messages = [temp];
}
length = messages.length;
for (i = 0; i < length; i++) {
message = messages[i];
message = messages[i];
if (message[_messageTextKey]) {
severity = (message[_messageSeverityKey] || 'error').toLowerCase();
var config = {};
Expand Down

0 comments on commit 7518508

Please sign in to comment.