Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap_modal test app #432

Merged
merged 1 commit into from
Jun 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Empty file.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions test_project/bootstrap_modal/static/js/jquery.min.js

Large diffs are not rendered by default.

65 changes: 65 additions & 0 deletions test_project/bootstrap_modal/templates/bootstrap_modal/modal.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{% extends "base.html" %}
{% load static %}

{% block title %}
Bootstrap modal dialog example
{% endblock %}

{% block branding %}
<h1 style="display: inline-block" id="site-name">Bootstrap modal dialog example</h1>
{% endblock %}

{% block extrahead %}
<link href="{% static 'bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
<script type="text/javascript" src="{% static 'js/jquery.min.js' %}"></script>
<script src="{% static 'bootstrap/js/bootstrap.min.js' %}"></script>
{% include 'autocomplete_light/static.html' %}
<script type="text/javascript">
$(document).ready(function() {
$('#modal_autocomplete').yourlabsAutocomplete({
url: '{% url 'navigation_autocomplete' %}',
choiceSelector: 'a',
}).input.bind('selectChoice', function(e, choice, autocomplete) {
document.location.href = choice.attr('href');
});
});
</script>
{% endblock %}

{% block content %}
<div class="container">
<div class="row">
<div class="col-md-6">
<button style="margin-bottom: 10px" type="button"
class="btn btn-primary btn-block col-md-6"
data-toggle="modal" data-target="#filter-modal">
Open dialog
</button>
</div>
</div>
</div>
<div class="modal fade" id="filter-modal" tabindex="-1" role="dialog" aria-labelledby="filter-modal-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="filter-modal-label">Dialog</h4>
</div>
<div class="modal-body">
<form id="filter-form" class="form-horizontal" method="get">
<div class="form-group">
<div class="col-md-6">
<input type="text" name="q" id="modal_autocomplete" class="form-control">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<input form="filter-form" name="filter" type="submit" class="btn btn-primary" value="Submit">
</div>
</div>
</div>
</div>
{% endblock %}
6 changes: 6 additions & 0 deletions test_project/bootstrap_modal/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.conf.urls import url
from django.views.generic.base import TemplateView

urlpatterns = [
url(r'^$', TemplateView.as_view(template_name="bootstrap_modal/modal.html"), name="bootstrap_modal"),
]
1 change: 1 addition & 0 deletions test_project/test_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@

'navigation_autocomplete',
'admin_autocomplete_in_row',
'bootstrap_modal'
)


Expand Down
3 changes: 2 additions & 1 deletion test_project/test_project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
url(r'^non_admin_add_another/',
include('autocomplete_light.example_apps.non_admin_add_another.urls')),
url(r'^favicon.ico', generic.RedirectView.as_view(url='http://mozilla.org/favicon.ico')),
url(r'^$', generic.TemplateView.as_view(template_name='index.html'))
url(r'^$', generic.TemplateView.as_view(template_name='index.html')),
url(r'^bootstrap_modal/', include('bootstrap_modal.urls')),
]

if django.VERSION < (1, 9):
Expand Down