Advertisement
Guest User

Untitled

a guest
Nov 15th, 2012
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. diff --git a/protected/extensions/EUpdateDialog/assets/EUpdateDialog.js b/protected/extensions/EUpdateDialog/assets/EUpdateDialog.js
  2. index 6437f47..86703c5 100644
  3. --- a/protected/extensions/EUpdateDialog/assets/EUpdateDialog.js
  4. +++ b/protected/extensions/EUpdateDialog/assets/EUpdateDialog.js
  5. @@ -226,7 +226,7 @@ var updateDialog = {
  6. }
  7.  
  8. // Open jQuery UI dialog
  9. - this.dialog.dialog({ title: this.title, width: width }).dialog( 'open' );
  10. + this.dialog.dialog({ title: this.title, width: width, buttons: this.buttons}).dialog( 'open' );
  11.  
  12. // Add loading indicator for feedback
  13. this.addLoader();
  14. @@ -300,6 +300,35 @@ var updateDialog = {
  15.  
  16. // Close UpdateDialog
  17. updateDialog.close();
  18. + },
  19. +
  20. + /**
  21. + * Set dialog buttons
  22. + * @param string or undefined, supports the following
  23. + */
  24. + buttonSet : function( data ){
  25. + switch( data )
  26. + {
  27. + // Callback on render
  28. + case 'delete':
  29. + updateDialog.buttons = {
  30. + Delete: function() { updateDialog.submit(); },
  31. + Cancel: function() { $( this ).dialog( "close" ); }
  32. + }
  33. + break;
  34. +
  35. + // Callback on success
  36. + case undefined:
  37. + case 'self':
  38. + updateDialog.buttons = {};
  39. + break;
  40. +
  41. + // Callback on image delete
  42. + default:
  43. + updateDialog.buttons = {
  44. + Submit: function() { updateDialog.submit(); }}
  45. + break;
  46. + }
  47. }
  48. };
  49.  
  50. @@ -313,12 +342,15 @@ function updateDialogOpen( e ){
  51.  
  52. // Set title for dialog using data attribute
  53. updateDialog.title = $( this ).data( 'update-dialog-title' );
  54. +
  55. + // Set buttons using data attribute
  56. + updateDialog.buttonSet($( this ).data( 'update-dialog-type' ));
  57.  
  58. // Initialize update dialog if it's the first run
  59. - if( typeof updateDialog.dialog === 'undefined' )
  60. - {
  61. - updateDialog.init();
  62. - }
  63. + updateDialog.init();
  64. +
  65. +
  66. +
  67.  
  68. // Open update dialog
  69. updateDialog.open( $( this ).attr( 'href' ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement