Advertisement
Guest User

George Mauer

a guest
Nov 16th, 2009
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         // Closure in charge of taking a set of notifications and displaying them in an area defined by a jquery element.
  2.         // Usage: NotificationDisplay($('#someArea')).populateWith(notificationArray)
  3.         function NotificationsDisplay(area) {
  4.             // private vars
  5.             var displayArea = area
  6.             var templateElem = $('#notificationTemplate');
  7.             // private methods
  8.             function createNotificationDisplay(notification, copyFunc) {
  9.                 var container = templateElem.clone().attr('id', 'notif_' + notification.Id).css('display', 'block')
  10.                 TextNotificationMapper(container).mapToElement(notification)
  11.                 container.find('[name=copy]').click(function() { copyFunc(notification) })
  12.                 return container;
  13.             }
  14.            
  15.             // Closure constructor
  16.             var f = function() { }
  17.             // Public methods
  18.             f.populateWith = function(notifications) {
  19.                 displayArea.empty()
  20.                 for (var i in notifications) {
  21.                     var elem = createNotificationDisplay(notifications[i], CopyManager($('#copyOrderArea')).setTemplate);
  22.                     displayArea.append(elem)
  23.                 }
  24.             }
  25.             return f;
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement