Guest User

Untitled

a guest
Jul 27th, 2013
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var initModals = function () {
  2.     alert('hi');
  3.     $.fn.modalmanager.defaults.resize = true;
  4.     $.fn.modalmanager.defaults.spinner = '<div class="loading-spinner fade" style="width: 200px; margin-left: -100px;"><img src="assets/img/ajax-modal-loading.gif" align="middle">&nbsp;<span style="font-weight:300; color: #eee; font-size: 18px; font-family:Open Sans;">&nbsp;Loading...</div>';
  5.  
  6.     var $modal = $('#ajax-modal');
  7.     var Products = function () {
  8.  
  9.         $('.modal_product_edit_btn').on('click', function(){
  10.             // create the backdrop and wait for next modal to be triggered
  11.             $('body').modalmanager('loading');
  12.  
  13.                 setTimeout(function(){
  14.                     $modal.load('/products/edit', '', function(){
  15.                         $modal.modal();
  16.                     });
  17.                 }, 1000);
  18.         });
  19.  
  20.         $modal.on('click', '.update', function(){
  21.             $modal.modal('loading');
  22.             setTimeout(function(){
  23.                 $modal
  24.                 .modal('loading')
  25.                 .find('.modal-body')
  26.                 .prepend('<div class="alert alert-info fade in">' +
  27.                 'Updated!<button type="button" class="close" data-dismiss="alert"></button>' +
  28.                 '</div>');
  29.             }, 1000);
  30.         });
  31.     }
  32.     return {
  33.  
  34.         //main function to initiate the module
  35.         init: function () {
  36.             initModals();
  37.         }
  38.     };
  39. }();
Advertisement
Add Comment
Please, Sign In to add comment