Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | espaco | 1 | var UIExtendedModals = function () { |
| 2 | |||
| 3 | |||
| 4 | return { |
||
| 5 | //main function to initiate the module |
||
| 6 | init: function () { |
||
| 7 | |||
| 8 | // general settings |
||
| 9 | $.fn.modal.defaults.spinner = $.fn.modalmanager.defaults.spinner = |
||
| 10 | '<div class="loading-spinner" style="width: 200px; margin-left: -100px;">' + |
||
| 11 | '<div class="progress progress-striped active">' + |
||
| 12 | '<div class="progress-bar" style="width: 100%;"></div>' + |
||
| 13 | '</div>' + |
||
| 14 | '</div>'; |
||
| 15 | |||
| 16 | $.fn.modalmanager.defaults.resize = true; |
||
| 17 | |||
| 18 | //dynamic demo: |
||
| 19 | $('.dynamic .demo').click(function(){ |
||
| 20 | var tmpl = [ |
||
| 21 | // tabindex is required for focus |
||
| 22 | '<div class="modal hide fade" tabindex="-1">', |
||
| 23 | '<div class="modal-header">', |
||
| 24 | '<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>', |
||
| 25 | '<h4 class="modal-title">Modal header</h4>', |
||
| 26 | '</div>', |
||
| 27 | '<div class="modal-body">', |
||
| 28 | '<p>Test</p>', |
||
| 29 | '</div>', |
||
| 30 | '<div class="modal-footer">', |
||
| 31 | '<a href="#" data-dismiss="modal" class="btn btn-default">Close</a>', |
||
| 32 | '<a href="#" class="btn btn-primary">Save changes</a>', |
||
| 33 | '</div>', |
||
| 34 | '</div>' |
||
| 35 | ].join(''); |
||
| 36 | |||
| 37 | $(tmpl).modal(); |
||
| 38 | }); |
||
| 39 | |||
| 40 | //ajax demo: |
||
| 41 | var $modal = $('#ajax-modal'); |
||
| 42 | |||
| 43 | $('#ajax-demo').on('click', function(){ |
||
| 44 | // create the backdrop and wait for next modal to be triggered |
||
| 45 | $('body').modalmanager('loading'); |
||
| 46 | |||
| 47 | setTimeout(function(){ |
||
| 48 | $modal.load('ui_extended_modals_ajax_sample.html', '', function(){ |
||
| 49 | $modal.modal(); |
||
| 50 | }); |
||
| 51 | }, 1000); |
||
| 52 | }); |
||
| 53 | |||
| 54 | $modal.on('click', '.update', function(){ |
||
| 55 | $modal.modal('loading'); |
||
| 56 | setTimeout(function(){ |
||
| 57 | $modal |
||
| 58 | .modal('loading') |
||
| 59 | .find('.modal-body') |
||
| 60 | .prepend('<div class="alert alert-info fade in">' + |
||
| 61 | 'Updated!<button type="button" class="close" data-dismiss="alert">×</button>' + |
||
| 62 | '</div>'); |
||
| 63 | }, 1000); |
||
| 64 | }); |
||
| 65 | } |
||
| 66 | |||
| 67 | }; |
||
| 68 | |||
| 69 | }(); |