1//JS for notifications. Centralized calling to notification plugins 2//so that we can switch the implemented notification plugin in and out 3//without ever having to change the consuming code 4 5//the default postion for the notification 6var defaultPostion = 'toast-top-right'; 7 8//The default options to pass to the plugins 9var defaultOptions = { positionClass: defaultPostion }; 10 11//error options to pass to the plugin 12//in case of errrors we don't want to 13//fade out the error automatically so it needs to be 14//cleared explicitly by the user 15var defaultErrorOptions = { 16 "debug": false, 17 "positionClass": defaultPostion, 18 "onclick": null, 19 "fadeIn": 300, 20 "timeOut": 0 21} 22 23//use custom options if passed in 24function GetNotificationOptions(customOptions) { 25 26 if (customOptions == null) return defaultOptions; 27 return customOptions; 28} 29 30//use custom options if passed in 31function GetErrorOptions(customOptions) { 32 33 if (customOptions == null) return defaultErrorOptions; 34 return customOptions; 35} 36 37//show a generic save success 38function ShowGenericSavedSuccess(customOptions) { 39 40 toastr.success('Data saved successfully', '', GetNotificationOptions(customOptions)); 41} 42 43//show a specific saved or created message 44//with replacement text for the type of 45//object we have just saved 46function ShowSpecificSuccessReplace(replace, create, customOptions) { 47 var savedText = 'saved'; 48 if (create == true) 49 savedText = 'created'; 50 toastr.success(replace + ' ' + savedText + ' successfully', '', GetNotificationOptions(customOptions)); 51} 52 53//show a success message but with a fully customized 54//message 55function ShowSpecificSuccess(message, customOptions) { 56 57 toastr.success(message, '', GetNotificationOptions(customOptions)); 58} 59 60//show a generic successful delete 61//message with default options 62function ShowGenericDeleteSuccess(customOptions) { 63 toastr.success('Data deleted successfully', '', GetNotificationOptions(customOptions)); 64} 65 66//show a specific successful delete 67//message with default options 68function ShowSpecificDeleteSuccess(replace, customOptions) { 69 toastr.success(replace + ' was deleted successfully', '', GetNotificationOptions(customOptions)); 70} 71 72 73//show information to the user 74//with a specific message 75//using the default options 76function ShowInfo(message, customOptions) { 77 78 toastr.info(message, '', GetNotificationOptions(customOptions)); 79} 80 81 82//show a generic error with not 83//specific information about the error 84//This should be used very restrictively 85//and only as a last resort 86function ShowGenericError(customOptions) { 87 88 toastr.error('An unknown error has occured', '', GetErrorOptions(customOptions)); 89} 90 91//Show a specific error message 92//with default error options 93function ShowSpecificError(error, customOptions) { 94 95 toastr.error(error, '', GetErrorOptions(customOptions)); 96} 97 98
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.