Skip to content

Commit

Permalink
Add extended for bootstrap modal
Browse files Browse the repository at this point in the history
Pouziti pro otevreni formulare v modalnim okne Bootstrap:

<a href="{link edit, $countryId}" data-toggle="modal" class="ajax"><i class="icon-edit"></i> Upravit</a>

V action edit:
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Upravit</h3>
</div>
                            <div class="modal-body">
                                {form countryForm}
                                {form controls}  
                            </div>
                            <div class="modal-footer">
                                {input send, class => 'btn btn-primary'}
                                {input cancel, class => btn,  'data-dismiss' => "modal", 'aria-hidden' => "true"}
                                {/form}
                            </div>
  • Loading branch information
martinknor committed Aug 18, 2013
1 parent 65bc103 commit 68bbe98
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions extensions/modal.ajax.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
(function($, undefined) {

$.nette.ext({
before: function (xhr, settings) {
if (!settings.nette) {
return;
}
$.nette.ext('spinner', null);
this.el = settings.nette.el;
},
success: function(payload) {
var modal = this.el.data('toggle') == 'modal';
if (modal) {
var url = this.el.attr('href');
if (url.indexOf('#') == 0) {
$(url).modal('open');
} else {
$('<div class="modal hide fade">' + payload + '</div>').modal();
}
}
return false;
}
});

})(jQuery);

0 comments on commit 68bbe98

Please sign in to comment.